aboutsummaryrefslogtreecommitdiffstats
path: root/subversion/libsvn_ra_serf/replay.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2018-05-08 03:44:38 +0000
committerPeter Wemm <peter@FreeBSD.org>2018-05-08 03:44:38 +0000
commit3faf8d6bffc5d0fb2525ba37bb504c53366caf9d (patch)
tree7e47911263e75034b767fe34b2f8d3d17e91f66d /subversion/libsvn_ra_serf/replay.c
parenta55fb3c0d5eca7d887798125d5b95942b1f01d4b (diff)
downloadsrc-3faf8d6bffc5d0fb2525ba37bb504c53366caf9d.tar.gz
src-3faf8d6bffc5d0fb2525ba37bb504c53366caf9d.zip
Import Subversion-1.10.0vendor/subversion/subversion-1.10.0
Notes
Notes: svn path=/vendor/subversion/dist/; revision=333347 svn path=/vendor/subversion/subversion-1.10.0/; revision=333348; tag=vendor/subversion/subversion-1.10.0
Diffstat (limited to 'subversion/libsvn_ra_serf/replay.c')
-rw-r--r--subversion/libsvn_ra_serf/replay.c71
1 files changed, 61 insertions, 10 deletions
diff --git a/subversion/libsvn_ra_serf/replay.c b/subversion/libsvn_ra_serf/replay.c
index 8d2da69fa4eb..bb90ad4a8041 100644
--- a/subversion/libsvn_ra_serf/replay.c
+++ b/subversion/libsvn_ra_serf/replay.c
@@ -166,6 +166,8 @@ typedef struct revision_report_t {
svn_ra_serf__handler_t *propfind_handler;
svn_ra_serf__handler_t *report_handler; /* For done handler */
+ svn_ra_serf__session_t *session;
+
} revision_report_t;
/* Conforms to svn_ra_serf__xml_opened_t */
@@ -427,10 +429,11 @@ replay_closed(svn_ra_serf__xml_estate_t *xes,
{
struct replay_node_t *node = ctx->current_node;
- if (! node || ! node->file || ! node->stream)
+ if (! node || ! node->file)
return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL);
- SVN_ERR(svn_stream_close(node->stream));
+ if (node->stream)
+ SVN_ERR(svn_stream_close(node->stream));
node->stream = NULL;
}
@@ -565,10 +568,10 @@ svn_ra_serf__replay(svn_ra_session_t *ra_session,
SVN_ERR(svn_ra_serf__context_run_one(handler, scratch_pool));
- return svn_error_trace(
- svn_ra_serf__error_on_status(handler->sline,
- handler->path,
- handler->location));
+ if (handler->sline.code != 200)
+ SVN_ERR(svn_ra_serf__unexpected_status(handler));
+
+ return SVN_NO_ERROR;
}
/* The maximum number of outstanding requests at any time. When this
@@ -629,6 +632,20 @@ replay_done(serf_request_t *request,
return SVN_NO_ERROR;
}
+/* Implements svn_ra_serf__request_header_delegate_t */
+static svn_error_t *
+setup_headers(serf_bucket_t *headers,
+ void *baton,
+ apr_pool_t *request_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct revision_report_t *ctx = baton;
+
+ svn_ra_serf__setup_svndiff_accept_encoding(headers, ctx->session);
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
svn_revnum_t start_revision,
@@ -646,9 +663,28 @@ svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
int active_reports = 0;
const char *include_path;
svn_boolean_t done;
+ apr_pool_t *subpool = svn_pool_create(scratch_pool);
+
+ if (session->http20) {
+ /* ### Auch... this doesn't work yet...
+
+ This code relies on responses coming in in an exact order, while
+ http2 does everything to deliver responses as fast as possible.
+
+ With http/1.1 we were quite lucky that this worked, as serf doesn't
+ promise in order delivery.... (Please do not use authz with keys
+ that expire)
+
+ For now fall back to the legacy callback in libsvn_ra that is
+ used by all the other ra layers as workaround.
+
+ ### TODO: Optimize
+ */
+ return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL);
+ }
SVN_ERR(svn_ra_serf__report_resource(&report_target, session,
- scratch_pool));
+ subpool));
/* Prior to 1.8, mod_dav_svn expect to get replay REPORT requests
aimed at the session URL. But that's incorrect -- these reports
@@ -671,7 +707,7 @@ svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
{
SVN_ERR(svn_ra_serf__get_relative_path(&include_path,
session->session_url.path,
- session, scratch_pool));
+ session, subpool));
}
else
{
@@ -689,7 +725,7 @@ svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
{
struct revision_report_t *rev_ctx;
svn_ra_serf__handler_t *handler;
- apr_pool_t *rev_pool = svn_pool_create(scratch_pool);
+ apr_pool_t *rev_pool = svn_pool_create(subpool);
svn_ra_serf__xml_context_t *xmlctx;
const char *replay_target;
@@ -704,6 +740,7 @@ svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
rev_ctx->revision = rev;
rev_ctx->low_water_mark = low_water_mark;
rev_ctx->send_deltas = send_deltas;
+ rev_ctx->session = session;
/* Request all properties of a certain revision. */
rev_ctx->rev_props = apr_hash_make(rev_ctx->pool);
@@ -761,6 +798,10 @@ svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
handler->done_delegate = replay_done;
handler->done_delegate_baton = rev_ctx;
+ handler->custom_accept_encoding = TRUE;
+ handler->header_delegate = setup_headers;
+ handler->header_delegate_baton = rev_ctx;
+
rev_ctx->report_handler = handler;
svn_ra_serf__request_create(handler);
@@ -770,13 +811,23 @@ svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
/* Run the serf loop. */
done = FALSE;
- SVN_ERR(svn_ra_serf__context_run_wait(&done, session, scratch_pool));
+ {
+ svn_error_t *err = svn_ra_serf__context_run_wait(&done, session,
+ subpool);
+
+ if (err)
+ {
+ svn_pool_destroy(subpool); /* Unregister all requests! */
+ return svn_error_trace(err);
+ }
+ }
/* The done handler of reports decrements active_reports when a report
is done. This same handler reports (fatal) report errors, so we can
just loop here. */
}
+ svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
#undef MAX_OUTSTANDING_REQUESTS