You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2011/08/24 18:53:12 UTC

svn commit: r1161202 - in /subversion/trunk/subversion/mod_dav_svn: dav_svn.h reports/update.c util.c

Author: cmpilato
Date: Wed Aug 24 16:53:11 2011
New Revision: 1161202

URL: http://svn.apache.org/viewvc?rev=1161202&view=rev
Log:
Avoid telling HTTPv2-aware clients to fetch v1-style resources when
they could be singing a new song.

* subversion/mod_dav_svn/dav_svn.h
  (enum dav_svn__build_what): Add new 'DAV_SVN__BUILD_URI_REVROOT' value.

* subversion/mod_dav_svn/util.c
  (dav_svn__build_uri): Handle DAV_SVN__BUILD_URI_REVROOT, too.

* subversion/mod_dav_svn/reports/update.c
  (update_ctx_t): Add 'enable_v2_response' boolean.
  (send_vsn_url): If a v2-style response is enabled, send back revroot
    URLs; otherwise, fall back to versioned resource URLs.
  (dav_svn__update_report): Set the new 'enable_v2_response' flag.

Modified:
    subversion/trunk/subversion/mod_dav_svn/dav_svn.h
    subversion/trunk/subversion/mod_dav_svn/reports/update.c
    subversion/trunk/subversion/mod_dav_svn/util.c

Modified: subversion/trunk/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/dav_svn.h?rev=1161202&r1=1161201&r2=1161202&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/trunk/subversion/mod_dav_svn/dav_svn.h Wed Aug 24 16:53:11 2011
@@ -808,7 +808,8 @@ enum dav_svn__build_what {
   DAV_SVN__BUILD_URI_BC,         /* a Baseline Collection */
   DAV_SVN__BUILD_URI_PUBLIC,     /* the "public" VCR */
   DAV_SVN__BUILD_URI_VERSION,    /* a Version Resource */
-  DAV_SVN__BUILD_URI_VCC         /* a Version Controlled Configuration */
+  DAV_SVN__BUILD_URI_VCC,        /* a Version Controlled Configuration */
+  DAV_SVN__BUILD_URI_REVROOT     /* HTTPv2: Revision Root resource */
 };
 
 const char *

Modified: subversion/trunk/subversion/mod_dav_svn/reports/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/update.c?rev=1161202&r1=1161201&r2=1161202&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/update.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/update.c Wed Aug 24 16:53:11 2011
@@ -82,6 +82,11 @@ typedef struct update_ctx_t {
 
   /* SVNDIFF version to send to client.  */
   int svndiff_version;
+
+  /* Did the client submit this REPORT request via the HTTPv2 "me
+     resource" and are we advertising support for as much? */
+  svn_boolean_t enable_v2_response;
+
 } update_ctx_t;
 
 typedef struct item_baton_t {
@@ -219,9 +224,18 @@ send_vsn_url(item_baton_t *baton, apr_po
   path = get_real_fs_path(baton, pool);
   revision = dav_svn__get_safe_cr(baton->uc->rev_root, path, pool);
 
-  href = dav_svn__build_uri(baton->uc->resource->info->repos,
-                            DAV_SVN__BUILD_URI_VERSION,
-                            revision, path, 0 /* add_href */, pool);
+  if (baton->uc->enable_v2_response)
+    {
+      href = dav_svn__build_uri(baton->uc->resource->info->repos,
+                                DAV_SVN__BUILD_URI_REVROOT,
+                                revision, path, 0 /* add_href */, pool);
+    }
+  else
+    {
+      href = dav_svn__build_uri(baton->uc->resource->info->repos,
+                                DAV_SVN__BUILD_URI_VERSION,
+                                revision, path, 0 /* add_href */, pool);
+    }
 
   return dav_svn__brigade_printf(baton->uc->bb, baton->uc->output,
                                  "<D:checked-in><D:href>%s</D:href>"
@@ -1073,6 +1087,9 @@ dav_svn__update_report(const dav_resourc
   uc.target = target;
   uc.bb = apr_brigade_create(resource->pool, output->c->bucket_alloc);
   uc.pathmap = NULL;
+  uc.enable_v2_response = ((resource->info->restype == DAV_SVN_RESTYPE_ME)
+                           && (resource->info->repos->v2_protocol));
+
   if (dst_path) /* we're doing a 'switch' */
     {
       if (*target)

Modified: subversion/trunk/subversion/mod_dav_svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/util.c?rev=1161202&r1=1161201&r2=1161202&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/util.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/util.c Wed Aug 24 16:53:11 2011
@@ -264,6 +264,11 @@ dav_svn__build_uri(const dav_svn_repos *
                           href1, root_path, special_uri,
                           revision, path_uri, href2);
 
+    case DAV_SVN__BUILD_URI_REVROOT:
+      return apr_psprintf(pool, "%s%s/%s/rvr/%ld%s%s",
+                          href1, root_path, special_uri,
+                          revision, path_uri, href2);
+
     case DAV_SVN__BUILD_URI_VCC:
       return apr_psprintf(pool, "%s%s/%s/vcc/" DAV_SVN__DEFAULT_VCC_NAME "%s",
                           href1, root_path, special_uri, href2);