From: Yann Ylavic Date: Tue, 23 Jun 2020 11:27:48 +0000 (+0000) Subject: ap_location_walk/ap_directory_walk: copy the cached uri/filename. X-Git-Tag: 2.5.0-alpha2-ci-test-only~1345 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d073ced2386f0f913c7b147796b0bda46740e3b;p=thirdparty%2Fapache%2Fhttpd.git ap_location_walk/ap_directory_walk: copy the cached uri/filename. Any in-place modification of r->uri of r->filename shouldn't affect the cache. For instance, ap_process_request_internal() normalizes r->uri in place and yet calls ap_location_walk() multiple times, which confuses caching. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879114 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/request.c b/server/request.c index aa05d524e00..8c5bbae56f4 100644 --- a/server/request.c +++ b/server/request.c @@ -1413,7 +1413,7 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r) r->canonical_filename = r->filename; if (r->finfo.filetype == APR_DIR) { - cache->cached = r->filename; + cache->cached = apr_pstrdup(r->pool, r->filename); } else { cache->cached = ap_make_dirstr_parent(r->pool, r->filename); @@ -1497,7 +1497,7 @@ AP_DECLARE(int) ap_location_walk(request_rec *r) apr_pool_t *rxpool = NULL; cached &= auth_internal_per_conf; - cache->cached = entry_uri; + cache->cached = apr_pstrdup(r->pool, entry_uri); /* Go through the location entries, and check for matches. * We apply the directive sections in given order, we should