You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2013/06/21 06:00:41 UTC
svn commit: r1495281 - in /subversion/branches/1.8.x: ./
subversion/libsvn_ra_serf/
Author: svn-role
Date: Fri Jun 21 04:00:41 2013
New Revision: 1495281
URL: http://svn.apache.org/r1495281
Log:
Merge r1495104 from trunk:
* r1495104
Handle unexpected HTTP status codes as errors instead of as SUCCESS codes
in ra_serf.
Justification:
Handling them as success values causes assertions.
Votes:
+1: rhuijben, ivan, philip
Modified:
subversion/branches/1.8.x/ (props changed)
subversion/branches/1.8.x/STATUS
subversion/branches/1.8.x/subversion/libsvn_ra_serf/blame.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/getdate.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocations.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocationsegments.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocks.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/inherited_props.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/log.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/mergeinfo.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/options.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/property.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h
subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/update.c
subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c
Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1495104
Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Fri Jun 21 04:00:41 2013
@@ -197,14 +197,6 @@ Veto-blocked changes:
Approved changes:
=================
- * r1495104
- Handle unexpected HTTP status codes as errors instead of as SUCCESS codes
- in ra_serf.
- Justification:
- Handling them as success values causes assertions.
- Votes:
- +1: rhuijben, ivan, philip
-
* r1493424
Remove unnecessary check for branches ancestry from
command line client. All required checks are already performed in
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/blame.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/blame.c Fri Jun 21 04:00:41 2013
@@ -366,7 +366,7 @@ svn_ra_serf__get_file_revs(svn_ra_sessio
err = svn_ra_serf__context_run_one(handler, pool);
err = svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location),
err);
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c Fri Jun 21 04:00:41 2013
@@ -223,7 +223,7 @@ return_response_err(svn_ra_serf__handler
/* Try to return one of the standard errors for 301, 404, etc.,
then look for an error embedded in the response. */
return svn_error_compose_create(svn_ra_serf__error_on_status(
- handler->sline.code,
+ handler->sline,
handler->path,
handler->location),
err);
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/getdate.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/getdate.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/getdate.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/getdate.c Fri Jun 21 04:00:41 2013
@@ -131,6 +131,7 @@ svn_ra_serf__get_dated_revision(svn_ra_s
svn_ra_serf__handler_t *handler;
svn_ra_serf__xml_context_t *xmlctx;
const char *report_target;
+ svn_error_t *err;
date_ctx = apr_palloc(pool, sizeof(*date_ctx));
date_ctx->time = tm;
@@ -155,7 +156,15 @@ svn_ra_serf__get_dated_revision(svn_ra_s
*date_ctx->revision = SVN_INVALID_REVNUM;
- /* ### use svn_ra_serf__error_on_status() ? */
+ err = svn_ra_serf__context_run_one(handler, pool);
- return svn_error_trace(svn_ra_serf__context_run_one(handler, pool));
+ SVN_ERR(svn_error_compose_create(
+ svn_ra_serf__error_on_status(handler->sline,
+ report_target,
+ handler->location),
+ err));
+
+ SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(*revision));
+
+ return SVN_NO_ERROR;
}
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocations.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocations.c Fri Jun 21 04:00:41 2013
@@ -192,7 +192,7 @@ svn_ra_serf__get_locations(svn_ra_sessio
err = svn_ra_serf__context_run_one(handler, pool);
SVN_ERR(svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
req_url,
handler->location),
err));
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocationsegments.c Fri Jun 21 04:00:41 2013
@@ -194,7 +194,7 @@ svn_ra_serf__get_location_segments(svn_r
err = svn_ra_serf__context_run_one(handler, pool);
err = svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location),
err);
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocks.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocks.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocks.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/getlocks.c Fri Jun 21 04:00:41 2013
@@ -266,7 +266,7 @@ svn_ra_serf__get_locks(svn_ra_session_t
have existed earlier (E.g. 'svn ls http://s/svn/trunk/file@1' */
if (handler->sline.code != 404)
{
- SVN_ERR(svn_ra_serf__error_on_status(handler->sline.code,
+ SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location));
}
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/inherited_props.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/inherited_props.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/inherited_props.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/inherited_props.c Fri Jun 21 04:00:41 2013
@@ -332,7 +332,7 @@ svn_ra_serf__get_inherited_props(svn_ra_
err = svn_ra_serf__context_run_one(handler, scratch_pool);
SVN_ERR(svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location),
err));
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/log.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/log.c Fri Jun 21 04:00:41 2013
@@ -595,7 +595,7 @@ svn_ra_serf__get_log(svn_ra_session_t *r
err = svn_ra_serf__context_run_one(handler, pool);
SVN_ERR(svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
req_url,
handler->location),
err));
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/mergeinfo.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/mergeinfo.c Fri Jun 21 04:00:41 2013
@@ -191,7 +191,7 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
svn_boolean_t include_descendants,
apr_pool_t *pool)
{
- svn_error_t *err, *err2;
+ svn_error_t *err;
mergeinfo_context_t *mergeinfo_ctx;
svn_ra_serf__session_t *session = ra_session->priv;
svn_ra_serf__handler_t *handler;
@@ -229,15 +229,10 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
err = svn_ra_serf__context_run_one(handler, pool);
- err2 = svn_ra_serf__error_on_status(handler->sline.code, handler->path,
- handler->location);
- if (err2)
- {
- svn_error_clear(err);
- return err2;
- }
-
- SVN_ERR(err);
+ SVN_ERR(svn_error_compose_create(
+ svn_ra_serf__error_on_status(handler->sline, handler->path,
+ handler->location),
+ err));
if (handler->done && apr_hash_count(mergeinfo_ctx->result_catalog))
*catalog = mergeinfo_ctx->result_catalog;
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/options.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/options.c Fri Jun 21 04:00:41 2013
@@ -436,11 +436,12 @@ svn_ra_serf__v2_get_youngest_revnum(svn_
SVN_ERR(create_options_req(&opt_ctx, session, conn, scratch_pool));
SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, scratch_pool));
- SVN_ERR(svn_ra_serf__error_on_status(opt_ctx->handler->sline.code,
+ SVN_ERR(svn_ra_serf__error_on_status(opt_ctx->handler->sline,
opt_ctx->handler->path,
opt_ctx->handler->location));
*youngest = opt_ctx->youngest_rev;
+ SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(*youngest));
return SVN_NO_ERROR;
}
@@ -460,7 +461,7 @@ svn_ra_serf__v1_get_activity_collection(
SVN_ERR(create_options_req(&opt_ctx, session, conn, scratch_pool));
SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, scratch_pool));
- SVN_ERR(svn_ra_serf__error_on_status(opt_ctx->handler->sline.code,
+ SVN_ERR(svn_ra_serf__error_on_status(opt_ctx->handler->sline,
opt_ctx->handler->path,
opt_ctx->handler->location));
@@ -499,7 +500,7 @@ svn_ra_serf__exchange_capabilities(svn_r
}
SVN_ERR(svn_error_compose_create(
- svn_ra_serf__error_on_status(opt_ctx->handler->sline.code,
+ svn_ra_serf__error_on_status(opt_ctx->handler->sline,
serf_sess->session_url.path,
opt_ctx->handler->location),
err));
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/property.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/property.c Fri Jun 21 04:00:41 2013
@@ -635,7 +635,7 @@ svn_ra_serf__wait_for_props(svn_ra_serf_
err = svn_ra_serf__context_run_one(handler, scratch_pool);
- err2 = svn_ra_serf__error_on_status(handler->sline.code,
+ err2 = svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location);
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h Fri Jun 21 04:00:41 2013
@@ -1744,7 +1744,7 @@ svn_ra_serf__credentials_callback(char *
* where it necessary.
*/
svn_error_t *
-svn_ra_serf__error_on_status(int status_code,
+svn_ra_serf__error_on_status(serf_status_line sline,
const char *path,
const char *location);
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c Fri Jun 21 04:00:41 2013
@@ -696,7 +696,7 @@ svn_ra_serf__replay(svn_ra_session_t *ra
err = svn_ra_serf__context_run_wait(&replay_ctx->done, session, pool);
SVN_ERR(svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location),
err));
@@ -905,7 +905,7 @@ svn_ra_serf__replay_range(svn_ra_session
svn_ra_serf__handler_t *done_handler = ctx->report_handler;
done_list = done_list->next;
- SVN_ERR(svn_ra_serf__error_on_status(done_handler->sline.code,
+ SVN_ERR(svn_ra_serf__error_on_status(done_handler->sline,
done_handler->path,
done_handler->location));
svn_pool_destroy(ctx->src_rev_pool);
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/update.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/update.c Fri Jun 21 04:00:41 2013
@@ -1268,7 +1268,7 @@ handle_stream(serf_request_t *request,
/* ### new field. make sure we didn't miss some initialization. */
SVN_ERR_ASSERT(fetch_ctx->handler != NULL);
- err = svn_ra_serf__error_on_status(fetch_ctx->handler->sline.code,
+ err = svn_ra_serf__error_on_status(fetch_ctx->handler->sline,
fetch_ctx->info->name,
fetch_ctx->handler->location);
if (err)
@@ -2891,7 +2891,7 @@ finish_report(void *report_baton,
{
return svn_error_trace(
svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location),
err));
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c?rev=1495281&r1=1495280&r2=1495281&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c Fri Jun 21 04:00:41 2013
@@ -2390,17 +2390,17 @@ svn_ra_serf__report_resource(const char
}
svn_error_t *
-svn_ra_serf__error_on_status(int status_code,
+svn_ra_serf__error_on_status(serf_status_line sline,
const char *path,
const char *location)
{
- switch(status_code)
+ switch(sline.code)
{
case 301:
case 302:
case 307:
return svn_error_createf(SVN_ERR_RA_DAV_RELOCATED, NULL,
- (status_code == 301)
+ (sline.code == 301)
? _("Repository moved permanently to '%s';"
" please relocate")
: _("Repository moved temporarily to '%s';"
@@ -2415,8 +2415,18 @@ svn_ra_serf__error_on_status(int status_
case 423:
return svn_error_createf(SVN_ERR_FS_NO_LOCK_TOKEN, NULL,
_("'%s': no lock token available"), path);
+
+ case 411:
+ return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+ _("DAV request failed: "
+ "Content length required"));
}
+ if (sline.code >= 300)
+ return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+ _("Unexpected HTTP status %d '%s' on '%s'\n"),
+ sline.code, sline.reason, path);
+
return SVN_NO_ERROR;
}