aboutsummaryrefslogtreecommitdiffstats
path: root/subversion/libsvn_ra_serf
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-05-31 20:58:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-05-31 20:58:28 +0000
commitbbee6e0814d5875b85b81f26fd4ca7a28b6f9570 (patch)
tree726fcf32b39ca8976d7aa51b67c7236509f1bde4 /subversion/libsvn_ra_serf
parent38cef28c88864beaadac7a7cffdec6da952c3eb2 (diff)
downloadsrc-bbee6e0814d5875b85b81f26fd4ca7a28b6f9570.tar.gz
src-bbee6e0814d5875b85b81f26fd4ca7a28b6f9570.zip
Notes
Notes: svn path=/vendor/subversion/dist/; revision=361669 svn path=/vendor/subversion/subversion-1.14.0/; revision=361670; tag=vendor/subversion/subversion-1.14.0
Diffstat (limited to 'subversion/libsvn_ra_serf')
-rw-r--r--subversion/libsvn_ra_serf/commit.c4
-rw-r--r--subversion/libsvn_ra_serf/inherited_props.c2
-rw-r--r--subversion/libsvn_ra_serf/libsvn_ra_serf.pc.in8
-rw-r--r--subversion/libsvn_ra_serf/list.c13
-rw-r--r--subversion/libsvn_ra_serf/lock.c2
-rw-r--r--subversion/libsvn_ra_serf/options.c40
-rw-r--r--subversion/libsvn_ra_serf/ra_serf.h1
-rw-r--r--subversion/libsvn_ra_serf/replay.c4
-rw-r--r--subversion/libsvn_ra_serf/serf.c8
-rw-r--r--subversion/libsvn_ra_serf/update.c2
-rw-r--r--subversion/libsvn_ra_serf/util.c28
11 files changed, 75 insertions, 37 deletions
diff --git a/subversion/libsvn_ra_serf/commit.c b/subversion/libsvn_ra_serf/commit.c
index 63a6f0bfa45b..1b25ab4b8ab1 100644
--- a/subversion/libsvn_ra_serf/commit.c
+++ b/subversion/libsvn_ra_serf/commit.c
@@ -311,7 +311,7 @@ checkout_node(const char **working_url,
fails due to an SVN_ERR_APMOD_BAD_BASELINE error return from the
server.
- See http://subversion.tigris.org/issues/show_bug.cgi?id=4127 for
+ See https://issues.apache.org/jira/browse/SVN-4127 for
details.
*/
static svn_error_t *
@@ -677,7 +677,7 @@ write_prop_xml(const proppatch_context_t *proppatch,
explicitly deleted in this commit already, then mod_dav removed its
lock token when it fielded the DELETE request, so we don't want to
set the lock precondition again. (See
- http://subversion.tigris.org/issues/show_bug.cgi?id=3674 for details.)
+ https://issues.apache.org/jira/browse/SVN-3674 for details.)
*/
static svn_error_t *
maybe_set_lock_token_header(serf_bucket_t *headers,
diff --git a/subversion/libsvn_ra_serf/inherited_props.c b/subversion/libsvn_ra_serf/inherited_props.c
index 6edafb1027cf..f4e9e5ed7951 100644
--- a/subversion/libsvn_ra_serf/inherited_props.c
+++ b/subversion/libsvn_ra_serf/inherited_props.c
@@ -340,7 +340,7 @@ get_iprops_via_more_requests(svn_ra_session_t *ra_session,
new_iprop = apr_palloc(result_pool, sizeof(*new_iprop));
new_iprop->path_or_url = apr_pstrdup(result_pool, rq->relpath);
new_iprop->prop_hash = svn_prop_hash_dup(node_props, result_pool);
- svn_sort__array_insert(*iprops, &new_iprop, 0);
+ SVN_ERR(svn_sort__array_insert2(*iprops, &new_iprop, 0));
}
return SVN_NO_ERROR;
diff --git a/subversion/libsvn_ra_serf/libsvn_ra_serf.pc.in b/subversion/libsvn_ra_serf/libsvn_ra_serf.pc.in
index 81285ed468d3..eb46915a8a82 100644
--- a/subversion/libsvn_ra_serf/libsvn_ra_serf.pc.in
+++ b/subversion/libsvn_ra_serf/libsvn_ra_serf.pc.in
@@ -6,7 +6,7 @@ includedir=@includedir@
Name: libsvn_ra_serf
Description: Subversion HTTP/WebDAV Protocol Repository Access Library
Version: @PACKAGE_VERSION@
-Requires: apr-util-@SVN_APR_MAJOR_VERSION@ apr-@SVN_APR_MAJOR_VERSION@
-Requires.private: libsvn_delta libsvn_subr serf-1
-Libs: -L${libdir} -lsvn_ra_serf @SVN_ZLIB_LIBS@
-Cflags: -I${includedir}
+Requires: apr-util-@SVN_APR_MAJOR_VERSION@, apr-@SVN_APR_MAJOR_VERSION@
+Requires.private: libsvn_delta, libsvn_subr, serf-1
+Libs: -L${libdir} -lsvn_ra_serf-1 @SVN_ZLIB_LIBS@
+Cflags: -I${includedir}/subversion-1
diff --git a/subversion/libsvn_ra_serf/list.c b/subversion/libsvn_ra_serf/list.c
index 722a946d3645..3b2ac9fdbe75 100644
--- a/subversion/libsvn_ra_serf/list.c
+++ b/subversion/libsvn_ra_serf/list.c
@@ -21,26 +21,13 @@
* ====================================================================
*/
-
-
-
-#include <apr_uri.h>
#include <serf.h>
#include "svn_hash.h"
-#include "svn_pools.h"
-#include "svn_ra.h"
-#include "svn_dav.h"
#include "svn_base64.h"
#include "svn_xml.h"
-#include "svn_config.h"
-#include "svn_path.h"
-#include "svn_props.h"
#include "svn_time.h"
-#include "private/svn_dav_protocol.h"
-#include "private/svn_string_private.h"
-#include "private/svn_subr_private.h"
#include "svn_private_config.h"
#include "ra_serf.h"
diff --git a/subversion/libsvn_ra_serf/lock.c b/subversion/libsvn_ra_serf/lock.c
index d303104b3684..a9d599260a4d 100644
--- a/subversion/libsvn_ra_serf/lock.c
+++ b/subversion/libsvn_ra_serf/lock.c
@@ -354,7 +354,7 @@ run_locks(svn_ra_serf__session_t *sess,
SVN_ERR(cb_err);
waittime_left = sess->timeout;
- svn_sort__array_delete(lock_ctxs, i, 1);
+ SVN_ERR(svn_sort__array_delete2(lock_ctxs, i, 1));
i--;
svn_pool_destroy(ctx->pool);
diff --git a/subversion/libsvn_ra_serf/options.c b/subversion/libsvn_ra_serf/options.c
index 9cb507c8f470..a3d321a64715 100644
--- a/subversion/libsvn_ra_serf/options.c
+++ b/subversion/libsvn_ra_serf/options.c
@@ -71,6 +71,9 @@ typedef struct options_context_t {
svn_ra_serf__response_handler_t inner_handler;
void *inner_baton;
+ /* Have we received any DAV headers at all? */
+ svn_boolean_t received_dav_header;
+
const char *activity_collection;
svn_revnum_t youngest_rev;
@@ -165,6 +168,8 @@ capabilities_headers_iterator_callback(void *baton,
apr_array_header_t *vals = svn_cstring_split(val, ",", TRUE,
opt_ctx->pool);
+ opt_ctx->received_dav_header = TRUE;
+
/* Right now we only have a few capabilities to detect, so just
seek for them directly. This could be written slightly more
efficiently, but that wouldn't be worth it until we have many
@@ -396,6 +401,19 @@ options_response_handler(serf_request_t *request,
serf_bucket_headers_do(hdrs, capabilities_headers_iterator_callback,
opt_ctx);
+ /* Bail out early if we're not talking to a DAV server.
+ Note that this check is only valid if we've received a success
+ response; redirects and errors don't count. */
+ if (opt_ctx->handler->sline.code >= 200
+ && opt_ctx->handler->sline.code < 300
+ && !opt_ctx->received_dav_header)
+ {
+ return svn_error_createf
+ (SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
+ _("The server at '%s' does not support the HTTP/DAV protocol"),
+ session->session_url_str);
+ }
+
/* Assume mergeinfo capability unsupported, if didn't receive information
about server or repository mergeinfo capability. */
if (!svn_hash_gets(session->capabilities, SVN_RA_CAPABILITY_MERGEINFO))
@@ -528,6 +546,7 @@ svn_ra_serf__v1_get_activity_collection(const char **activity_url,
svn_error_t *
svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
const char **corrected_url,
+ const char **redirect_url,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -535,6 +554,8 @@ svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
if (corrected_url)
*corrected_url = NULL;
+ if (redirect_url)
+ *redirect_url = NULL;
/* This routine automatically fills in serf_sess->capabilities */
SVN_ERR(create_options_req(&opt_ctx, serf_sess, scratch_pool));
@@ -557,8 +578,11 @@ svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
}
else if (svn_path_is_url(opt_ctx->handler->location))
{
- *corrected_url = svn_uri_canonicalize(opt_ctx->handler->location,
- result_pool);
+ SVN_ERR(svn_uri_canonicalize_safe(corrected_url, NULL,
+ opt_ctx->handler->location, result_pool, scratch_pool));
+ if (redirect_url)
+ *redirect_url = apr_pstrdup(result_pool,
+ opt_ctx->handler->location);
}
else
{
@@ -569,11 +593,14 @@ svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
See issue #3775 for details. */
apr_uri_t corrected_URI = serf_sess->session_url;
+ char *absolute_uri;
corrected_URI.path = (char *)corrected_url;
- *corrected_url = svn_uri_canonicalize(
- apr_uri_unparse(scratch_pool, &corrected_URI, 0),
- result_pool);
+ absolute_uri = apr_uri_unparse(scratch_pool, &corrected_URI, 0);
+ SVN_ERR(svn_uri_canonicalize_safe(corrected_url, NULL,
+ absolute_uri, result_pool, scratch_pool));
+ if (redirect_url)
+ *redirect_url = apr_pstrdup(result_pool, absolute_uri);
}
return SVN_NO_ERROR;
@@ -681,7 +708,8 @@ svn_ra_serf__has_capability(svn_ra_session_t *ra_session,
/* If any capability is unknown, they're all unknown, so ask. */
if (cap_result == NULL)
- SVN_ERR(svn_ra_serf__exchange_capabilities(serf_sess, NULL, pool, pool));
+ SVN_ERR(svn_ra_serf__exchange_capabilities(serf_sess, NULL, NULL,
+ pool, pool));
/* Try again, now that we've fetched the capabilities. */
cap_result = svn_hash_gets(serf_sess->capabilities, capability);
diff --git a/subversion/libsvn_ra_serf/ra_serf.h b/subversion/libsvn_ra_serf/ra_serf.h
index 9191d073bbc4..0135e8137a70 100644
--- a/subversion/libsvn_ra_serf/ra_serf.h
+++ b/subversion/libsvn_ra_serf/ra_serf.h
@@ -1472,6 +1472,7 @@ svn_ra_serf__get_mergeinfo(svn_ra_session_t *ra_session,
svn_error_t *
svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
const char **corrected_url,
+ const char **redirect_url,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
diff --git a/subversion/libsvn_ra_serf/replay.c b/subversion/libsvn_ra_serf/replay.c
index bb90ad4a8041..27b4bdce9656 100644
--- a/subversion/libsvn_ra_serf/replay.c
+++ b/subversion/libsvn_ra_serf/replay.c
@@ -666,7 +666,7 @@ svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
apr_pool_t *subpool = svn_pool_create(scratch_pool);
if (session->http20) {
- /* ### Auch... this doesn't work yet...
+ /* ### 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.
@@ -701,7 +701,7 @@ svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
wish for the best.
See issue #4287:
- http://subversion.tigris.org/issues/show_bug.cgi?id=4287
+ https://issues.apache.org/jira/browse/SVN-4287
*/
if (session->supports_rev_rsrc_replay)
{
diff --git a/subversion/libsvn_ra_serf/serf.c b/subversion/libsvn_ra_serf/serf.c
index 830e5cad532e..1a79bdc00121 100644
--- a/subversion/libsvn_ra_serf/serf.c
+++ b/subversion/libsvn_ra_serf/serf.c
@@ -363,7 +363,7 @@ load_config(svn_ra_serf__session_t *session,
{
apr_int64_t timeout;
svn_error_t *err;
-
+
err = svn_cstring_strtoi64(&timeout, timeout_str, 0, APR_INT64_MAX, 10);
if (err)
return svn_error_createf(SVN_ERR_BAD_CONFIG_VALUE, err,
@@ -476,6 +476,7 @@ get_user_agent_string(apr_pool_t *pool)
static svn_error_t *
svn_ra_serf__open(svn_ra_session_t *session,
const char **corrected_url,
+ const char **redirect_url,
const char *session_URL,
const svn_ra_callbacks2_t *callbacks,
void *callback_baton,
@@ -492,6 +493,8 @@ svn_ra_serf__open(svn_ra_session_t *session,
if (corrected_url)
*corrected_url = NULL;
+ if (redirect_url)
+ *redirect_url = NULL;
serf_sess = apr_pcalloc(result_pool, sizeof(*serf_sess));
serf_sess->pool = result_pool;
@@ -588,7 +591,7 @@ svn_ra_serf__open(svn_ra_session_t *session,
Luckily our caller now passes us two pools which handle this case.
*/
#if defined(SVN_DEBUG) && !SERF_VERSION_AT_LEAST(1,4,0)
- /* Currently ensured by svn_ra_open4().
+ /* Currently ensured by svn_ra_open5().
If failing causes segfault in basic_tests.py 48, "basic auth test" */
SVN_ERR_ASSERT((serf_sess->pool != scratch_pool)
&& apr_pool_is_ancestor(serf_sess->pool, scratch_pool));
@@ -599,6 +602,7 @@ svn_ra_serf__open(svn_ra_session_t *session,
serf_sess->conn_latency = -1;
err = svn_ra_serf__exchange_capabilities(serf_sess, corrected_url,
+ redirect_url,
result_pool, scratch_pool);
/* serf should produce a usable error code instead of APR_EGENERAL */
diff --git a/subversion/libsvn_ra_serf/update.c b/subversion/libsvn_ra_serf/update.c
index 63091f2ebd21..fc68adffbe33 100644
--- a/subversion/libsvn_ra_serf/update.c
+++ b/subversion/libsvn_ra_serf/update.c
@@ -603,7 +603,7 @@ get_best_connection(report_context_t *ctx)
### simply can't handle the way ra_serf violates the editor v1
### drive ordering requirements.
###
- ### See http://subversion.tigris.org/issues/show_bug.cgi?id=4116.
+ ### See https://issues.apache.org/jira/browse/SVN-4116.
*/
if (ctx->report_received && (ctx->sess->max_connections > 2))
first_conn = 0;
diff --git a/subversion/libsvn_ra_serf/util.c b/subversion/libsvn_ra_serf/util.c
index 52bf93b3a9b1..e545d77f1be9 100644
--- a/subversion/libsvn_ra_serf/util.c
+++ b/subversion/libsvn_ra_serf/util.c
@@ -756,6 +756,9 @@ handle_client_cert_pw(void *data,
if (creds)
{
+ /* At this stage we are unable to check whether the password
+ is correct; if it is incorrect serf will fail to establish
+ an SSL connection and will return a generic SSL error. */
svn_auth_cred_ssl_client_cert_pw_t *pw_creds;
pw_creds = creds;
*password = pw_creds->password;
@@ -1113,19 +1116,17 @@ response_get_location(serf_bucket_t *response,
return NULL;
/* Replace the path path with what we got */
- uri.path = (char*)svn_urlpath__canonicalize(location, scratch_pool);
+ uri.path = apr_pstrdup(scratch_pool, location);
/* And make APR produce a proper full url for us */
- location = apr_uri_unparse(scratch_pool, &uri, 0);
-
- /* Fall through to ensure our canonicalization rules */
+ return apr_uri_unparse(result_pool, &uri, 0);
}
else if (!svn_path_is_url(location))
{
return NULL; /* Any other formats we should support? */
}
- return svn_uri_canonicalize(location, result_pool);
+ return apr_pstrdup(result_pool, location);
}
@@ -1445,6 +1446,23 @@ handle_response(serf_request_t *request,
process_body:
+ /* A client cert file password was obtained and worked (any HTTP
+ response means that the SSL connection was established.) */
+ if (handler->conn->ssl_client_pw_auth_state)
+ {
+ SVN_ERR(svn_auth_save_credentials(handler->conn->ssl_client_pw_auth_state,
+ handler->session->pool));
+ handler->conn->ssl_client_pw_auth_state = NULL;
+ }
+ if (handler->conn->ssl_client_auth_state)
+ {
+ /* The cert file provider doesn't have any code to save creds so
+ this is currently a no-op. */
+ SVN_ERR(svn_auth_save_credentials(handler->conn->ssl_client_auth_state,
+ handler->session->pool));
+ handler->conn->ssl_client_auth_state = NULL;
+ }
+
/* We've been instructed to ignore the body. Drain whatever is present. */
if (handler->discard_body)
{