summaryrefslogtreecommitdiffstats
path: root/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-05-14 10:18:27 +0000
committerdim <dim@FreeBSD.org>2016-05-14 10:18:27 +0000
commitc0fce3206c07db73705b223c4cb4ef41d586fbb7 (patch)
treec7c6791fdb0ac3703a154f91c073e2d194dac0f9 /contrib/subversion/subversion/libsvn_ra_serf/getlocks.c
parente2e2d0eaebaad89d0ef90f345309428d02e0c8ab (diff)
downloadFreeBSD-src-c0fce3206c07db73705b223c4cb4ef41d586fbb7.zip
FreeBSD-src-c0fce3206c07db73705b223c4cb4ef41d586fbb7.tar.gz
MFC r275385 (by bapt):
Sync the svn template with the one from ports MFC r289180 (by peter): Update from svn-1.8.14 to 1.9.2. Formal release notes are available: https://subversion.apache.org/docs/release-notes/1.9.html Of particular note, the client checkout format has *not* changed so upgrades should *not* be required. When reading a repository (file:// or running as a local server), an improved fsfs version 7 is available with significant performance improvements. An optional upgrade is possible to use the new features. Without the upgrade, this is fully read/write compatible with the version 6 fsfs as in svn-1.8. MFC r298845: Update from subversion 1.9.2 to 1.9.4. This contains only bug fixes, no new features. The repository format is also unchanged from 1.9.2. Full list of changes between 1.9.4 and earlier versions: https://svn.apache.org/repos/asf/subversion/tags/1.9.4/CHANGES Note that the two security issues fixed in 1.9.4 (CVE-2016-2167 and CVE-2016-2168) do not affect the version of Subversion in the FreeBSD base system, since neither SASL nor Apache modules are enabled. MFC r298996: Re-sync the FreeBSD-specific Subversion template with the one from ports. Relnotes: yes
Diffstat (limited to 'contrib/subversion/subversion/libsvn_ra_serf/getlocks.c')
-rw-r--r--contrib/subversion/subversion/libsvn_ra_serf/getlocks.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c b/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c
index df201a7..518d2aa 100644
--- a/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c
+++ b/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c
@@ -47,8 +47,8 @@
/*
* This enum represents the current state of our XML parsing for a REPORT.
*/
-enum {
- INITIAL = 0,
+enum getlocks_state_e {
+ INITIAL = XML_STATE_INITIAL,
REPORT,
LOCK,
PATH,
@@ -213,7 +213,8 @@ static svn_error_t *
create_getlocks_body(serf_bucket_t **body_bkt,
void *baton,
serf_bucket_alloc_t *alloc,
- apr_pool_t *pool)
+ apr_pool_t *pool /* request pool */,
+ apr_pool_t *scratch_pool)
{
lock_context_t *lock_ctx = baton;
serf_bucket_t *buckets;
@@ -222,7 +223,7 @@ create_getlocks_body(serf_bucket_t **body_bkt,
svn_ra_serf__add_open_tag_buckets(
buckets, alloc, "S:get-locks-report", "xmlns:S", SVN_XML_NAMESPACE,
- "depth", svn_depth_to_word(lock_ctx->requested_depth), NULL);
+ "depth", svn_depth_to_word(lock_ctx->requested_depth), SVN_VA_NULL);
svn_ra_serf__add_close_tag_buckets(buckets, alloc, "S:get-locks-report");
*body_bkt = buckets;
@@ -244,12 +245,11 @@ svn_ra_serf__get_locks(svn_ra_session_t *ra_session,
svn_error_t *err;
req_url = svn_path_url_add_component2(session->session_url.path, path, pool);
- SVN_ERR(svn_ra_serf__get_relative_path(&rel_path, req_url, session,
- NULL, pool));
+ SVN_ERR(svn_ra_serf__get_relative_path(&rel_path, req_url, session, pool));
lock_ctx = apr_pcalloc(pool, sizeof(*lock_ctx));
lock_ctx->pool = pool;
- lock_ctx->path = apr_pstrcat(pool, "/", rel_path, (char *)NULL);
+ lock_ctx->path = apr_pstrcat(pool, "/", rel_path, SVN_VA_NULL);
lock_ctx->requested_depth = depth;
lock_ctx->hash = apr_hash_make(pool);
@@ -257,33 +257,41 @@ svn_ra_serf__get_locks(svn_ra_session_t *ra_session,
NULL, getlocks_closed, NULL,
lock_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(session, xmlctx, NULL, pool);
handler->method = "REPORT";
handler->path = req_url;
handler->body_type = "text/xml";
- handler->conn = session->conns[0];
- handler->session = session;
handler->body_delegate = create_getlocks_body;
handler->body_delegate_baton = lock_ctx;
err = svn_ra_serf__context_run_one(handler, pool);
-
- /* Wrap the server generated error for an unsupported report with the
- documented error for this ra function. */
- if (svn_error_find_cause(err, SVN_ERR_UNSUPPORTED_FEATURE))
- err = svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, err, NULL);
-
- SVN_ERR(err);
+
+ if (err)
+ {
+ if (svn_error_find_cause(err, SVN_ERR_UNSUPPORTED_FEATURE))
+ {
+ /* The server told us that it doesn't support this report type.
+ We return the documented error for svn_ra_get_locks(), but
+ with the original error report */
+ return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, err, NULL);
+ }
+ else if (err->apr_err == SVN_ERR_FS_NOT_FOUND)
+ {
+ /* File doesn't exist in HEAD: Not an error */
+ svn_error_clear(err);
+ }
+ else
+ return svn_error_trace(err);
+ }
/* We get a 404 when a path doesn't exist in HEAD, but it might
have existed earlier (E.g. 'svn ls http://s/svn/trunk/file@1' */
- if (handler->sline.code != 404)
+ if (handler->sline.code != 200
+ && handler->sline.code != 404)
{
- SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
- handler->path,
- handler->location));
+ return svn_error_trace(svn_ra_serf__unexpected_status(handler));
}
*locks = lock_ctx->hash;
OpenPOWER on IntegriCloud