From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>,
Git List <git@vger.kernel.org>,
daniel@haxx.se, Jonathan Nieder <jrnieder@gmail.com>,
doron.behar@gmail.com, Jeff King <peff@peff.net>
Subject: Re: [PATCH] imap-send: URI encode server folder
Date: Tue, 05 Dec 2017 07:30:36 -0800 [thread overview]
Message-ID: <xmqqd13tjioz.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAPig+cSEYHfupRt+-0sZK6H3_WcT_=wdNB2FfdYuB6geGQYZ3A@mail.gmail.com> (Eric Sunshine's message of "Thu, 30 Nov 2017 12:53:16 -0500")
Eric Sunshine <sunshine@sunshineco.com> writes:
> ... Can you
> expand the commit message a bit to make it more self-contained? At
> minimum, perhaps show the error message you were experiencing, and
> cite (as Daniel pointed out) RFC 3986 and the bit about a "legal" URL
> not containing brackets.
Thanks for a good suggestion.
>
> Also, a natural question which pops into the head of someone reading
> this patch is whether other parts of the URL (host, user, etc.) also
> need to be handled similarly. It's possible that you audited the code
> and determined that they are handled fine already, but the reader of
> the commit message is unable to infer that. Consequently, it might be
> nice to have a sentence about that, as well ("other parts of the URL
> are already encoded, thus are fine" or "other parts of the URL are not
> subject to this problem because ...").
>
> The patch itself looks okay (from a cursory read).
>
> Thanks.
>
>> Reported-by: Doron Behar <doron.behar@gmail.com>
>> Signed-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>
>> ---
>> imap-send.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/imap-send.c b/imap-send.c
>> index 54e6a80fd..36c7c1b4f 100644
>> --- a/imap-send.c
>> +++ b/imap-send.c
>> @@ -1412,6 +1412,7 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
>> {
>> CURL *curl;
>> struct strbuf path = STRBUF_INIT;
>> + char *uri_encoded_folder;
>>
>> if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
>> die("curl_global_init failed");
>> @@ -1429,7 +1430,12 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
>> strbuf_addstr(&path, server.host);
>> if (!path.len || path.buf[path.len - 1] != '/')
>> strbuf_addch(&path, '/');
>> - strbuf_addstr(&path, server.folder);
>> +
>> + uri_encoded_folder = curl_easy_escape(curl, server.folder, 0);
>> + if (!uri_encoded_folder)
>> + die("failed to encode server folder");
>> + strbuf_addstr(&path, uri_encoded_folder);
>> + curl_free(uri_encoded_folder);
>>
>> curl_easy_setopt(curl, CURLOPT_URL, path.buf);
>> strbuf_release(&path);
>> --
>> 2.15.1.272.g8e603414b
next prev parent reply other threads:[~2017-12-05 15:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 17:13 imap-send with gmail: curl_easy_perform() failed: URL using bad/illegal format or missing URL Doron Behar
2017-11-30 2:04 ` Jonathan Nieder
2017-11-30 3:28 ` Jeff King
2017-11-30 3:55 ` Jeff King
2017-11-30 9:39 ` Nicolas Morey-Chaisemartin
2017-11-30 9:46 ` Daniel Stenberg
2017-11-30 9:51 ` Nicolas Morey-Chaisemartin
2017-11-30 9:55 ` Daniel Stenberg
2017-11-30 9:47 ` Nicolas Morey-Chaisemartin
2017-11-30 10:07 ` [PATCH] imap-send: URI encode server folder Nicolas Morey-Chaisemartin
2017-11-30 17:53 ` Eric Sunshine
2017-12-05 15:30 ` Junio C Hamano [this message]
2017-12-18 18:25 ` [PATCH v2] " Kaartic Sivaraam
2017-12-18 18:48 ` Eric Sunshine
2017-12-18 19:11 ` [PATCH v3] " Kaartic Sivaraam
2017-12-18 22:19 ` Jonathan Nieder
2017-12-18 22:32 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqd13tjioz.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=daniel@haxx.se \
--cc=doron.behar@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=nmoreychaisemartin@suse.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).