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 2013/02/07 16:52:24 UTC
svn commit: r1443578 - in /subversion/trunk/subversion/libsvn_ra_serf:
commit.c property.c util.c
Author: cmpilato
Date: Thu Feb 7 15:52:24 2013
New Revision: 1443578
URL: http://svn.apache.org/viewvc?rev=1443578&view=rev
Log:
Attempt to fix the fact that PROPFIND wasn't able to reveal a redirect
URL in its error messages and that the rest of ra_serf was throwing
away valuable URL information in such redirect responses, while still
preserving a workaround introduced in r1351138 for code.google.com's
semi-butchering of Location URLs.
* subversion/libsvn_ra_serf/util.c
(response_get_location): Return the canonicalized Location header,
in full, instead of only the path portion thereof.
* subversion/libsvn_ra_serf/property.c
(svn_ra_serf__wait_for_props): Pass handler->location to
svn_ra_serf__error_on_status(), since we have it handy and all.
* subversion/libsvn_ra_serf/commit.c
(checkout_node): Work around a bug in code.google.com's CHECKOUT
responses by using only the path portion of the Location header
when constructing working URLs here.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/commit.c
subversion/trunk/subversion/libsvn_ra_serf/property.c
subversion/trunk/subversion/libsvn_ra_serf/util.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/commit.c?rev=1443578&r1=1443577&r2=1443578&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/commit.c Thu Feb 7 15:52:24 2013
@@ -289,6 +289,8 @@ checkout_node(const char **working_url,
apr_pool_t *scratch_pool)
{
svn_ra_serf__handler_t handler = { 0 };
+ apr_status_t status;
+ apr_uri_t uri;
/* HANDLER_POOL is the scratch pool since we don't need to remember
anything from the handler. We just want the working resource. */
@@ -315,7 +317,17 @@ checkout_node(const char **working_url,
return svn_error_create(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
_("No Location header received"));
- *working_url = apr_pstrdup(result_pool, handler.location);
+ /* We only want the path portion of the Location header.
+ (code.google.com sometimes returns an 'http:' scheme for an
+ 'https:' transaction ... we'll work around that by stripping the
+ scheme, host, and port here and re-adding the correct ones
+ later. */
+ status = apr_uri_parse(scratch_pool, handler.location, &uri);
+ if (status)
+ return svn_error_create(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
+ _("Error parsing Location header value"));
+
+ *working_url = apr_pstrdup(result_pool, uri.path);
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/property.c?rev=1443578&r1=1443577&r2=1443578&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/property.c Thu Feb 7 15:52:24 2013
@@ -637,7 +637,7 @@ svn_ra_serf__wait_for_props(svn_ra_serf_
err2 = svn_ra_serf__error_on_status(handler->sline.code,
handler->path,
- NULL);
+ handler->location);
if (err2)
{
svn_error_clear(err);
Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1443578&r1=1443577&r2=1443578&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Thu Feb 7 15:52:24 2013
@@ -41,6 +41,7 @@
#include "svn_string.h"
#include "svn_xml.h"
#include "svn_props.h"
+#include "svn_dirent_uri.h"
#include "../libsvn_ra/ra_loader.h"
#include "private/svn_dep_compat.h"
@@ -994,20 +995,13 @@ response_get_location(serf_bucket_t *res
{
serf_bucket_t *headers;
const char *location;
- apr_status_t status;
- apr_uri_t uri;
headers = serf_bucket_response_get_headers(response);
location = serf_bucket_headers_get(headers, "Location");
if (location == NULL)
return NULL;
- /* Ignore the scheme/host/port. Or just return as-is if we can't parse. */
- status = apr_uri_parse(pool, location, &uri);
- if (!status)
- location = uri.path;
-
- return svn_urlpath__canonicalize(location, pool);
+ return svn_uri_canonicalize(location, pool);
}