[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Interesting problem with ":" in mod_dav_svn XML output

From: Michael Sinz <Michael.Sinz_at_sinz.org>
Date: 2005-10-21 23:18:04 CEST

Something just "bit me" with XSLT displayed pages from mod_dav_svn.
I say that in quotes as I had already had worked around the problem,
before I even knew about it, for other reasons.

Anyway, the problem is that the ":" character is not escaped in the
"href" attribute of the file and directory elements.

This is a problem as the ":" character is a special character that
separates protocol from port within a URL and thus must be escaped
if it is not serving in that manner.

Thus, the mod_dav_svn XML output below would fail to correctly
link to the file "TestCase-:-.txt" as the browser would complain
about the protocol.

Other special characters are correctly escaped as far as I can see.

When looking at the code, it seems that this is a non-trivial change
since the escaping happens within Apache and that it is a general URI
escaper. Thus, the net result is that it does not know if the ":" should
be escaped or not (given that it could be part of the "http://" or part
of the "host:port" string)

The code that does this is generated by the server/gen_test_char.c within
Apache. Since mod_dav_svn uses ap_escape_uri() which is actually a
define to ap_os_escape_path() which looks at the T_OS_ESCAPE_PATH flag
in the table.

The file server/gen_test_char.c generates the table.

Maybe this is one case where some other method would need to be used
since the href field is always just a relative path?

So, I did not make a patch for this (yet) as I would like to get some
input as to the best way to go. I think this could be handled via a
special case on top of the Apache escaping - since I don't know if there
would be a reasonable way to change Apache on this issue.

-----------------------------output from mod_dav_svn---------------------------

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/insurrection.xsl"?>
<!DOCTYPE svn [
   <!ELEMENT svn (index)>
   <!ATTLIST svn version CDATA #REQUIRED
                   href CDATA #REQUIRED>
   <!ELEMENT index (updir?, (file | dir)*)>
   <!ATTLIST index name CDATA #IMPLIED
                   path CDATA #IMPLIED
                   rev CDATA #IMPLIED>
   <!ELEMENT updir EMPTY>
   <!ELEMENT file (prop)*>
                   href CDATA #REQUIRED>
   <!ELEMENT dir (prop)*>

                   href CDATA #REQUIRED>
   <!ELEMENT prop (#PCDATA)>
<svn version="1.2.3 (r15833)"
   <index rev="31" path="/trunk/tests/TestCase-:-">
     <updir />
     <file name="TestCase-:-.txt" href="TestCase-:-.txt"></file>
     <file name="test.txt" href="test.txt"></file>


Michael Sinz                     Technology and Engineering Director/Consultant
"Starting Startups"                                mailto:michael.sinz@sinz.org
My place on the web                            http://www.sinz.org/Michael.Sinz
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Oct 21 23:21:47 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.