aboutsummaryrefslogtreecommitdiffstats
path: root/subversion/libsvn_ra_serf/commit.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-04-29 19:16:59 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-04-29 19:16:59 +0000
commitc94cceea9c2262c5b2ad5f215bb9a8ae48b02764 (patch)
treedbb8174cbf6f1cc45b8de8031b18adb4030509a8 /subversion/libsvn_ra_serf/commit.c
parentdc5d469d6574e9fb03bdd793658bb371315b306a (diff)
downloadsrc-c94cceea9c2262c5b2ad5f215bb9a8ae48b02764.tar.gz
src-c94cceea9c2262c5b2ad5f215bb9a8ae48b02764.zip
Vendor import of subversion-1.9.4.vendor/subversion/subversion-1.9.4
Notes
Notes: svn path=/vendor/subversion/dist/; revision=298794 svn path=/vendor/subversion/subversion-1.9.4/; revision=298795; tag=vendor/subversion/subversion-1.9.4
Diffstat (limited to 'subversion/libsvn_ra_serf/commit.c')
-rw-r--r--subversion/libsvn_ra_serf/commit.c68
1 files changed, 65 insertions, 3 deletions
diff --git a/subversion/libsvn_ra_serf/commit.c b/subversion/libsvn_ra_serf/commit.c
index ec3bce945589..b1e81c7870e3 100644
--- a/subversion/libsvn_ra_serf/commit.c
+++ b/subversion/libsvn_ra_serf/commit.c
@@ -101,6 +101,8 @@ typedef struct delete_context_t {
svn_revnum_t revision;
commit_context_t *commit_ctx;
+
+ svn_boolean_t non_recursive_if; /* Only create a non-recursive If header */
} delete_context_t;
/* Represents a directory. */
@@ -841,6 +843,7 @@ proppatch_resource(svn_ra_serf__session_t *session,
handler->body_delegate = create_proppatch_body;
handler->body_delegate_baton = proppatch;
+ handler->body_type = "text/xml";
handler->response_handler = svn_ra_serf__handle_multistatus_only;
handler->response_baton = handler;
@@ -1101,8 +1104,15 @@ setup_delete_headers(serf_bucket_t *headers,
serf_bucket_headers_set(headers, SVN_DAV_VERSION_NAME_HEADER,
apr_ltoa(pool, del->revision));
- SVN_ERR(setup_if_header_recursive(&added, headers, del->commit_ctx,
- del->relpath, pool));
+ if (! del->non_recursive_if)
+ SVN_ERR(setup_if_header_recursive(&added, headers, del->commit_ctx,
+ del->relpath, pool));
+ else
+ {
+ SVN_ERR(maybe_set_lock_token_header(headers, del->commit_ctx,
+ del->relpath, pool));
+ added = TRUE;
+ }
if (added && del->commit_ctx->keep_locks)
serf_bucket_headers_setn(headers, SVN_DAV_OPTIONS_HEADER,
@@ -1402,6 +1412,28 @@ open_root(void *edit_baton,
return SVN_NO_ERROR;
}
+/* Implements svn_ra_serf__request_body_delegate_t */
+static svn_error_t *
+create_delete_body(serf_bucket_t **body_bkt,
+ void *baton,
+ serf_bucket_alloc_t *alloc,
+ apr_pool_t *pool /* request pool */,
+ apr_pool_t *scratch_pool)
+{
+ delete_context_t *ctx = baton;
+ serf_bucket_t *body;
+
+ body = serf_bucket_aggregate_create(alloc);
+
+ svn_ra_serf__add_xml_header_buckets(body, alloc);
+
+ svn_ra_serf__merge_lock_token_list(ctx->commit_ctx->lock_tokens,
+ ctx->relpath, body, alloc, pool);
+
+ *body_bkt = body;
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
delete_entry(const char *path,
svn_revnum_t revision,
@@ -1445,9 +1477,37 @@ delete_entry(const char *path,
handler->method = "DELETE";
handler->path = delete_target;
+ handler->no_fail_on_http_failure_status = TRUE;
SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
+ if (handler->sline.code == 400)
+ {
+ /* Try again with non-standard body to overcome Apache Httpd
+ header limit */
+ delete_ctx->non_recursive_if = TRUE;
+
+ handler = svn_ra_serf__create_handler(dir->commit_ctx->session, pool);
+
+ handler->response_handler = svn_ra_serf__expect_empty_body;
+ handler->response_baton = handler;
+
+ handler->header_delegate = setup_delete_headers;
+ handler->header_delegate_baton = delete_ctx;
+
+ handler->method = "DELETE";
+ handler->path = delete_target;
+
+ handler->body_type = "text/xml";
+ handler->body_delegate = create_delete_body;
+ handler->body_delegate_baton = delete_ctx;
+
+ SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
+ }
+
+ if (handler->server_error)
+ return svn_ra_serf__server_error_create(handler, pool);
+
/* 204 No Content: item successfully deleted */
if (handler->sline.code != 204)
return svn_error_trace(svn_ra_serf__unexpected_status(handler));
@@ -1539,7 +1599,9 @@ add_directory(const char *path,
handler->header_delegate = setup_copy_dir_headers;
handler->header_delegate_baton = dir;
}
-
+ /* We have the same problem as with DELETE here: if there are too many
+ locks, the request fails. But in this case there is no way to retry
+ with a non-standard request. #### How to fix? */
SVN_ERR(svn_ra_serf__context_run_one(handler, dir->pool));
if (handler->sline.code != 201)