You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2012/05/14 12:04:32 UTC
svn commit: r1338128 - in /subversion/trunk/subversion/libsvn_ra_serf:
commit.c options.c util.c
Author: gstein
Date: Mon May 14 10:04:32 2012
New Revision: 1338128
URL: http://svn.apache.org/viewvc?rev=1338128&view=rev
Log:
If the server sent an error embedded in the response body, then we
sometimes missed picking it up. That caused aborts on exit.
This adjusts run_one() to always pick up the error from the handler.
All users of the expect_empty_body handler, and the handler from
create_expat_handler() end up calling run_one(). Thus, the will always
grab any server_error that may have been found.
* subversion/libsvn_ra_serf/util.c:
(svn_ra_serf__context_run_one): compse any server_error into the
returned error.
* subversion/libsvn_ra_serf/commit.c:
(add_directory): no need to examine the server_error. already done.
* subversion/libsvn_ra_serf/options.c:
(create_options_req): don't create a request. it will be done by the
caller when they call run_one()
(svn_ra_serf__v2_get_youngest_revnum,
svn_ra_serf__v1_get_activity_collection,
svn_ra_serf__exchange_capabilities): switch to run_one() in
order to get any potential server error.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/commit.c
subversion/trunk/subversion/libsvn_ra_serf/options.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=1338128&r1=1338127&r2=1338128&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/commit.c Mon May 14 10:04:32 2012
@@ -1658,14 +1658,10 @@ add_directory(const char *path,
break;
case 403:
- if (handler->server_error)
- SVN_ERR(handler->server_error->error);
return svn_error_createf(SVN_ERR_RA_DAV_FORBIDDEN, NULL,
_("Access to '%s' forbidden"),
handler->path);
default:
- if (handler->server_error)
- SVN_ERR(handler->server_error->error);
return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
_("Adding directory failed: %s on %s "
"(%d %s)"),
Modified: subversion/trunk/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/options.c?rev=1338128&r1=1338127&r2=1338128&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/options.c Mon May 14 10:04:32 2012
@@ -340,8 +340,6 @@ create_options_req(options_context_t **o
handler->response_handler = options_response_handler;
handler->response_baton = new_ctx;
- svn_ra_serf__request_create(handler);
-
*opt_ctx = new_ctx;
return SVN_NO_ERROR;
@@ -359,8 +357,7 @@ svn_ra_serf__v2_get_youngest_revnum(svn_
SVN_ERR_ASSERT(SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(session));
SVN_ERR(create_options_req(&opt_ctx, session, conn, scratch_pool));
- SVN_ERR(svn_ra_serf__context_run_wait(&opt_ctx->handler->done, session,
- scratch_pool));
+ SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, scratch_pool));
*youngest = opt_ctx->youngest_rev;
@@ -380,8 +377,7 @@ svn_ra_serf__v1_get_activity_collection(
SVN_ERR_ASSERT(!SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(session));
SVN_ERR(create_options_req(&opt_ctx, session, conn, scratch_pool));
- SVN_ERR(svn_ra_serf__context_run_wait(&opt_ctx->handler->done, session,
- scratch_pool));
+ SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, scratch_pool));
*activity_url = apr_pstrdup(result_pool, opt_ctx->activity_collection);
@@ -404,8 +400,7 @@ svn_ra_serf__exchange_capabilities(svn_r
/* This routine automatically fills in serf_sess->capabilities */
SVN_ERR(create_options_req(&opt_ctx, serf_sess, serf_sess->conns[0], pool));
- err = svn_ra_serf__context_run_wait(&opt_ctx->handler->done, serf_sess,
- pool);
+ err = svn_ra_serf__context_run_one(opt_ctx->handler, pool);
/* If our caller cares about server redirections, and our response
carries such a thing, report as much. We'll disregard 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=1338128&r1=1338127&r2=1338128&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Mon May 14 10:04:32 2012
@@ -763,14 +763,21 @@ svn_error_t *
svn_ra_serf__context_run_one(svn_ra_serf__handler_t *handler,
apr_pool_t *scratch_pool)
{
+ svn_error_t *err;
+
/* Create a serf request based on HANDLER. */
svn_ra_serf__request_create(handler);
/* Wait until the response logic marks its DONE status. */
- return svn_error_trace(svn_ra_serf__context_run_wait(
- &handler->done,
- handler->session,
- scratch_pool));
+ err = svn_ra_serf__context_run_wait(&handler->done, handler->session,
+ scratch_pool);
+ if (handler->server_error)
+ {
+ err = svn_error_compose_create(err, handler->server_error->error);
+ handler->server_error = NULL;
+ }
+
+ return svn_error_trace(err);
}