]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
ap_location_walk/ap_directory_walk: copy the cached uri/filename.
authorYann Ylavic <ylavic@apache.org>
Tue, 23 Jun 2020 11:27:48 +0000 (11:27 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 23 Jun 2020 11:27:48 +0000 (11:27 +0000)
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

server/request.c

index aa05d524e000ebe26f7cd28d1f5f665955e60e15..8c5bbae56f4f3cab6415cf3bd0889c87fe7c3e04 100644 (file)
@@ -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