subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r1398963 - in /subversion/branches/http-dynamic-prop-namespaces: ./ 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/version.c
Date Tue, 16 Oct 2012 20:01:35 GMT
Author: cmpilato
Date: Tue Oct 16 20:01:34 2012
New Revision: 1398963

URL: http://svn.apache.org/viewvc?rev=1398963&view=rev
Log:
Sync the 'http-dynamic-prop-namespaces' branch with recent trunk changes.
(Merged /subversion/trunk:r1398942-1398962.)

Modified:
    subversion/branches/http-dynamic-prop-namespaces/   (props changed)
    subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/dav_svn.h
    subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/mod_dav_svn.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/repos.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/version.c

Propchange: subversion/branches/http-dynamic-prop-namespaces/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1398942-1398962

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/dav_svn.h?rev=1398963&r1=1398962&r2=1398963&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/dav_svn.h Tue
Oct 16 20:01:34 2012
@@ -309,13 +309,6 @@ svn_boolean_t dav_svn__get_autoversionin
 /* for the repository referred to by this request, are bulk updates allowed? */
 svn_boolean_t dav_svn__get_bulk_updates_flag(request_rec *r);
 
-/* for the repository referred to by this request, should httpv2 be advertised? */
-svn_boolean_t dav_svn__get_v2_protocol_flag(request_rec *r);
-
-/* for the repository referred to by this request, should ephemeral
-   txnprop support be advertised? */
-svn_boolean_t dav_svn__get_ephemeral_txnprops_flag(request_rec *r);
-
 /* for the repository referred to by this request, are subrequests active? */
 svn_boolean_t dav_svn__get_pathauthz_flag(request_rec *r);
 
@@ -337,6 +330,17 @@ authz_svn__subreq_bypass_func_t dav_svn_
    SVNParentPath allowed? */
 svn_boolean_t dav_svn__get_list_parentpath_flag(request_rec *r);
 
+/* For the repository referred to by this request, should HTTPv2
+   protocol support be advertised?  Note that this also takes into
+   account the support level expected of based on the specified
+   master server version (if provided via SVNMasterVersion).  */
+svn_boolean_t dav_svn__check_httpv2_support(request_rec *r);
+
+/* For the repository referred to by this request, should ephemeral
+   txnprop support be advertised?  */
+svn_boolean_t dav_svn__check_ephemeral_txnprops_support(request_rec *r);
+
+
 
 /* SPECIAL URI
 
@@ -385,6 +389,11 @@ const char *dav_svn__get_xslt_uri(reques
 /* ### Is this assumed to be URI-encoded? */
 const char *dav_svn__get_master_uri(request_rec *r);
 
