You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/11/14 21:06:09 UTC

svn commit: r1542049 - in /subversion/branches/1.7.x-r1541790: ./ subversion/mod_dav_svn/dav_svn.h subversion/mod_dav_svn/mod_dav_svn.c subversion/mod_dav_svn/repos.c subversion/mod_dav_svn/util.c

Author: breser
Date: Thu Nov 14 20:06:08 2013
New Revision: 1542049

URL: http://svn.apache.org/r1542049
Log:
On 1.7.x-r1541790 branch: Merge r1542042 from trunk.

Modified:
    subversion/branches/1.7.x-r1541790/   (props changed)
    subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/dav_svn.h
    subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/mod_dav_svn.c
    subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/repos.c
    subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/util.c

Propchange: subversion/branches/1.7.x-r1541790/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1542042

Modified: subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/dav_svn.h?rev=1542049&r1=1542048&r2=1542049&view=diff
==============================================================================
--- subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/dav_svn.h Thu Nov 14 20:06:08 2013
@@ -841,6 +841,12 @@ dav_svn__simple_parse_uri(dav_svn__uri_i
                           const char *uri,
                           apr_pool_t *pool);
 
+/* Test the request R to determine if we should return the list of
+ * repositories at the parent path.  Only true if SVNListParentPath directive
+ * is 'on' and the request is for our configured root path. */
+svn_boolean_t
+dav_svn__is_parentpath_list(request_rec *r);
+
 
 int dav_svn__find_ns(const apr_array_header_t *namespaces, const char *uri);
 

Modified: subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/mod_dav_svn.c?rev=1542049&r1=1542048&r2=1542049&view=diff
==============================================================================
--- subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/mod_dav_svn.c Thu Nov 14 20:06:08 2013
@@ -931,51 +931,45 @@ static int dav_svn__handler(request_rec 
  * that %f in logging formats will show as "svn:/path/to/repo/path/in/repo". */
 static int dav_svn__translate_name(request_rec *r)
 {
-  const char *fs_path, *repos_path, *slash;
-  const char *repos_basename = NULL;
+  const char *fs_path, *repos_basename, *repos_path, *slash;
   const char *ignore_cleaned_uri, *ignore_relative_path;
   int ignore_had_slash;
-  dav_error *err;
   dir_conf_t *conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
 
   /* module is not configured, bail out early */
   if (!conf->fs_path && !conf->fs_parent_path)
     return DECLINED;
 
-  /* Retrieve path to repo and within repo for the request */
-  err = dav_svn_split_uri(r, r->uri, conf->root_dir, &ignore_cleaned_uri,
-                          &ignore_had_slash, &repos_basename,
-                          &ignore_relative_path, &repos_path);
-
-  if (conf->fs_parent_path)
+  if (dav_svn__is_parentpath_list(r))
     {
-      if (err)
-        {
-          if (!repos_basename)
-            {
-              /* detect that there is no repos_basename.  We can't error out
-               * here due to this because it would mean that SVNListParentPath
-               * wouldn't work.  So set things up to just use the parent path
-               * as our bogus path. */
-              repos_basename = ""; 
-              repos_path = NULL;
-            }
-          else
-            {
-              dav_svn__log_err(r, err, APLOG_ERR);
-              return err->status;
-            }
-        }
-      fs_path = svn_dirent_join(conf->fs_parent_path, repos_basename,
-                                r->pool);
+      /* SVNListParentPath is on and the request is for the conf->root_dir,
+       * so just set the repos_basename to an empty string and the repos_path
+       * to NULL so we end up just reporting our parent path as the bogus
+       * path. */
+      repos_basename = "";
+      repos_path = NULL;
     }
   else
     {
+      /* Retrieve path to repo and within repo for the request */
+      dav_error *err = dav_svn_split_uri(r, r->uri, conf->root_dir,
+                                         &ignore_cleaned_uri,
+                                         &ignore_had_slash, &repos_basename,
+                                         &ignore_relative_path, &repos_path);
       if (err)
         {
           dav_svn__log_err(r, err, APLOG_ERR);
           return err->status;
         }
+    }
+
+  if (conf->fs_parent_path)
+    {
+      fs_path = svn_dirent_join(conf->fs_parent_path, repos_basename,
+                                r->pool);
+    }
+  else
+    {
       fs_path = conf->fs_path;
     }
 

Modified: subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/repos.c?rev=1542049&r1=1542048&r2=1542049&view=diff
==============================================================================
--- subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/repos.c Thu Nov 14 20:06:08 2013
@@ -1957,26 +1957,12 @@ get_resource(request_rec *r,
 
   /* Special case: detect and build the SVNParentPath as a unique type
      of private resource, iff the SVNListParentPath directive is 'on'. */
-  if (fs_parent_path && dav_svn__get_list_parentpath_flag(r))
+  if (dav_svn__is_parentpath_list(r))
     {
-      char *uri = apr_pstrdup(r->pool, r->uri);
-      char *parentpath = apr_pstrdup(r->pool, root_path);
-      apr_size_t uri_len = strlen(uri);
-      apr_size_t parentpath_len = strlen(parentpath);
-
-      if (uri[uri_len-1] == '/')
-        uri[uri_len-1] = '\0';
-
-      if (parentpath[parentpath_len-1] == '/')
-        parentpath[parentpath_len-1] = '\0';
-
-      if (strcmp(parentpath, uri) == 0)
-        {
-          err = get_parentpath_resource(r, resource);
-          if (err)
-            return err;
-          return NULL;
-        }
+      err = get_parentpath_resource(r, resource);
+      if (err)
+        return err;
+      return NULL;
     }
 
   /* This does all the work of interpreting/splitting the request uri. */

Modified: subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/util.c?rev=1542049&r1=1542048&r2=1542049&view=diff
==============================================================================
--- subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/util.c (original)
+++ subversion/branches/1.7.x-r1541790/subversion/mod_dav_svn/util.c Thu Nov 14 20:06:08 2013
@@ -412,6 +412,32 @@ dav_svn__simple_parse_uri(dav_svn__uri_i
                           "Unsupported URI form");
 }
 
+svn_boolean_t
+dav_svn__is_parentpath_list(request_rec *r)
+{
+  const char *fs_parent_path = dav_svn__get_fs_parent_path(r);
+
+  if (fs_parent_path && dav_svn__get_list_parentpath_flag(r))
+    {
+      const char *root_path = dav_svn__get_root_dir(r);
+      char *uri = apr_pstrdup(r->pool, r->uri);
+      char *parentpath = apr_pstrdup(r->pool, root_path);
+      apr_size_t uri_len = strlen(uri);
+      apr_size_t parentpath_len = strlen(parentpath);
+
+      if (uri[uri_len-1] == '/')
+        uri[uri_len-1] = '\0';
+
+      if (parentpath[parentpath_len-1] == '/')
+        parentpath[parentpath_len-1] = '\0';
+
+      if (strcmp(parentpath, uri) == 0)
+        {
+          return TRUE;
+        }
+    }
+  return FALSE;
+}
 
 /* ### move this into apr_xml */
 int