diff options
author | Peter Wemm <peter@FreeBSD.org> | 2013-07-28 05:04:41 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 2013-07-28 05:04:41 +0000 |
commit | 97551b2898eb459e9b616947d87d026d27b61518 (patch) | |
tree | a851d66ec0c51a7321b30a677a0e55f1655af4d6 /subversion/libsvn_ra_serf/options.c | |
parent | fec88c40a7bace625f49c3234a71560a161ee0ef (diff) | |
download | src-97551b2898eb459e9b616947d87d026d27b61518.tar.gz src-97551b2898eb459e9b616947d87d026d27b61518.zip |
Import subversion-1.8.1 into vendor staging area.vendor/subversion/subversion-1.8.1
Notes
Notes:
svn path=/vendor/subversion/dist/; revision=253728
svn path=/vendor/subversion/subversion-1.8.1/; revision=253729; tag=vendor/subversion/subversion-1.8.1
Diffstat (limited to 'subversion/libsvn_ra_serf/options.c')
-rw-r--r-- | subversion/libsvn_ra_serf/options.c | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/subversion/libsvn_ra_serf/options.c b/subversion/libsvn_ra_serf/options.c index 0af0b1599c6d..a3c2fb95c881 100644 --- a/subversion/libsvn_ra_serf/options.c +++ b/subversion/libsvn_ra_serf/options.c @@ -362,6 +362,8 @@ options_response_handler(serf_request_t *request, capability_no); svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_EPHEMERAL_TXNPROPS, capability_no); + svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_GET_FILE_REVS_REVERSE, + capability_no); /* Then see which ones we can discover. */ serf_bucket_headers_do(hdrs, capabilities_headers_iterator_callback, @@ -436,11 +438,12 @@ svn_ra_serf__v2_get_youngest_revnum(svn_revnum_t *youngest, 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 +463,7 @@ svn_ra_serf__v1_get_activity_collection(const char **activity_url, 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 +502,7 @@ svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess, } 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)); @@ -517,6 +520,65 @@ svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess, } +static svn_error_t * +create_simple_options_body(serf_bucket_t **body_bkt, + void *baton, + serf_bucket_alloc_t *alloc, + apr_pool_t *pool) +{ + serf_bucket_t *body; + serf_bucket_t *s; + + body = serf_bucket_aggregate_create(alloc); + svn_ra_serf__add_xml_header_buckets(body, alloc); + + s = SERF_BUCKET_SIMPLE_STRING("<D:options xmlns:D=\"DAV:\" />", alloc); + serf_bucket_aggregate_append(body, s); + + *body_bkt = body; + return SVN_NO_ERROR; +} + + +svn_error_t * +svn_ra_serf__probe_proxy(svn_ra_serf__session_t *serf_sess, + apr_pool_t *scratch_pool) +{ + svn_ra_serf__handler_t *handler; + + handler = apr_pcalloc(scratch_pool, sizeof(*handler)); + handler->handler_pool = scratch_pool; + handler->method = "OPTIONS"; + handler->path = serf_sess->session_url.path; + handler->conn = serf_sess->conns[0]; + handler->session = serf_sess; + + /* We don't care about the response body, so discard it. */ + handler->response_handler = svn_ra_serf__handle_discard_body; + + /* We need a simple body, in order to send it in chunked format. */ + handler->body_delegate = create_simple_options_body; + + /* No special headers. */ + + SVN_ERR(svn_ra_serf__context_run_one(handler, scratch_pool)); + /* Some versions of nginx in reverse proxy mode will return 411. They want + a Content-Length header, rather than chunked requests. We can keep other + HTTP/1.1 features, but will disable the chunking. */ + if (handler->sline.code == 411) + { + serf_sess->using_chunked_requests = FALSE; + + return SVN_NO_ERROR; + } + SVN_ERR(svn_ra_serf__error_on_status(handler->sline, + handler->path, + handler->location)); + + return SVN_NO_ERROR; +} + + svn_error_t * svn_ra_serf__has_capability(svn_ra_session_t *ra_session, svn_boolean_t *has, |