summaryrefslogtreecommitdiff
path: root/subversion/mod_dav_svn/mirror.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/mod_dav_svn/mirror.c')
-rw-r--r--subversion/mod_dav_svn/mirror.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/subversion/mod_dav_svn/mirror.c b/subversion/mod_dav_svn/mirror.c
index 610b640..e8b19a8 100644
--- a/subversion/mod_dav_svn/mirror.c
+++ b/subversion/mod_dav_svn/mirror.c
@@ -39,12 +39,17 @@
URI_SEGMENT is the URI bits relative to the repository root (but if
non-empty, *does* have a leading slash delimiter).
MASTER_URI and URI_SEGMENT are not URI-encoded. */
-static void proxy_request_fixup(request_rec *r,
- const char *master_uri,
- const char *uri_segment)
+static int proxy_request_fixup(request_rec *r,
+ const char *master_uri,
+ const char *uri_segment)
{
- assert((uri_segment[0] == '\0')
- || (uri_segment[0] == '/'));
+ if (uri_segment[0] != '\0' && uri_segment[0] != '/')
+ {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, SVN_ERR_BAD_CONFIG_VALUE, r,
+ "Invalid URI segment '%s' in slave fixup",
+ uri_segment);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
r->proxyreq = PROXYREQ_REVERSE;
r->uri = r->unparsed_uri;
@@ -54,9 +59,20 @@ static void proxy_request_fixup(request_rec *r,
(char *)NULL),
r->pool);
r->handler = "proxy-server";
+
+ /* ### FIXME: Seems we could avoid adding some or all of these
+ filters altogether when the root_dir (that is, the slave's
+ location, relative to the server root) and path portion of
+ the master_uri (the master's location, relative to the
+ server root) are identical, rather than adding them here
+ and then trying to remove them later. (See the filter
+ removal logic in dav_svn__location_in_filter() and
+ dav_svn__location_body_filter(). -- cmpilato */
+
ap_add_output_filter("LocationRewrite", NULL, r, r->connection);
ap_add_output_filter("ReposRewrite", NULL, r, r->connection);
ap_add_input_filter("IncomingRewrite", NULL, r, r->connection);
+ return OK;
}
@@ -91,8 +107,10 @@ int dav_svn__proxy_request_fixup(request_rec *r)
"/txn/", (char *)NULL))
|| ap_strstr_c(seg, apr_pstrcat(r->pool, special_uri,
"/txr/", (char *)NULL))) {
+ int rv;
seg += strlen(root_dir);
- proxy_request_fixup(r, master_uri, seg);
+ rv = proxy_request_fixup(r, master_uri, seg);
+ if (rv) return rv;
}
}
return OK;
@@ -106,8 +124,10 @@ int dav_svn__proxy_request_fixup(request_rec *r)
r->method_number == M_LOCK ||
r->method_number == M_UNLOCK ||
ap_strstr_c(seg, special_uri))) {
+ int rv;
seg += strlen(root_dir);
- proxy_request_fixup(r, master_uri, seg);
+ rv = proxy_request_fixup(r, master_uri, seg);
+ if (rv) return rv;
return OK;
}
}