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

Re: [PATCH] svn ls http://svn.host.tld/

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-08-06 22:29:42 CEST

On Tue, Aug 06, 2002 at 11:19:42AM -0500, Karl Fogel wrote:
>...
> root_path comes from repos->root_path. The `repos' struct is of type
> `dav_svn_repos'. Here's the documentation for the `root_path' field
> in that struct:
>
> /* Remember the root URL path of this repository (just a path; no
> scheme, host, or port).
> Example: the URI is "http://host/repos/file", this will be "/repos". */
> const char *root_path;
>
> This documentation does not explicitly say that root_path never ends
> in a slash (when it has a non-empty component), although the example
> implies it. If we can count on that, then your patch is robust
> enough, but we should also change the documentation in dav_svn.h so
> this promise is explicit.

See line 882 of mod_dav_svn/repos.c. The root_path will *not* have a
trailing slash, unless it equals "/". So yes, the header comment should be
updated with the additional information.

>...
> This algorithm, while less efficient, solves the problem in both the
> "/" case and any other case. I'm not saying we have to do that, but
> we should sure it's not necessary before we go with the "/"-only
> algorithm of your patch.

[efficiency nit]

The path is guaranteed to at least be one character long, and have a leading
slash. Thus, the strcmp() against "/" is overkill. The test can be written
as:

    if (root_path[1] == '\0')

> What happens if dav_svn_get_resource() is called for a Location that
> ends in a trailing slash? For example, someone writes
>
> <Location /foo/bar/>
>
> in httpd.conf. Won't root_path still have that trailing slash by the
> time we do your check? Is this a problem?

No. mod_dav removes the trailing slash in mod_dav.c::dav_create_dir_config()

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 6 22:27:48 2002

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.