From: Junio C Hamano <gitster@pobox•com>
To: Bernhard Reiter <ockham@raz•or.at>
Cc: "Torsten Bögershausen" <tboegi@web•de>, git@vger•kernel.org
Subject: Re: [PATCH] git-imap-send: use libcurl for implementation
Date: Mon, 10 Nov 2014 09:19:00 -0800 [thread overview]
Message-ID: <xmqqfvdr9dob.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <545F8079.7010806@raz.or.at> (Bernhard Reiter's message of "Sun, 09 Nov 2014 15:55:53 +0100")
Bernhard Reiter <ockham@raz•or.at> writes:
> Am 2014-11-09 um 14:00 schrieb Torsten Bögershausen:
>> On 2014-08-27 00.40, Bernhard Reiter wrote:
>>> Use libcurl's high-level API functions to implement git-imap-send
>>> instead of the previous low-level OpenSSL-based functions.
>>>
>> This doesn't seem to fully work under Debian 7:
>> /home/tb/projects/git/git.pu/imap-send.c:1546: undefined reference
>> to `curl_append_msgs_to_imap'
>
> Thx for the notice. I forgot to guard that with an #ifdef.
>
> The new patch below includes that, and the fix sent by Ramsay;
> hopefully the squashed/edited commit message is fine.
Queued with a small fix-ups, including
- line-fold a couple of overlong lines;
- avoid decl-after-stmt of "int prev_len";
- reduce the scope of "struct struct auth" down to only the block
it is used;
- the footer of the log message now reads "helped-by ramsay", your
sign-off and then mine.
Thanks.
diff --git a/imap-send.c b/imap-send.c
index 08271d9..4dfe4c2 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1349,7 +1349,8 @@ static void git_imap_config(void)
git_config_get_string("imap.authmethod", &server.auth_method);
}
-static int append_msgs_to_imap(struct imap_server_conf *server, struct strbuf* all_msgs, int total)
+static int append_msgs_to_imap(struct imap_server_conf *server,
+ struct strbuf* all_msgs, int total)
{
struct strbuf msg = STRBUF_INIT;
struct imap_store *ctx = NULL;
@@ -1391,7 +1392,6 @@ static CURL *setup_curl(struct imap_server_conf *srvc)
{
CURL *curl;
struct strbuf path = STRBUF_INIT;
- struct strbuf auth = STRBUF_INIT;
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
die("curl_global_init failed");
@@ -1414,11 +1414,12 @@ static CURL *setup_curl(struct imap_server_conf *srvc)
curl_easy_setopt(curl, CURLOPT_PORT, server.port);
if (server.auth_method) {
+ struct strbuf auth = STRBUF_INIT;
strbuf_addstr(&auth, "AUTH=");
strbuf_addstr(&auth, server.auth_method);
curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, auth.buf);
+ strbuf_release(&auth);
}
- strbuf_release(&auth);
if (server.use_ssl)
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
@@ -1436,7 +1437,8 @@ static CURL *setup_curl(struct imap_server_conf *srvc)
return curl;
}
-static int curl_append_msgs_to_imap(struct imap_server_conf *server, struct strbuf* all_msgs, int total) {
+static int curl_append_msgs_to_imap(struct imap_server_conf *server,
+ struct strbuf* all_msgs, int total) {
int ofs = 0;
int n = 0;
struct buffer msgbuf = { STRBUF_INIT, 0 };
@@ -1449,17 +1451,19 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server, struct strb
fprintf(stderr, "sending %d message%s\n", total, (total != 1) ? "s" : "");
while (1) {
unsigned percent = n * 100 / total;
+ int prev_len;
fprintf(stderr, "%4u%% (%d/%d) done\r", percent, n, total);
- int prev_len = msgbuf.buf.len;
+ prev_len = msgbuf.buf.len;
if (!split_msg(all_msgs, &msgbuf.buf, &ofs))
break;
if (server->use_html)
wrap_in_html(&msgbuf.buf);
lf_to_crlf(&msgbuf.buf);
- curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)(msgbuf.buf.len-prev_len));
+ curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
+ (curl_off_t)(msgbuf.buf.len-prev_len));
res = curl_easy_perform(curl);
prev parent reply other threads:[~2014-11-10 17:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 22:40 [PATCH] git-imap-send: use libcurl for implementation Bernhard Reiter
2014-08-27 17:20 ` Junio C Hamano
2014-10-12 15:22 ` Bernhard Reiter
2014-10-22 15:05 ` Fwd: " Bernhard Reiter
2014-10-22 17:47 ` Junio C Hamano
2014-10-29 18:41 ` Bernhard Reiter
2014-10-29 20:56 ` Junio C Hamano
2014-11-09 13:00 ` Torsten Bögershausen
2014-11-09 14:55 ` Bernhard Reiter
2014-11-09 17:27 ` Ramsay Jones
2014-11-09 17:45 ` Junio C Hamano
2014-11-10 17:19 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfvdr9dob.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=ockham@raz$(echo .)or.at \
--cc=tboegi@web$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox