From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org, jstpierre@mecheye.net
Subject: Re: [PATCH] Do not unquote + into ' ' in URLs
Date: Fri, 23 Jul 2010 22:20:25 +0000 [thread overview]
Message-ID: <AANLkTil6sD71n1aDrUQf4ATnlE_L7ltJa500cI6bH6X8@mail.gmail.com> (raw)
In-Reply-To: <db9c97908966fa332be07b2a9f5215679e35b9e0.1279920066.git.trast@student.ethz.ch>
On Fri, Jul 23, 2010 at 21:23, Thomas Rast <trast@student.ethz.ch> wrote:
> Since 9d2e942 (decode file:// and ssh:// URLs, 2010-05-23) the URL
> logic unquotes escaped URLs. For the %2B type of escape, this is
> conformant with RFC 2396. However, it also unquotes + into a space
> character, which is only appropriate for the query strings in HTTP.
> This notably broke fetching from the gtk+ repository.
>
> Remove the corresponding bit of code.
>
> Reported-by: Jasper St. Pierre <jstpierre@mecheye.net>
> Signed-off-by: Thomas Rast <trast@student.ethz.ch>
> ---
>
> Jasper St. Pierre wrote:
>> Yep. http://www.ietf.org/rfc/rfc2396.txt defines '+' as a reserved character,
>> but doesn't give a purpose for it. www-form-encoded replaces space with '+'
>> but in a URL it can mean anything it wants.
>
> So let's do this then, instead?
>
> Based on the discussion, I would consider this a bugfix that should go
> in 1.7.2.1.
>
>
> t/t5601-clone.sh | 10 ++++++++--
> url.c | 5 +----
> 2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
> index 8abb71a..4431dfd 100755
> --- a/t/t5601-clone.sh
> +++ b/t/t5601-clone.sh
> @@ -178,8 +178,14 @@ test_expect_success 'clone respects global branch.autosetuprebase' '
>
> test_expect_success 'respect url-encoding of file://' '
> git init x+y &&
> - test_must_fail git clone "file://$PWD/x+y" xy-url &&
> - git clone "file://$PWD/x%2By" xy-url
> + git clone "file://$PWD/x+y" xy-url-1 &&
> + git clone "file://$PWD/x%2By" xy-url-2
> +'
> +
> +test_expect_success 'do not query-string-decode + in URLs' '
> + rm -rf x+y &&
> + git init "x y" &&
> + test_must_fail git clone "file://$PWD/x+y" xy-no-plus
> '
>
> test_expect_success 'do not respect url-encoding of non-url path' '
> diff --git a/url.c b/url.c
> index 2306236..fa4b8d4 100644
> --- a/url.c
> +++ b/url.c
> @@ -90,10 +90,7 @@ static char *url_decode_internal(const char **query, const char *stop_at, struct
> }
> }
>
> - if (c == '+')
> - strbuf_addch(out, ' ');
> - else
> - strbuf_addch(out, c);
> + strbuf_addch(out, c);
> q++;
> } while (1);
> *query = q;
> --
> 1.7.2.rc3.335.g26d7d
>
This looks good, Ack.
But as icing, it'd be nice to extend these tests to create files /
clone repositories with the rest of the reserved characters:
http://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters
Of course that would have to be wrapped in something that skips the
tests if those paths can't be created. E.g. "/" is a no-no on Unix,
and some of the others will probably cause troubles on other systems.
next prev parent reply other threads:[~2010-07-23 22:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-23 13:18 URL decoding changed semantics of + in URLs Thomas Rast
2010-07-23 13:21 ` Thomas Rast
2010-07-23 14:10 ` Ævar Arnfjörð Bjarmason
2010-07-23 14:25 ` Jasper St. Pierre
2010-07-23 21:23 ` [PATCH] Do not unquote + into ' ' " Thomas Rast
2010-07-23 22:20 ` Ævar Arnfjörð Bjarmason [this message]
2010-07-23 22:26 ` Junio C Hamano
2010-07-23 23:04 ` Thomas Rast
2010-07-24 14:49 ` [PATCH v2] " Thomas Rast
2010-07-31 21:18 ` Jasper St. Pierre
2010-07-31 21:33 ` Thomas Rast
2010-08-06 10:46 ` Ralf Ebert
2010-07-26 15:40 ` URL decoding changed semantics of + " Jeff King
2010-07-26 17:57 ` Ævar Arnfjörð Bjarmason
2010-07-26 18:22 ` Jasper St. Pierre
2010-07-26 18:30 ` Matthieu Moy
2010-07-26 18:35 ` Ævar Arnfjörð Bjarmason
2010-07-26 18:44 ` Jasper St. Pierre
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=AANLkTil6sD71n1aDrUQf4ATnlE_L7ltJa500cI6bH6X8@mail.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=jstpierre@mecheye.net \
--cc=peff@peff.net \
--cc=trast@student.ethz.ch \
/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.
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 NNTP newsgroup(s).