Thread

Posted on Tue Mar 13 02:42:24 2007 by alnd
URI encoding of forward slash to percent 2F messes up repository browsing

I've got SVN::Web 0.52 running on Apache 2.2.4/Subversion 1.4.3/Apache2::RequestRec (mod_perl) 2.000003 on a RHEL 4.3 box. Without svnweb, the svn services are fine (but are boring to view). Configuring svnweb has been a challenge. If I try to look at the contents of project 'abc' with a web browser I get this error (url for this at my site is https://svn/svnweb/abc):

Repository List / abc @ r An error occured (SVN::Client->new() failed: file:///home/websvn/repositories/abc Bad URL passed to RA layer: Unrecognized URL scheme for file:///home/websvn/repositories/abc at /us +r/lib/perl5/site_perl/5.8.5/SVN/Web.pm line 145 )

However when I force a reload on the page, it comes up fine.

Next problem: Links deeper down are messed up. If I follow abc's trunk and try to examine some source code there, the links generated by svnweb look like this:

https://svn/svnweb/rexdb/browse%2Ftrunk/src
The %2F should be a forward slash, in otherwords, the generated url should be
https://svn/svnweb/rexdb/browse/trunk/src

If I manually replace the %2F with / and reload, it shows the desired page just fine. Manually doing that change gets old fast though!

Anyone have clues to resolving these problems?

Direct Responses: 4557 | 5017 | Write a response
Posted on Tue Mar 13 15:51:18 2007 by nikc in response to 4549
Re: URI encoding of forward slash to percent 2F messes up repository browsing

The first issue sounds like it's down to trailing slash (either one that's omitted when it's expected, or expected and been omitted). If you send me the relevant parts of your Apache config I'll take a look.

The %2f problem is down to a change in a very recent version of Template Toolkit. The 'uri' filter now considers '/' to be characters that it should encode, which it does, resulting in %2f in the output.

Right now, your choices are either:

a) Downgrade the TT installation. Version 2.15 is known to work.

b) Adjust the templates. If you haven't changed anything, look in the templates/trac directory of the directory in which you ran svnweb-install.

It's probably sufficient to find everything that looks like this:

... /ACTION[% c.path | uri | html %]...

(where ACTION is one of the actions, like 'log', 'browse', 'view', and so on) and insert a slash straight after the ACTION, so that it becomes:

... /ACTION/[% c.path | uri | html %]

I haven't had the chance to test this though.

If you do (b), and it works, please let me know (nik@ngo.org.uk, or svnweb@ngo.org.uk for the mailing list) and I'll roll that in to a new release.

I will be looking at this, but I don't have a great deal of spare time at the moment. It's top of my list of things to resolve though.

Direct Responses: 4577 | Write a response
Posted on Fri Mar 16 00:00:16 2007 by alnd in response to 4557
Re: URI encoding of forward slash to percent 2F messes up repository browsing
For #1 I added the trailing slash for the original top level url and that fixed the problem. But auto generated url's deeper down appear without the slash and adding the slash there doesn't fix it; only a reload will. I appreciate your offer to look at my httpd.conf; I'll try to identify the relevant sections and send those. #2: I issued this command in the template/trac directory:
perl -pi -e 's{(\w+)(\[% c\.path \| uri \| html)}{$1/$2}' *

and it looks like it inserted the slash in the right places. Here's an example from one of the files:

grep 'c.path | uri | html' view <img src="[% c.script %]/[% c.repos %]/checkout/[% c.path | uri | html %]" /> <p>This file can not be displayed in the browser. You can <a href="[% c.script %]/[% c.repos %]/ch +eckout/[% c.path | uri | html %]">download it</a>.</p>

Now when I browse the repository I see the extra slash--but the %2F is there too: https://svn/svnweb/rexdb/browse/rexdb/browse/%2Ftrunk/src also it introduced a new problem, now there are two slashes after "browse" in a higher level url: https://svn/svnweb/rexdb/browse//rexdb/ and much of the nice formatting is gone, I see vanilla html as I do without svnweb. Probably my perl edit command was overly aggressive.

Direct Responses: 4578 | Write a response
Posted on Fri Mar 16 00:24:45 2007 by ricardo in response to 4577
Re: URI encoding of forward slash to percent 2F messes up repository browsing
Just wanted to say, that I'm wrestling with exactly the same %2F problem. I will probably try a downgrade of TT, as the template modification shows no satisfactory results Also, I'm having the problem of some revisions not showing the (diff) Link, nor the diff visualization. Richard
Direct Responses: 4698 | Write a response
Posted on Wed Mar 28 21:33:04 2007 by ajo in response to 4578
Re: URI encoding of forward slash to percent 2F messes up repository browsing
There is another solution if you use Apache >= 2.0.46. Add the following directive in the apache conf:
AllowEncodedSlashes On
This will allow %2F in urls and it solved the problems for me.
Write a response
Posted on Mon Apr 30 11:03:05 2007 by nikc in response to 4549
Re: URI encoding of forward slash to percent 2F messes up repository browsing
I just released SVN::Web 0.53 which should fix this problem. Please try it, and let me know if you still have any problems. Thanks.
Write a response