subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r965856 - in /subversion/branches/issue-2779-dev/subversion: include/ libsvn_ra/ libsvn_ra_local/ libsvn_ra_neon/ libsvn_ra_serf/ libsvn_ra_svn/
Date Tue, 20 Jul 2010 14:14:58 GMT
Author: cmpilato
Date: Tue Jul 20 14:14:57 2010
New Revision: 965856

URL: http://svn.apache.org/viewvc?rev=965856&view=rev
Log:
On the 'issue-2779-dev' branch:
Re-work the RA approach to relocations by having RA->open() return
either a session object or a relocation URL, empowering the caller to
decide what to do.

* subversion/include/svn_ra.h
  (svn_ra_open4): Rename 'session_url' to 'corrected_url', and tweak
    the promise a bit.  Use a session subpool to manage the session
    lifetime in the event 

* subversion/libsvn_ra/ra_loader.h
  (svn_ra__vtable_t): Add 'corrected_url' return parameter to the
    open_session() vtable function.

* subversion/libsvn_ra/ra_loader.c
  (svn_ra_open4): Update call to the provider's open_session()
    function, and lose call to get_session_url().

* subversion/libsvn_ra/deprecated.c
  (svn_ra_open3): Update call to svn_ra_open4().

* subversion/libsvn_ra/wrapper_template.h
  (compat_open): Update call to the provider's open_session() function
    (using a session subpool to manage lifetimes more tightly), and
    bail on apparent relocations.

* subversion/libsvn_ra_local/ra_plugin.c
  (svn_ra_local__open): Add 'corrected_url' parameter, always set to NULL.

* subversion/libsvn_ra_svn/client.c
  (ra_svn_open): Add 'corrected_url' parameter, always set to NULL.

* subversion/libsvn_ra_serf/serf.c
  (svn_ra_serf__open): Add 'corrected_url' parameter, always set to NULL.

* subversion/libsvn_ra_neon/ra_neon.h
  (svn_ra_neon__exchange_capabilities): Add 'relocation_location' parameter.
  (svn_ra_neon__request_dispatch): Add 'okay_3' parameter.

* subversion/libsvn_ra_neon/util.c
  (svn_ra_neon__request_dispatch): Add 'okay_3' parameter and handling.
  (svn_ra_neon__simple_request): Update call to
    svn_ra_neon__request_dispatch().

* subversion/libsvn_ra_neon/session.c
  (svn_ra_neon__open): Update call svn_ra_neon__exchange_capabilities().

* subversion/libsvn_ra_neon/options.c
  (svn_ra_neon__exchange_capabilities): Add 'relocation_location' parameter.
  (svn_ra_neon__get_activity_collection, svn_ra_neon__has_capability):
    Update call to svn_ra_neon__exchange_capabilities().

* subversion/libsvn_ra_neon/commit.c
  (do_checkout, commit_delete_entry, commit_close_file): Update call
    to svn_ra_neon__request_dispatch(). 

* subversion/libsvn_ra_neon/lock.c
  (do_lock, svn_ra_neon__get_lock_internal): Update call to
    svn_ra_neon__request_dispatch().

* subversion/libsvn_ra_neon/fetch.c
  (custom_get_request): Update call to svn_ra_neon__request_dispatch().
  (svn_ra_neon__get_latest_revnum): Update call to
    svn_ra_neon__exchange_capabilities().

Modified:
    subversion/branches/issue-2779-dev/subversion/include/svn_ra.h
    subversion/branches/issue-2779-dev/subversion/libsvn_ra/deprecated.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.h
    subversion/branches/issue-2779-dev/subversion/libsvn_ra/wrapper_template.h
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_local/ra_plugin.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/commit.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/fetch.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/lock.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/options.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/ra_neon.h
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/session.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/util.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_serf/serf.c
    subversion/branches/issue-2779-dev/subversion/libsvn_ra_svn/client.c

