You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/01/28 20:16:06 UTC
svn commit: r1655435 - in /subversion/trunk/subversion:
libsvn_ra_serf/options.c libsvn_ra_serf/ra_serf.h libsvn_ra_serf/util.c
tests/cmdline/redirect_tests.py
Author: rhuijben
Date: Wed Jan 28 19:16:05 2015
New Revision: 1655435
URL: http://svn.apache.org/r1655435
Log:
In ra_serf: Make the standard http status handling by default handle redirect
status value as an error, instead of as a success result. In most cases this
was already caught properly but the xml body parser already explicitly ignores
this status range (assuming they will result in an error)
* subversion/libsvn_ra_serf/options.c
(svn_ra_serf__exchange_capabilities): Set flag in handler to declare that we
are interested in specialized handling of redirects, when requested.
* subversion/libsvn_ra_serf/ra_serf.h
(svn_ra_serf__handler_t): Add no_fail_on_http_redirect_status flag. Update
documentation to note that we no longer 'fail directly' (as that breaks
pipelining).
* subversion/libsvn_ra_serf/util.c
(response_done): Handle http status 300-399 unless
no_fail_on_http_redirect_status is set.
* subversion/tests/cmdline/redirect_tests.py
(redirected_copy): Remove XFail marker.
Found by: philip
Modified:
subversion/trunk/subversion/libsvn_ra_serf/options.c
subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
subversion/trunk/subversion/libsvn_ra_serf/util.c
subversion/trunk/subversion/tests/cmdline/redirect_tests.py
Modified: subversion/trunk/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/options.c?rev=1655435&r1=1655434&r2=1655435&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/options.c Wed Jan 28 19:16:05 2015
@@ -511,6 +511,9 @@ svn_ra_serf__exchange_capabilities(svn_r
/* This routine automatically fills in serf_sess->capabilities */
SVN_ERR(create_options_req(&opt_ctx, serf_sess, scratch_pool));
+ if (corrected_url)
+ opt_ctx->handler->no_fail_on_http_redirect_status = TRUE;
+
SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, scratch_pool));
/* If our caller cares about server redirections, and our response
Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1655435&r1=1655434&r2=1655435&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Wed Jan 28 19:16:05 2015
@@ -431,10 +431,13 @@ typedef struct svn_ra_serf__handler_t {
for request. */
svn_boolean_t no_dav_headers;
- /* If TRUE doesn't end the context directly on certain HTTP errors like 405,
- 408, 500 (see util.c handle_response()) */
+ /* If TRUE doesn't fail requests on HTTP error statuses like 405, 408, 500
+ (see util.c response_done()) */
svn_boolean_t no_fail_on_http_failure_status;
+ /* If TRUE doesn't fail requests on HTTP redirect statuses like 301, 307 */
+ svn_boolean_t no_fail_on_http_redirect_status;
+
/* Has the request/response been completed? */
svn_boolean_t done;
svn_boolean_t scheduled; /* Is the request scheduled in a context */
Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1655435&r1=1655434&r2=1655435&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Wed Jan 28 19:16:05 2015
@@ -1860,6 +1860,12 @@ response_done(serf_request_t *request,
return svn_error_trace(svn_ra_serf__unexpected_status(handler));
}
+ if ((handler->sline.code >= 300 && handler->sline.code < 399)
+ && !handler->no_fail_on_http_redirect_status)
+ {
+ return svn_error_trace(svn_ra_serf__unexpected_status(handler));
+ }
+
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/tests/cmdline/redirect_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/redirect_tests.py?rev=1655435&r1=1655434&r2=1655435&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/redirect_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/redirect_tests.py Wed Jan 28 19:16:05 2015
@@ -206,7 +206,6 @@ def redirected_externals(sbox):
#----------------------------------------------------------------------
@SkipUnless(svntest.main.is_ra_type_dav)
-@XFail()
def redirected_copy(sbox):
"redirected copy"
Re: svn commit: r1655435 - in /subversion/trunk/subversion: libsvn_ra_serf/options.c libsvn_ra_serf/ra_serf.h libsvn_ra_serf/util.c tests/cmdline/redirect_tests.py
Posted by Philip Martin <ph...@wandisco.com>.
rhuijben@apache.org writes:
> --- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
> +++ subversion/trunk/subversion/libsvn_ra_serf/util.c Wed Jan 28 19:16:05 2015
> @@ -1860,6 +1860,12 @@ response_done(serf_request_t *request,
> return svn_error_trace(svn_ra_serf__unexpected_status(handler));
> }
>
> + if ((handler->sline.code >= 300 && handler->sline.code < 399)
> + && !handler->no_fail_on_http_redirect_status)
> + {
> + return svn_error_trace(svn_ra_serf__unexpected_status(handler));
> + }
> +
> return SVN_NO_ERROR;
> }
That ignores handler->session->pending_error while immediately above
this we have:
if ((handler->sline.code >= 400 || handler->sline.code <= 199)
&& !handler->session->pending_error
&& !handler->no_fail_on_http_failure_status)
{
return svn_error_trace(svn_ra_serf__unexpected_status(handler));
}
Why is the handling different?
--
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*