summaryrefslogtreecommitdiffstats
path: root/modules/cache
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2014-04-30 16:58:33 +0200
committerYann Ylavic <ylavic@apache.org>2014-04-30 16:58:33 +0200
commit4d2d2c5edcd1d6df32c8ba9d8c4a9cb7db6c0852 (patch)
tree03ba004a54447982b19a557bbd5a3381f5d43be2 /modules/cache
parentmod_cache: follow up to r1591320. (diff)
downloadapache2-4d2d2c5edcd1d6df32c8ba9d8c4a9cb7db6c0852.tar.xz
apache2-4d2d2c5edcd1d6df32c8ba9d8c4a9cb7db6c0852.zip
mod_cache: Preserve non-cacheable headers forwarded from an origin 304
response. PR 55547. When mod_cache asks for a revalidation of a stale entry and the origin responds with a 304 (not that stale), the module strips the non-cacheable headers from the origin response and merges the stale headers to update the cache. The problem is that mod_cache won't forward the non-cacheable headers to the client, for example if the 304 response contains both Set-Cookie and 'Cache-Control: no-cache="Set-Cookie"' headers, or CacheIgnoreHeaders is used. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591328 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/cache')
-rw-r--r--modules/cache/mod_cache.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c
index c2b92e9e8c..74c559c727 100644
--- a/modules/cache/mod_cache.c
+++ b/modules/cache/mod_cache.c
@@ -1444,10 +1444,14 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
* the cached headers.
*
* However, before doing that, we need to first merge in
- * err_headers_out and we also need to strip any hop-by-hop
- * headers that might have snuck in.
+ * err_headers_out (note that store_headers() below already selects
+ * the cacheable only headers using ap_cache_cacheable_headers_out(),
+ * here we want to keep the original headers in r->headers_out and
+ * forward all of them to the client, including non-cacheable ones).
*/
- r->headers_out = ap_cache_cacheable_headers_out(r);
+ r->headers_out = apr_table_overlay(r->pool, r->headers_out,
+ r->err_headers_out);
+ apr_table_clear(r->err_headers_out);
/* Merge in our cached headers. However, keep any updated values. */
/* take output, overlay on top of cached */