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

Working on issue #946

From: Peter Allin <peter_at_arbejdskamp.dk>
Date: 2002-12-31 10:51:33 CET

Hi,

I've been browsing the Subversion source code for the last couple of
days. To get a place to start I've worked a bit on issue #946.

As mentioned on Issuezilla I've found out that the 405 error is
returned, when I try to checkout (or otherwise access) an URL that
doesn't point at a repository.

It seems the error code is generated in the following code from
libsvn_ra_dav/props.c in svn_ra_dav__get_baseline_props() (starting
from line 514 in revision 4213):

{
  /* Try to get the starting_props from the public url. If the
     resource no longer exists in HEAD, we'll get a failure. That's
     fine: just keep removing components and trying to get the
     starting_props from parent directories. */
  svn_error_t *err;
  apr_size_t len;
  svn_stringbuf_t *path_s = svn_stringbuf_create (parsed_url.path,
pool);
   while (! svn_path_is_empty (path_s->data))
    {
      err = svn_ra_dav__get_starting_props(&rsrc, sess, path_s->data,
                                           NULL, pool);
      if (! err)
        break; /* found an existing parent! */
       if (err->apr_err != SVN_ERR_RA_DAV_REQUEST_FAILED)
        return err; /* found a _real_ error */
       /* else... lop off the basename and try again. */
      lopped_path = svn_path_join(svn_path_basename (path_s->data,
pool),
                                  lopped_path,
                                  pool);
      len = path_s->len;
      svn_path_remove_component(path_s);
      if (path_s->len == len)
          /* whoa, infinite loop, get out. */
        return err;
       svn_error_clear (err);
    }
   if (svn_path_is_empty (path_s->data))
    {
      /* entire URL was bogus; not a single part of it exists in
         the repository! */
      err = svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
                              "No part of path '%s' was found in "
                              "repository HEAD.", parsed_url.path);
      ne_uri_free(&parsed_url);
      return err;
    }
  ne_uri_free(&parsed_url);
}

Where the call to svn_ra_dav__get_starting_props() returns a 405
error. The the while-loop starts removing components from the path, but
each of the thus generated paths also results in a 405. The while loop
continues until the path is cut down to "/". Then the
svn_path_remove_component() function returns "/" and the "whoa,
infinite loop, get out" return is executed with the 405 errorcode.

The svn_path_is_empty() function never returns TRUE in this
scenario because the path is only cut down to "/" not "". Is the
condition in the while statement meant to check for this scenario or
something else? If I understand the comment at the top and the
returned error message in the bottom correctly, it's meant to check
for some other condition.

Would it be OK to return an error saying something like "The URL %s is
not part of any repository" if the path becomes "/" without the
svn_ra_dav__get_starting_props() succeeding? As far as I can see it
would work - but maybe it breaks some outher usage of the
svn_ra_dav__get_baseline_props() function?

/Peter Allin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Dec 31 10:58:22 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.