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

Re: mod_dav_svn of SVN 1.9.3 doesn't seem to calc repo names from URLs with spaces properly.

From: Thorsten Schöning <tschoening_at_am-soft.de>
Date: Fri, 14 Jun 2019 15:45:52 +0200

Guten Tag Thorsten Schöning,
am Freitag, 14. Juni 2019 um 12:12 schrieben Sie:

> And I think that's the problem: The matched location is forwarded
> using a space to mod_dav_svn, which tries to calculate the repo name
> from the request and that request most likely containes %20 instead of
> the space. So calculation simply fails:

I'm not so sure about that anymore, because it seems the "Location"
configured in httpd gets forwarded to mod_authz_svn and that seems to
handle HEX-encoding as needed:

> conf->base_path = svn_urlpath__canonicalize(d, p);

https://github.com/apache/subversion/blob/1.9.3/subversion/mod_authz_svn/mod_authz_svn.c#L121

> uri = svn_fspath__canonicalize(uri, pool);
> /* Do a little dance to normalize hex encoding. */
> uri = svn_path_uri_decode(uri, pool);
> uri = svn_path_uri_encode(uri, pool);

https://github.com/apache/subversion/blob/1.9.3/subversion/libsvn_subr/dirent_uri.c#L2622

This seems the request might contain the space instead of %20, but I
have some mod_perl-handler on my own and am somewhat sure that that
contained %20 instead of spaces. At least there's code in there
unescaping an URI of a request...

But doesn't change that much overall, I'm still unabale to tell
mod_dav_svn to use the same URLs.

> But I couldn't find anything simple like using spaces in URLs to
> repos.

I'm more convinced now that space is the correct thing to configure
instead of %20 in "Location". Not only because it only works this way,
but as well because such a discussion is more likely for mod_rewrite
and in those case spaces are to be used as well always.

https://stackoverflow.com/questions/410811/mod-rewrite-with-spaces-in-the-urls

> Any workarounds you can think of with being able to keep the space in
> the URL?

I tried simply using a rewrite rule to internally change " " to "_",
and while that works to properly forward requests containing "%20" to
mod_dav_svn, the latter fails again. While I can authenticate
successfully, SVN doesn't error out because of missing authz files and
the client even starts creating the .svn-dir, a checkout doesn't work
in the end because of the following errors:

> Could not parse 'src-path' URL. [500, #190001]
> Unusable URI: it does not refer to this repository [500, #190001]

So internally replacing parts of the URL is not an option. Sending a
redirect to the client instead seems to work:

> RewriteRule "^(svn/Bin/LSG) (BE-BB/.+)$" "$1_$2" [L]
vs.
> RewriteRule "^(svn/Bin/LSG) (BE-BB/.+)$" "$1_$2" [R=301,L]

It seems the only option currently is really to avoid the spaces in
URLs containing the repo name. While keeping them in the configured
SVNParentPath still works!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening_at_AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
Received on 2019-06-14 15:46:19 CEST

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