aboutsummaryrefslogtreecommitdiff
path: root/subversion/libsvn_ra_serf/util.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/util.c
parentdc5d469d6574e9fb03bdd793658bb371315b306a (diff)
Diffstat (limited to 'subversion/libsvn_ra_serf/util.c')
-rw-r--r--subversion/libsvn_ra_serf/util.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/subversion/libsvn_ra_serf/util.c b/subversion/libsvn_ra_serf/util.c
index 98f1f4a8cd63..5490ddea8a59 100644
--- a/subversion/libsvn_ra_serf/util.c
+++ b/subversion/libsvn_ra_serf/util.c
@@ -1949,3 +1949,29 @@ svn_ra_serf__create_handler(svn_ra_serf__session_t *session,
return handler;
}
+svn_error_t *
+svn_ra_serf__uri_parse(apr_uri_t *uri,
+ const char *url_str,
+ apr_pool_t *result_pool)
+{
+ apr_status_t status;
+
+ status = apr_uri_parse(result_pool, url_str, uri);
+ if (status)
+ {
+ /* Do not use returned error status in error message because currently
+ apr_uri_parse() returns APR_EGENERAL for all parsing errors. */
+ return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
+ _("Illegal URL '%s'"),
+ url_str);
+ }
+
+ /* Depending the version of apr-util in use, for root paths uri.path
+ will be NULL or "", where serf requires "/". */
+ if (uri->path == NULL || uri->path[0] == '\0')
+ {
+ uri->path = apr_pstrdup(result_pool, "/");
+ }
+
+ return SVN_NO_ERROR;
+}