You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Mathias Weinert <ma...@gfa-net.de> on 2006/02/23 15:36:32 UTC

[Patch] URI-encoding of '#'

Hi there,

please have a look at the following svn commands:
$ svn info http://anyhost/a
svn: PROPFIND request failed on '/a'
svn: PROPFIND of '/a': Could not resolve hostname `anyhost': Unknown host (http://anyhost)

$ svn info http://anyhost/�
svn: PROPFIND request failed on '/%C2%A7'
svn: PROPFIND of '/%C2%A7': Could not resolve hostname `anyhost': Unknown host (http://anyhost)

$ svn info http://anyhost/#
svn: URL 'http://anyhost/#' is not properly URI-encoded

As you can see the URI-encoding of '#' doesn't work. At least
it doesn't work in my environment - Subversion 1.3.0 on cygwin.
I also checked it under Windows and there the problem is also
existing (in version 1.3.0 as well as in version 1.2.3).
You get the same error if you e. g. say 'svn info http://...'
with ... replaced by an existing path containing a '#'.

After applying the appended patch it looks as follows:

$ svn info http://anyhost/#
svn: PROPFIND request failed on '/%23'
svn: PROPFIND of '/%23': Could not resolve hostname `anyhost': Unknown host (http://anyhost)

I hope that my patch is the right solution for this problem.

Mathias

[[[
* subversion/libsvn_subr/patch.c
  - changed value of '#' (0x23) in uri_autoescape_chars[256]
    from 1 to 0 as this character has to be escaped
]]]

--- subversion/libsvn_subr/path.c.orig  2005-06-09 21:34:15.000000000 +0200
+++ subversion/libsvn_subr/path.c       2006-02-23 15:55:13.732901500 +0100
@@ -938,7 +938,7 @@
 const char uri_autoescape_chars[256] = {
   1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1,
   1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1,
-  0, 1, 0, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1,
+  0, 1, 0, 0, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1,
   1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 0, 1, 0, 1,

   /* 64 */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [Patch] URI-encoding of '#'

Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Thu, 23 Feb 2006, Mathias Weinert wrote:

> $ svn info http://anyhost/#
> svn: URL 'http://anyhost/#' is not properly URI-encoded
>
> As you can see the URI-encoding of '#' doesn't work. At least
> it doesn't work in my environment - Subversion 1.3.0 on cygwin.
> I also checked it under Windows and there the problem is also
> existing (in version 1.3.0 as well as in version 1.2.3).

Since the # sign has a special meaning in a URI, we can't automatically
escape it there. The auto-escaping is meant as a convenience for
characters that don't have another meaning.  Other characters, you will
need to excape by hand.

Thanks,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org