+/* Return the version of the master server (used for mirroring) iff a
+   master URI is in place for this location; otherwise, return NULL.
+   Comes from the <SVNMasterVersion> directive. */
+svn_version_t *dav_svn__get_master_version(request_rec *r);
+
 /* Return the disk path to the activities db.
    Comes from the <SVNActivitiesDB> directive. */
 const char *dav_svn__get_activities_db(request_rec *r);

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/mod_dav_svn.c?rev=1398963&r1=1398962&r2=1398963&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/mod_dav_svn.c
(original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/mod_dav_svn.c
Tue Oct 16 20:01:34 2012
@@ -42,6 +42,7 @@
 #include "mod_dav_svn.h"
 
 #include "private/svn_fspath.h"
+#include "private/svn_subr_private.h"
 
 #include "dav_svn.h"
 #include "mod_authz_svn.h"
@@ -88,11 +89,11 @@ typedef struct dir_conf_t {
   enum conf_flag autoversioning;     /* whether autoversioning is active */
   enum conf_flag bulk_updates;       /* whether bulk updates are allowed */
   enum conf_flag v2_protocol;        /* whether HTTP v2 is advertised */
-  enum conf_flag ephemeral_txnprops; /* advertise ephemeral txnprop support? */
   enum path_authz_conf path_authz_method; /* how GET subrequests are handled */
   enum conf_flag list_parentpath;    /* whether to allow GET of parentpath */
   const char *root_dir;              /* our top-level directory */
   const char *master_uri;            /* URI to the master SVN repos */
+  svn_version_t *master_version;     /* version of master server */
   const char *activities_db;         /* path to activities database(s) */
   enum conf_flag txdelta_cache;      /* whether to enable txdelta caching */
   enum conf_flag fulltext_cache;     /* whether to enable fulltext caching */
@@ -197,7 +198,6 @@ create_dir_config(apr_pool_t *p, char *d
     conf->root_dir = svn_urlpath__canonicalize(dir, p);
   conf->bulk_updates = CONF_FLAG_ON;
   conf->v2_protocol = CONF_FLAG_ON;
-  conf->ephemeral_txnprops = CONF_FLAG_ON;
   conf->hooks_env = NULL;
 
   return conf;
@@ -216,6 +216,7 @@ merge_dir_config(apr_pool_t *p, void *ba
 
   newconf->fs_path = INHERIT_VALUE(parent, child, fs_path);
   newconf->master_uri = INHERIT_VALUE(parent, child, master_uri);
+  newconf->master_version = INHERIT_VALUE(parent, child, master_version);
   newconf->activities_db = INHERIT_VALUE(parent, child, activities_db);
   newconf->repo_name = INHERIT_VALUE(parent, child, repo_name);
   newconf->xslt_uri = INHERIT_VALUE(parent, child, xslt_uri);
@@ -223,8 +224,6 @@ merge_dir_config(apr_pool_t *p, void *ba
   newconf->autoversioning = INHERIT_VALUE(parent, child, autoversioning);
   newconf->bulk_updates = INHERIT_VALUE(parent, child, bulk_updates);
   newconf->v2_protocol = INHERIT_VALUE(parent, child, v2_protocol);
-  newconf->ephemeral_txnprops = INHERIT_VALUE(parent, child,
-                                              ephemeral_txnprops);
   newconf->path_authz_method = INHERIT_VALUE(parent, child, path_authz_method);
   newconf->list_parentpath = INHERIT_VALUE(parent, child, list_parentpath);
   newconf->txdelta_cache = INHERIT_VALUE(parent, child, txdelta_cache);
@@ -286,6 +285,25 @@ SVNMasterURI_cmd(cmd_parms *cmd, void *c
 
 
 static const char *
+SVNMasterVersion_cmd(cmd_parms *cmd, void *config, const char *arg1)
+{
+  dir_conf_t *conf = config;
+  svn_error_t *err;
+  svn_version_t *version;
+
+  err = svn_version__parse_version_string(&version, arg1, cmd->pool);
+  if (err)
+    {
+      svn_error_clear(err);
+      return "Malformed master server version string.";
+    }
+  
+  conf->master_version = version;
+  return NULL;
+}
+
+
+static const char *
 SVNActivitiesDB_cmd(cmd_parms *cmd, void *config, const char *arg1)
 {
   dir_conf_t *conf = config;
@@ -350,20 +368,6 @@ SVNAdvertiseV2Protocol_cmd(cmd_parms *cm
 
 
 static const char *
-SVNAdvertiseEphemeralTXNProps_cmd(cmd_parms *cmd, void *config, int arg)
-{
-  dir_conf_t *conf = config;
-
-  if (arg)
-    conf->ephemeral_txnprops = CONF_FLAG_ON;
-  else
-    conf->ephemeral_txnprops = CONF_FLAG_OFF;
-
-  return NULL;
-}
-
-
-static const char *
 SVNPathAuthz_cmd(cmd_parms *cmd, void *config, const char *arg1)
 {
   dir_conf_t *conf = config;
@@ -673,6 +677,16 @@ dav_svn__get_master_uri(request_rec *r)
 }
 
 
+svn_version_t *
+dav_svn__get_master_version(request_rec *r)
+{
+  dir_conf_t *conf;
+
+  conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+  return conf->master_uri ? conf->master_version : NULL;
+}
+
+
 const char *
 dav_svn__get_xslt_uri(request_rec *r)
 {
@@ -770,22 +784,39 @@ dav_svn__get_bulk_updates_flag(request_r
 
 
 svn_boolean_t
-dav_svn__get_v2_protocol_flag(request_rec *r)
+dav_svn__check_httpv2_support(request_rec *r)
 {
   dir_conf_t *conf;
+  svn_boolean_t available;
 
   conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
-  return conf->v2_protocol == CONF_FLAG_ON;
+  available = conf->v2_protocol == CONF_FLAG_ON;
+
+  /* If our configuration says that HTTPv2 is available, but we are
+     proxying requests to a master Subversion server which lacks
+     support for HTTPv2, we dumb ourselves down. */
+  if (available)
+    {
+      svn_version_t *version = dav_svn__get_master_version(r);
+      if (version && (! svn_version__at_least(version, 1, 7, 0)))
+        available = FALSE;
+    }
+  return available;
 }
 
 
 svn_boolean_t
-dav_svn__get_ephemeral_txnprops_flag(request_rec *r)
+dav_svn__check_ephemeral_txnprops_support(request_rec *r)
 {
-  dir_conf_t *conf;
+  svn_version_t *version = dav_svn__get_master_version(r);
 
-  conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
-  return conf->ephemeral_txnprops == CONF_FLAG_ON;
+  /* We know this server supports ephemeral txnprops.  But if we're
+     proxying requests to a master server, we need to see if it
+     supports them, too.  */
+  if (version && (! svn_version__at_least(version, 1, 8, 0)))
+    return FALSE;
+
+  return TRUE;
 }
 
 
@@ -1071,6 +1102,11 @@ static const command_rec cmds[] =
                 "specifies a URI to access a master Subversion repository"),
 
   /* per directory/location */
+  AP_INIT_TAKE1("SVNMasterVersion", SVNMasterVersion_cmd, NULL, ACCESS_CONF,
+                "specifies the Subversion release version of a master "
+                "Subversion server "),
+  
+  /* per directory/location */
   AP_INIT_TAKE1("SVNActivitiesDB", SVNActivitiesDB_cmd, NULL, ACCESS_CONF,
                 "specifies the location in the filesystem in which the "
                 "activities database(s) should be stored"),
@@ -1089,12 +1125,6 @@ static const command_rec cmds[] =
                "Subversion's HTTP protocol (default values is On)."),
 
   /* per directory/location */
-  AP_INIT_FLAG("SVNAdvertiseEphemeralTXNProps",
-               SVNAdvertiseEphemeralTXNProps_cmd, NULL, ACCESS_CONF|RSRC_CONF,
-               "enables server advertising of support for ephemeral "
-               "commit transaction properties (default value is On)."),
-
-  /* per directory/location */
   AP_INIT_FLAG("SVNCacheTextDeltas", SVNCacheTextDeltas_cmd, NULL,
                ACCESS_CONF|RSRC_CONF,
                "speeds up data access to older revisions by caching "

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/repos.c?rev=1398963&r1=1398962&r2=1398963&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/repos.c Tue Oct
16 20:01:34 2012
@@ -1502,7 +1502,7 @@ get_parentpath_resource(request_rec *r,
   repos->xslt_uri = dav_svn__get_xslt_uri(r);
   repos->autoversioning = dav_svn__get_autoversioning_flag(r);
   repos->bulk_updates = dav_svn__get_bulk_updates_flag(r);
-  repos->v2_protocol = dav_svn__get_v2_protocol_flag(r);
+  repos->v2_protocol = dav_svn__check_httpv2_support(r);
   repos->base_url = ap_construct_url(r->pool, "", r);
   repos->special_uri = dav_svn__get_special_uri(r);
   repos->username = r->user;
@@ -2082,7 +2082,7 @@ get_resource(request_rec *r,
   repos->bulk_updates = dav_svn__get_bulk_updates_flag(r);
 
   /* Are we advertising HTTP v2 protocol support? */
-  repos->v2_protocol = dav_svn__get_v2_protocol_flag(r);
+  repos->v2_protocol = dav_svn__check_httpv2_support(r);
 
   /* Path to activities database */
   repos->activities_db = dav_svn__get_activities_db(r);

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/version.c?rev=1398963&r1=1398962&r2=1398963&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/version.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/version.c Tue
Oct 16 20:01:34 2012
@@ -37,7 +37,9 @@
 #include "svn_props.h"
 #include "svn_dav.h"
 #include "svn_base64.h"
+#include "svn_version.h"
 #include "private/svn_repos_private.h"
+#include "private/svn_subr_private.h"
 #include "private/svn_dav_protocol.h"
 #include "private/svn_log.h"
 #include "private/svn_fspath.h"
@@ -196,7 +198,7 @@ get_option(const dav_resource *resource,
 
   /* If we're allowed (by configuration) to do so, advertise support
      for ephemeral transaction properties. */
-  if (dav_svn__get_ephemeral_txnprops_flag(r))
+  if (dav_svn__check_ephemeral_txnprops_support(r))
     {
       apr_table_addn(r->headers_out, "DAV",
                      SVN_DAV_NS_DAV_SVN_EPHEMERAL_TXNPROPS);
@@ -247,12 +249,15 @@ get_option(const dav_resource *resource,
       /* The list of Subversion's custom POSTs.  You'll want to keep
          this in sync with the handling of these suckers in
          handle_post_request().  */
-      static const char * posts_list[] = {
-        "create-txn",
-        "create-txn-with-props",
-        NULL
+      int i;
+      svn_version_t *master_version = dav_svn__get_master_version(r);
+      struct posts_versions_t {
+        const char *post_name;
+        svn_version_t min_version;
+      } posts_versions[] = {
+        { "create-txn",             { 1, 7, 0, "" } },
+        { "create-txn-with-props",  { 1, 8, 0, "" } },
       };
-      const char **this_post = posts_list;
 
       apr_table_set(r->headers_out, SVN_DAV_ROOT_URI_HEADER, repos_root_uri);
       apr_table_set(r->headers_out, SVN_DAV_ME_RESOURCE_HEADER,
@@ -278,12 +283,20 @@ get_option(const dav_resource *resource,
                                 dav_svn__get_vtxn_stub(r), (char *)NULL));
 
       /* Report the supported POST types. */
-      while (*this_post)
+      for (i = 0; i < sizeof(posts_versions)/sizeof(posts_versions[0]); ++i)
         {
+          /* If we're proxying to a master server and its version
+             number is declared, we can selectively filter out POST
+             types that it doesn't support. */
+          if (master_version
+              && (! svn_version__at_least(master_version,
+                                          posts_versions[i].min_version.major,
+                                          posts_versions[i].min_version.minor,
+                                          posts_versions[i].min_version.patch)))
+            continue;
+
           apr_table_addn(r->headers_out, SVN_DAV_SUPPORTED_POSTS_HEADER,
-                         apr_pstrcat(resource->pool, *this_post,
-                                     (char *)NULL));
-          this_post++;
+                         apr_pstrdup(resource->pool, posts_versions[i].post_name));
         }
     }
 



Mime
View raw message