summaryrefslogtreecommitdiffstats
path: root/server/request.c
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2021-04-21 03:02:11 +0200
committerEric Covener <covener@apache.org>2021-04-21 03:02:11 +0200
commit6141d5aa3f5cf8f1b89472e7fdb66578810d0ae3 (patch)
treea72ca0f8624c0ed2751a7ab809ba73e87956227e /server/request.c
parentcore/ap_ssl_*: changes after review by rpluem (diff)
downloadapache2-6141d5aa3f5cf8f1b89472e7fdb66578810d0ae3.tar.xz
apache2-6141d5aa3f5cf8f1b89472e7fdb66578810d0ae3.zip
legacy default slash-matching behavior w/ 'MergeSlashes OFF'
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889036 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--server/request.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/server/request.c b/server/request.c
index 4d1f4cb11c..df0ea6758f 100644
--- a/server/request.c
+++ b/server/request.c
@@ -1471,7 +1471,20 @@ AP_DECLARE(int) ap_location_walk(request_rec *r)
cache = prep_walk_cache(AP_NOTE_LOCATION_WALK, r);
cached = (cache->cached != NULL);
- entry_uri = r->uri;
+
+ /*
+ * When merge_slashes is set to AP_CORE_CONFIG_OFF the slashes in r->uri
+ * have not been merged. But for Location walks we always go with merged
+ * slashes no matter what merge_slashes is set to.
+ */
+ if (sconf->merge_slashes != AP_CORE_CONFIG_OFF) {
+ entry_uri = r->uri;
+ }
+ else {
+ char *uri = apr_pstrdup(r->pool, r->uri);
+ ap_no2slash(uri);
+ entry_uri = uri;
+ }
/* If we have an cache->cached location that matches r->uri,
* and the vhost's list of locations hasn't changed, we can skip
@@ -1539,7 +1552,7 @@ AP_DECLARE(int) ap_location_walk(request_rec *r)
pmatch = apr_palloc(rxpool, nmatch*sizeof(ap_regmatch_t));
}
- if (ap_regexec(entry_core->r, entry_uri, nmatch, pmatch, 0)) {
+ if (ap_regexec(entry_core->r, r->uri, nmatch, pmatch, 0)) {
continue;
}
@@ -1549,7 +1562,7 @@ AP_DECLARE(int) ap_location_walk(request_rec *r)
apr_table_setn(r->subprocess_env,
((const char **)entry_core->refs->elts)[i],
apr_pstrndup(r->pool,
- entry_uri + pmatch[i].rm_so,
+ r->uri + pmatch[i].rm_so,
pmatch[i].rm_eo - pmatch[i].rm_so));
}
}