Max OS X, Linux, Solaris Apache: 2.2.4 When an object is cached who's URL is url-escaped (containg spaces, etc), mod_cache will never serve the cached file because the key-lookup to locate the cached file is performed using the escaped URL. Instead the file is cached over and over again, using the unescaped URL as the key. PS: I added the ap_log_error to cache_generate_key_default() in cache_storage.c Test-config: <Location /tmc/> ExpiresActive On ExpiresDefault A31536000 </Location> CacheEnable disk /tmc/ ... # mkdir -p htpdocs/tmc # cp /etc/hosts htdocs/tmc/bla.txt # cp /etc/hosts htdocs/tmc/foo\ bar.txt This problem is quite similar in effect to #40805. # curl -D - -o /dev/null 'http://localhost/tmc/foo%20bar.txt' request #1 Fri Jan 26 14:41:16 2007] [debug] cache_storage.c(432): cache_generate_key_default(): key is 'http:// localhost:80/tmc/foo%20bar.txt?' [Fri Jan 26 14:41:16 2007] [debug] mod_cache.c(129): Adding CACHE_SAVE filter for /tmc/foo% 20bar.txt [Fri Jan 26 14:41:16 2007] [debug] mod_cache.c(136): Adding CACHE_REMOVE_URL filter for /tmc/foo% 20bar.txt [Fri Jan 26 14:41:16 2007] [debug] cache_storage.c(432): cache_generate_key_default(): key is 'http:// localhost:80/tmc/foo bar.txt?' [Fri Jan 26 14:41:16 2007] [debug] mod_cache.c(609): cache: Caching url: /tmc/foo%20bar.txt [Fri Jan 26 14:41:16 2007] [debug] mod_cache.c(615): cache: Removing CACHE_REMOVE_URL filter. [Fri Jan 26 14:41:16 2007] [debug] mod_cache.c(658): cache: Added date header [Fri Jan 26 14:41:16 2007] [debug] mod_disk_cache.c(954): disk_cache: Stored headers for URL http:// localhost:80/tmc/foo bar.txt? [Fri Jan 26 14:41:16 2007] [debug] mod_disk_cache.c(1043): disk_cache: Body for URL http://localhost: 80/tmc/foo bar.txt? cached. request #2 [Fri Jan 26 14:41:44 2007] [debug] cache_storage.c(432): cache_generate_key_default(): key is 'http:// localhost:80/tmc/foo%20bar.txt?' [Fri Jan 26 14:41:44 2007] [debug] mod_cache.c(129): Adding CACHE_SAVE filter for /tmc/foo% 20bar.txt [Fri Jan 26 14:41:44 2007] [debug] mod_cache.c(136): Adding CACHE_REMOVE_URL filter for /tmc/foo% 20bar.txt [Fri Jan 26 14:41:44 2007] [debug] cache_storage.c(432): cache_generate_key_default(): key is 'http:// localhost:80/tmc/foo bar.txt?' [Fri Jan 26 14:41:44 2007] [debug] mod_cache.c(609): cache: Caching url: /tmc/foo%20bar.txt [Fri Jan 26 14:41:44 2007] [debug] mod_cache.c(615): cache: Removing CACHE_REMOVE_URL filter. [Fri Jan 26 14:41:44 2007] [debug] mod_cache.c(658): cache: Added date header [Fri Jan 26 14:41:44 2007] [debug] mod_disk_cache.c(954): disk_cache: Stored headers for URL http:// localhost:80/tmc/foo bar.txt? [Fri Jan 26 14:41:44 2007] [debug] mod_disk_cache.c(1043): disk_cache: Body for URL http://localhost: 80/tmc/foo bar.txt? cached. # curl -D - -o /dev/null 'http://localhost/tmc/bla.txt' request #1 [Fri Jan 26 14:44:21 2007] [debug] cache_storage.c(432): cache_generate_key_default(): key is 'http:// localhost:80/tmc/bla.txt?' [Fri Jan 26 14:44:21 2007] [debug] mod_cache.c(129): Adding CACHE_SAVE filter for /tmc/bla.txt [Fri Jan 26 14:44:21 2007] [debug] mod_cache.c(136): Adding CACHE_REMOVE_URL filter for /tmc/ bla.txt [Fri Jan 26 14:44:21 2007] [debug] cache_storage.c(432): cache_generate_key_default(): key is 'http:// localhost:80/tmc/bla.txt?' [Fri Jan 26 14:44:21 2007] [debug] mod_cache.c(609): cache: Caching url: /tmc/bla.txt [Fri Jan 26 14:44:21 2007] [debug] mod_cache.c(615): cache: Removing CACHE_REMOVE_URL filter. [Fri Jan 26 14:44:21 2007] [debug] mod_cache.c(658): cache: Added date header [Fri Jan 26 14:44:21 2007] [debug] mod_disk_cache.c(954): disk_cache: Stored headers for URL http:// localhost:80/tmc/bla.txt? [Fri Jan 26 14:44:21 2007] [debug] mod_disk_cache.c(1043): disk_cache: Body for URL http://localhost: 80/tmc/bla.txt? cached. request #2 [Fri Jan 26 14:44:43 2007] [debug] cache_storage.c(432): cache_generate_key_default(): key is 'http:// localhost:80/tmc/bla.txt?' [Fri Jan 26 14:44:43 2007] [debug] mod_disk_cache.c(477): disk_cache: Recalled cached URL info header http://localhost:80/tmc/bla.txt? [Fri Jan 26 14:44:43 2007] [debug] mod_disk_cache.c(750): disk_cache: Recalled headers for URL http://localhost:80/tmc/bla.txt? [Fri Jan 26 14:44:43 2007] [info] Incoming request is asking for a uncached version of /tmc/bla.txt, but we know better and are ignoring it [Fri Jan 26 14:44:43 2007] [debug] mod_cache.c(263): cache: running CACHE_OUT filter [Fri Jan 26 14:44:43 2007] [debug] mod_cache.c(277): cache: serving /tmc/bla.txt
*** Bug 41516 has been marked as a duplicate of this bug. ***
Could you please give the attached patch a try and report back whether it solves your problem?
Created attachment 19529 [details] Patch against trunk
(In reply to comment #2) > Could you please give the attached patch a try and report back whether it solves > your problem? I applied your patch against 2.2.4. The testcase I used to report the problem (see above) worked for me.
(In reply to comment #4) > (In reply to comment #2) > > Could you please give the attached patch a try and report back whether it solves > > your problem? > > I applied your patch against 2.2.4. > > The testcase I used to report the problem (see above) worked for me. Confirming that this solved my problems also (duplicate reported bug 41516), when applied to 2.2.4.
Thanks for the feedback. Committed to trunk as r506621 (http://svn.apache.org/viewvc?view=rev&revision=506621).
Backported to 2.2.x as r539112 (http://svn.apache.org/viewvc?view=rev&rev=539112).