From: Jakub Narebski <jnareb@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jay Soffian <jaysoffian@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] gitweb: URL-decode $my_url/$my_uri when stripping PATH_INFO
Date: Wed, 15 Aug 2012 20:15:48 +0200 [thread overview]
Message-ID: <201208152015.49132.jnareb@gmail.com> (raw)
In-Reply-To: <7vr4rgoz1u.fsf@alter.siamese.dyndns.org>
On Thu, 9 Aug 2012, Junio C Hamano wrote:
> Jay Soffian <jaysoffian@gmail.com> writes:
>
> > When gitweb is used as a DirectoryIndex, it attempts to strip
> > PATH_INFO on its own, as $cgi->url() fails to do so.
> >
> > However, it fails to account for the fact that PATH_INFO has
> > already been URL-decoded by the web server, but the value
> > returned by $cgi->url() has not been. This causes the stripping
> > to fail whenever the URL contains encoded characters.
> >
> > To see this in action, setup gitweb as a DirectoryIndex and
> > then use it on a repository with a directory containing a
> > space in the name. Navigate to tree view, examine the gitweb
> > generated html and you'll see a link such as:
> >
> > <a href="/test.git/tree/HEAD:/directory with spaces">directory with spaces</a>
> >
> > When clicked on, the browser will URL-encode this link, giving
> > a $cgi->url() of the form:
> >
> > /test.git/tree/HEAD:/directory%20with%20spaces
> >
> > While PATH_INFO is:
> >
> > /test.git/tree/HEAD:/directory with spaces
> >
> > Fix this by calling unescape() on both $my_url and $my_uri before
> > stripping PATH_INFO from them.
> >
> > Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
> > ---
>
> Thanks. From a cursory look, with the help from the explanation in
> the proposed commit log message, the change looks sensible.
>
> I wonder if a breakage like this is something we can catch in one of
> the t95xx series of tests, though.
No, it is unfortunately not possible with current test infrastructure
for gitweb. The gitweb_run from t/gitweb-lib.sh allows to set
PATH_INFO and QUERY_STRING, but does not allow to set up URL.
That might change in the future...
> Jakub, Ack?
Acked-by: Jakub Narebski <jnareb@gmail.com>
Uf ut us bot too late...
--
Jakub Narebski
Poland
next prev parent reply other threads:[~2012-08-15 18:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-09 2:29 [PATCH] gitweb: URL-decode $my_url/$my_uri when stripping PATH_INFO Jay Soffian
2012-08-09 15:38 ` Junio C Hamano
2012-08-15 18:15 ` Jakub Narebski [this message]
2012-08-15 18:47 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201208152015.49132.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jaysoffian@gmail.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.
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).