Modified: subversion/branches/issue-2779-dev/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/include/svn_ra.h?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/include/svn_ra.h (original)
+++ subversion/branches/issue-2779-dev/subversion/include/svn_ra.h Tue Jul 20 14:14:57 2010
@@ -580,9 +580,13 @@ svn_ra_create_callbacks(svn_ra_callbacks
 typedef struct svn_ra_session_t svn_ra_session_t;
 
 /**
- * Open a repository session via @a repos_URL.  Set @a *session_p to
- * an opaque object representing this session, and set @a *session_url
- * to the final session URL used by the session, both allocated in @a pool.
+ * Set @a *session_p to an opaque object representing a
+ * repository session for the repository at @a repos_URL and @a
+ * *session_url to @c NULL; otherwise, set @a *session_p to @c NULL
+ * and @a *session_url to a corrected URL (perhaps as prescribed by
+ * the server) which the caller might wish to use when re-attempting
+ * the use of this interface.  In either case, allocated the returned
+ * item in @a pool.
  *
  * Return @c SVN_ERR_RA_UUID_MISMATCH if @a uuid is non-NULL and not equal
  * to the UUID of the repository at @c repos_URL.
@@ -603,7 +607,7 @@ typedef struct svn_ra_session_t svn_ra_s
  */
 svn_error_t *
 svn_ra_open4(svn_ra_session_t **session_p,
-             const char **session_url,
+             const char **corrected_url,
              const char *repos_URL,
              const char *uuid,
              const svn_ra_callbacks2_t *callbacks,
@@ -612,7 +616,7 @@ svn_ra_open4(svn_ra_session_t **session_
              apr_pool_t *pool);
 
 /** Similar to svn_ra_open4(), but return #SVN_ERR_RA_SESSION_URL_MISMATCH
- * if the session's negotiated URL doesn't match @a repos_URL.
+ * rather than the @a corrected_url.
  *
  * @since New in 1.5.
  * @deprecated Provided for backward compatibility with the 1.6 API.

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra/deprecated.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra/deprecated.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra/deprecated.c Tue Jul 20 14:14:57
2010
@@ -157,19 +157,15 @@ svn_error_t *svn_ra_open3(svn_ra_session
                           apr_hash_t *config,
                           apr_pool_t *pool)
 {
-  apr_pool_t *sesspool = svn_pool_create(pool);
-  const char *session_url;
+  const char *corrected_url;
+
+  SVN_ERR(svn_ra_open4(session_p, &corrected_url, repos_URL, NULL,
+                       callbacks, callback_baton, config, pool));
+  if (corrected_url)
+    return svn_error_createf(SVN_ERR_RA_SESSION_URL_MISMATCH, NULL,
+                             _("The repository has been moved to '%s'; "
+                               "consider relocating."), corrected_url);
 
-  SVN_ERR(svn_ra_open4(session_p, &session_url, repos_URL, NULL,
-                       callbacks, callback_baton, config, sesspool));
-  if (strcmp(repos_URL, session_url) != 0)
-    {
-      svn_pool_destroy(sesspool);
-      return svn_error_createf(SVN_ERR_RA_SESSION_URL_MISMATCH, NULL,
-                               _("Session URL '%s' does not match requested "
-                                 " URL '%s', and redirection was disallowed."),
-                               session_url, repos_URL);
-    }
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.c Tue Jul 20 14:14:57
2010
@@ -269,7 +269,7 @@ svn_ra_create_callbacks(svn_ra_callbacks
 }
 
 svn_error_t *svn_ra_open4(svn_ra_session_t **session_p,
-                          const char **session_url,
+                          const char **corrected_url,
                           const char *repos_URL,
                           const char *uuid,
                           const svn_ra_callbacks2_t *callbacks,
@@ -277,6 +277,7 @@ svn_error_t *svn_ra_open4(svn_ra_session
                           apr_hash_t *config,
                           apr_pool_t *pool)
 {
+  apr_pool_t *sesspool = svn_pool_create(pool);
   svn_ra_session_t *session;
   const struct ra_lib_defn *defn;
   const svn_ra__vtable_t *vtable = NULL;
@@ -295,6 +296,9 @@ svn_error_t *svn_ra_open4(svn_ra_session
   svn_boolean_t store_pp = SVN_CONFIG_DEFAULT_OPTION_STORE_SSL_CLIENT_CERT_PP;
   const char *store_pp_plaintext
     = SVN_CONFIG_DEFAULT_OPTION_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT;
+  
+  /* Initialize the return variable. */
+  *session_p = NULL;
 
   if (callbacks->auth_baton)
     {
@@ -358,7 +362,7 @@ svn_error_t *svn_ra_open4(svn_ra_session
 
           /* Find out where we're about to connect to, and
            * try to pick a server group based on the destination. */
-          apr_err = apr_uri_parse(pool, repos_URL, &repos_URI);
+          apr_err = apr_uri_parse(sesspool, repos_URL, &repos_URI);
           /* ### Should apr_uri_parse leave hostname NULL?  It doesn't
            * for "file:///" URLs, only for bogus URLs like "bogus".
            * If this is the right behavior for apr_uri_parse, maybe we
@@ -368,7 +372,8 @@ svn_error_t *svn_ra_open4(svn_ra_session
                                      _("Illegal repository URL '%s'"),
                                      repos_URL);
           server_group = svn_config_find_group(servers, repos_URI.hostname,
-                                               SVN_CONFIG_SECTION_GROUPS, pool);
+                                               SVN_CONFIG_SECTION_GROUPS,
+                                               sesspool);
 
           if (server_group)
             {
@@ -459,12 +464,12 @@ svn_error_t *svn_ra_open4(svn_ra_session
 
           if (! initfunc)
             SVN_ERR(load_ra_module(&initfunc, NULL, defn->ra_name,
-                                   pool));
+                                   sesspool));
           if (! initfunc)
             /* Library not found. */
             continue;
 
-          SVN_ERR(initfunc(svn_ra_version(), &vtable, pool));
+          SVN_ERR(initfunc(svn_ra_version(), &vtable, sesspool));
 
           SVN_ERR(check_ra_version(vtable->get_version(), scheme));
 
@@ -478,28 +483,36 @@ svn_error_t *svn_ra_open4(svn_ra_session
                              repos_URL);
 
   /* Create the session object. */
-  session = apr_pcalloc(pool, sizeof(*session));
+  session = apr_pcalloc(sesspool, sizeof(*session));
   session->vtable = vtable;
-  session->pool = pool;
+  session->pool = sesspool;
 
   /* Ask the library to open the session. */
-  SVN_ERR_W(vtable->open_session(session, repos_URL, callbacks, callback_baton,
-                                 config, pool),
+  SVN_ERR_W(vtable->open_session(session, corrected_url, repos_URL,
+                                 callbacks, callback_baton, config, sesspool),
             apr_psprintf(pool, "Unable to connect to a repository at URL '%s'",
                          repos_URL));
-
-  /* Fetch the session URL. */
-  SVN_ERR(vtable->get_session_url(session, session_url, pool));
-
+  
+  /* If the session open stuff detected a server-provided URL
+     correction (a 301 or 302 redirect response during the initial
+     OPTIONS request), then kill the session so the caller can decide
+     what to do. */
+  if (*corrected_url)
+    {
+      *corrected_url = apr_pstrdup(pool, *corrected_url);
+      svn_pool_destroy(sesspool);
+      return SVN_NO_ERROR;
+    }
+  
   /* Check the UUID. */
   if (uuid)
     {
       const char *repository_uuid;
 
       SVN_ERR(vtable->get_uuid(session, &repository_uuid, pool));
-
       if (strcmp(uuid, repository_uuid) != 0)
         {
+          svn_pool_destroy(sesspool);
           return svn_error_createf(SVN_ERR_RA_UUID_MISMATCH, NULL,
                                    _("Repository UUID '%s' doesn't match "
                                      "expected UUID '%s'"),

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.h?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra/ra_loader.h Tue Jul 20 14:14:57
2010
@@ -54,6 +54,7 @@ typedef struct svn_ra__vtable_t {
   /* All fields in SESSION, except priv, have been initialized by the
      time this is called.  SESSION->priv may be set by this function. */
   svn_error_t *(*open_session)(svn_ra_session_t *session,
+                               const char **corrected_url,
                                const char *repos_URL,
                                const svn_ra_callbacks2_t *callbacks,
                                void *callback_baton,

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra/wrapper_template.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra/wrapper_template.h?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra/wrapper_template.h (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra/wrapper_template.h Tue Jul 20
14:14:57 2010
@@ -71,12 +71,15 @@ static svn_error_t *compat_open(void **s
    * the alternative (creating a new ra_util library) would be massive
    * overkill for the time being.  Just be sure to keep the following
    * line and the code of svn_ra_create_callbacks in sync.  */
-  svn_ra_callbacks2_t *callbacks2 = apr_pcalloc(pool,
+  apr_pool_t *sesspool = svn_pool_create(pool);
+  svn_ra_callbacks2_t *callbacks2 = apr_pcalloc(sesspool,
                                                 sizeof(*callbacks2));
 
-  svn_ra_session_t *sess = apr_pcalloc(pool, sizeof(*sess));
+  svn_ra_session_t *sess = apr_pcalloc(sesspool, sizeof(*sess));
+  const char *session_url;
+
   sess->vtable = &VTBL;
-  sess->pool = pool;
+  sess->pool = sesspool;
 
   callbacks2->open_tmp_file = callbacks->open_tmp_file;
   callbacks2->auth_baton = callbacks->auth_baton;
@@ -87,8 +90,18 @@ static svn_error_t *compat_open(void **s
   callbacks2->progress_func = NULL;
   callbacks2->progress_baton = NULL;
 
-  SVN_ERR(VTBL.open_session(sess, repos_URL, callbacks2, callback_baton,
-                            config, pool));
+  SVN_ERR(VTBL.open_session(sess, &session_url, repos_URL,
+                            callbacks2, callback_baton, config, sesspool));
+
+  if (strcmp(repos_URL, session_url) != 0)
+    {
+      svn_pool_destroy(sesspool);
+      return svn_error_createf(SVN_ERR_RA_SESSION_URL_MISMATCH, NULL,
+                               _("Session URL '%s' does not match requested "
+                                 " URL '%s', and redirection was disallowed."),
+                               session_url, repos_URL);
+    }
+
   *session_baton = sess;
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_local/ra_plugin.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_local/ra_plugin.c Tue Jul 20 14:14:57
2010
@@ -435,6 +435,7 @@ ignore_warnings(void *baton,
 
 static svn_error_t *
 svn_ra_local__open(svn_ra_session_t *session,
+                   const char **corrected_url,
                    const char *repos_URL,
                    const svn_ra_callbacks2_t *callbacks,
                    void *callback_baton,
@@ -444,6 +445,9 @@ svn_ra_local__open(svn_ra_session_t *ses
   svn_ra_local__session_baton_t *sess;
   const char *fs_path;
 
+  /* We don't support redirections in ra-local. */
+  *corrected_url = NULL;
+
   /* Allocate and stash the session_sess args we have already. */
   sess = apr_pcalloc(pool, sizeof(*sess));
   sess->callbacks = callbacks;

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/commit.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/commit.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/commit.c Tue Jul 20 14:14:57
2010
@@ -440,6 +440,7 @@ static svn_error_t * do_checkout(commit_
   err = svn_ra_neon__request_dispatch(code, request, extra_headers, body,
                                       201 /* Created */,
                                       allow_404 ? 404 /* Not Found */ : 0,
+                                      0,
                                       pool);
   if (err)
     goto cleanup;
@@ -823,6 +824,7 @@ static svn_error_t * commit_delete_entry
       err = svn_ra_neon__request_dispatch(&code, request, NULL, body,
                                           204 /* Created */,
                                           404 /* Not Found */,
+                                          0,
                                           pool);
     cleanup:
       svn_ra_neon__request_destroy(request);
@@ -1316,6 +1318,7 @@ static svn_error_t * commit_close_file(v
       err = svn_ra_neon__request_dispatch(NULL, request, extra_headers, NULL,
                                           201 /* Created */,
                                           204 /* No Content */,
+                                          0,
                                           pool);
     cleanup:
       svn_ra_neon__request_destroy(request);

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/fetch.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/fetch.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/fetch.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/fetch.c Tue Jul 20 14:14:57
2010
@@ -420,6 +420,7 @@ static svn_error_t *custom_get_request(s
   err = svn_ra_neon__request_dispatch(NULL, request, NULL, NULL,
                                       200 /* OK */,
                                       226 /* IM Used */,
+                                      0,
                                       pool);
   svn_ra_neon__request_destroy(request);
 
@@ -1097,7 +1098,8 @@ svn_error_t *svn_ra_neon__get_latest_rev
      PROPFINDs. */
   if (SVN_RA_NEON__HAVE_HTTPV2_SUPPORT(ras))
     {
-      SVN_ERR(svn_ra_neon__exchange_capabilities(ras, latest_revnum, pool));
+      SVN_ERR(svn_ra_neon__exchange_capabilities(ras, NULL, 
+                                                 latest_revnum, pool));
       if (! SVN_IS_VALID_REVNUM(*latest_revnum))
         return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
                                 _("The OPTIONS response did not include "

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/lock.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/lock.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/lock.c Tue Jul 20 14:14:57
2010
@@ -296,7 +296,7 @@ do_lock(svn_lock_t **lock,
                             apr_psprintf(req->pool, "%ld", current_rev));
 
   err = svn_ra_neon__request_dispatch(&code, req, extra_headers, body->data,
-                                      200, 0, pool);
+                                      200, 0, 0, pool);
   if (err)
     goto cleanup;
 
@@ -545,7 +545,7 @@ svn_ra_neon__get_lock_internal(svn_ra_ne
                           "text/xml; charset=\"utf-8\"");
 
   err = svn_ra_neon__request_dispatch(NULL, req, extra_headers, body,
-                                      200, 207, pool);
+                                      200, 207, 0, pool);
   if (err)
     {
       err = svn_error_quick_wrap(err, _("Failed to fetch lock information"));

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/options.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/options.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/options.c Tue Jul 20 14:14:57
2010
@@ -249,6 +249,7 @@ parse_capabilities(ne_request *req,
 
 svn_error_t *
 svn_ra_neon__exchange_capabilities(svn_ra_neon__session_t *ras,
+                                   const char **relocation_location,
                                    svn_revnum_t *youngest_rev,
                                    apr_pool_t *pool)
 {
@@ -262,6 +263,8 @@ svn_ra_neon__exchange_capabilities(svn_r
   oc.cdata = svn_stringbuf_create("", pool);
 
   *youngest_rev = SVN_INVALID_REVNUM;
+  if (relocation_location)
+    *relocation_location = NULL;
 
   req = svn_ra_neon__request_create(ras, "OPTIONS", ras->url->data, pool);
 
@@ -280,9 +283,18 @@ svn_ra_neon__exchange_capabilities(svn_r
                                            "<D:options xmlns:D=\"DAV:\">"
                                            "<D:activity-collection-set/>"
                                            "</D:options>",
-                                           200, 0, pool)))
+                                           200,
+                                           relocation_location ? 301 : 0,
+                                           relocation_location ? 302 : 0,
+                                           pool)))
     goto cleanup;
 
+  if ((req->code == 301) || (req->code == 302))
+    {
+      *relocation_location = svn_ra_neon__request_get_location(req, pool);
+      goto cleanup;
+    }
+
   /* Was there an XML parse error somewhere? */
   err = svn_ra_neon__check_parse_error("OPTIONS", parser, ras->url->data);
   if (err)
@@ -316,7 +328,8 @@ svn_ra_neon__get_activity_collection(con
 {
   svn_revnum_t ignored_revnum;
   if (! ras->act_coll)
-    SVN_ERR(svn_ra_neon__exchange_capabilities(ras, &ignored_revnum, pool));
+    SVN_ERR(svn_ra_neon__exchange_capabilities(ras, NULL, 
+                                               &ignored_revnum, pool));
   *activity_coll = svn_string_create(ras->act_coll, pool);
   return SVN_NO_ERROR;
 }
@@ -346,7 +359,8 @@ svn_ra_neon__has_capability(svn_ra_sessi
   if (cap_result == NULL)
     {
       svn_revnum_t ignored_revnum;
-      SVN_ERR(svn_ra_neon__exchange_capabilities(ras, &ignored_revnum, pool));
+      SVN_ERR(svn_ra_neon__exchange_capabilities(ras, NULL,
+                                                 &ignored_revnum, pool));
     }
 
 

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/ra_neon.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/ra_neon.h?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/ra_neon.h (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/ra_neon.h Tue Jul 20 14:14:57
2010
@@ -942,12 +942,10 @@ svn_ra_neon__maybe_store_auth_info_after
    NULL, as this will cause Neon to generate a "Content-Length: 0"
    header (which is important to some proxies).
 
-   OKAY_1 and OKAY_2 are the "acceptable" result codes. Anything other
-   than one of these will generate an error. OKAY_1 should always be
-   specified (e.g. as 200); use 0 for OKAY_2 if a second result code is
-   not allowed.
-
- */
+   OKAY_1, OKAY_2, and OKAY_3 are the "acceptable" result codes.
+   Anything other than one of these will generate an error. OKAY_1
+   should always be specified (e.g. as 200); use 0 for OKAY_2 and/or
+   OKAY_3 if additional result codes aren't allowed.  */
 svn_error_t *
 svn_ra_neon__request_dispatch(int *code_p,
                               svn_ra_neon__request_t *request,
@@ -955,6 +953,7 @@ svn_ra_neon__request_dispatch(int *code_
                               const char *body,
                               int okay_1,
                               int okay_2,
+                              int okay_3,
                               apr_pool_t *pool);
 
 /* A layer over SVN_RA_NEON__REQUEST_DISPATCH() adding a
@@ -1106,14 +1105,22 @@ svn_ra_neon__has_capability(svn_ra_sessi
    RAS->capabilities with the server's capabilities as read from the
    response headers.  Use POOL only for temporary allocation.
 
+   If the RELOCATION_LOCATION is non-NULL, allow the OPTIONS response
+   to report a server-dictated redirect or relocation (HTTP 301 or 302
+   error codes), setting *RELOCATION_LOCATION to the value of the
+   corrected repository URL.  Otherwise, such responses from the
+   server will generate an error.  (In either case, no capabilities are
+   exchanged if there is, in fact, such a response from the server.)
+
    If the server is kind enough to tell us the current youngest
    revision of the target repository, set *YOUNGEST_REV to that value;
    set it to SVN_INVALID_REVNUM otherwise.
 
-  NOTE:  This function also expects the server to announce the
+   NOTE:  This function also expects the server to announce the
    activity collection.  */
 svn_error_t *
 svn_ra_neon__exchange_capabilities(svn_ra_neon__session_t *ras,
+                                   const char **relocation_location,
                                    svn_revnum_t *youngest_rev,
                                    apr_pool_t *pool);
 

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/session.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/session.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/session.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/session.c Tue Jul 20 14:14:57
2010
@@ -771,6 +771,7 @@ ensure_neon_initialized(void)
 
 static svn_error_t *
 svn_ra_neon__open(svn_ra_session_t *session,
+                  const char **corrected_url,
                   const char *repos_URL,
                   const svn_ra_callbacks2_t *callbacks,
                   void *callback_baton,
@@ -1072,7 +1073,8 @@ svn_ra_neon__open(svn_ra_session_t *sess
 
   session->priv = ras;
 
-  return svn_ra_neon__exchange_capabilities(ras, &ignored_revnum, pool);
+  return svn_ra_neon__exchange_capabilities(ras, corrected_url,
+                                            &ignored_revnum, pool);
 }
 
 

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/util.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/util.c Tue Jul 20 14:14:57
2010
@@ -1264,6 +1264,7 @@ parsed_request(svn_ra_neon__request_t *r
                                         (strcmp(method, "PROPFIND") == 0)
                                         ? 207 : 200,
                                         0, /* not used */
+                                        0, /* not used */
                                         pool));
 
   if (spool_response)
@@ -1343,7 +1344,7 @@ svn_ra_neon__simple_request(int *code,
      reader.  Neon will take care of the Content-Length calculation */
   err = svn_ra_neon__request_dispatch(code, req, extra_headers,
                                       body ? body : "",
-                                      okay_1, okay_2, pool);
+                                      okay_1, okay_2, 0, pool);
   svn_ra_neon__request_destroy(req);
 
   return err;
@@ -1429,6 +1430,7 @@ svn_ra_neon__request_dispatch(int *code_
                               const char *body,
                               int okay_1,
                               int okay_2,
+                              int okay_3,
                               apr_pool_t *pool)
 {
   ne_xml_parser *error_parser;
@@ -1491,7 +1493,9 @@ svn_ra_neon__request_dispatch(int *code_
 
   /* If the status code was one of the two that we expected, then go
      ahead and return now. IGNORE any marshalled error. */
-  if (req->rv == NE_OK && (req->code == okay_1 || req->code == okay_2))
+  if (req->rv == NE_OK && (req->code == okay_1
+                           || req->code == okay_2
+                           || req->code == okay_3))
     return SVN_NO_ERROR;
 
   /* Any other errors? Report them */

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_serf/serf.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_serf/serf.c Tue Jul 20 14:14:57
2010
@@ -331,6 +331,7 @@ svn_ra_serf__progress(void *progress_bat
 
 static svn_error_t *
 svn_ra_serf__open(svn_ra_session_t *session,
+                  const char **corrected_url,
                   const char *repos_URL,
                   const svn_ra_callbacks2_t *callbacks,
                   void *callback_baton,
@@ -342,6 +343,9 @@ svn_ra_serf__open(svn_ra_session_t *sess
   apr_uri_t url;
   const char *client_string = NULL;
 
+  /* We don't support server-prescribed redirections yet. */
+  *corrected_url = NULL;
+
   serf_sess = apr_pcalloc(pool, sizeof(*serf_sess));
   serf_sess->pool = svn_pool_create(pool);
   serf_sess->bkt_alloc = serf_bucket_allocator_create(serf_sess->pool, NULL,

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_ra_svn/client.c?rev=965856&r1=965855&r2=965856&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_svn/client.c Tue Jul 20 14:14:57
2010
@@ -685,7 +685,9 @@ ra_svn_get_schemes(apr_pool_t *pool)
 
 
 
-static svn_error_t *ra_svn_open(svn_ra_session_t *session, const char *url,
+static svn_error_t *ra_svn_open(svn_ra_session_t *session,
+                                const char **corrected_url,
+                                const char *url,
                                 const svn_ra_callbacks2_t *callbacks,
                                 void *callback_baton,
                                 apr_hash_t *config,
@@ -697,6 +699,9 @@ static svn_error_t *ra_svn_open(svn_ra_s
   apr_uri_t uri;
   svn_config_t *cfg, *cfg_client;
 
+  /* We don't support server-prescribed redirections in ra-svn. */
+  *corrected_url = NULL;
+
   SVN_ERR(parse_url(url, &uri, sess_pool));
 
   parse_tunnel(url, &tunnel, pool);



Mime
View raw message