]> granicus.if.org Git - apache/commitdiff
Backport 1201331:
authorGraham Leggett <minfrin@apache.org>
Sat, 12 Nov 2011 21:34:40 +0000 (21:34 +0000)
committerGraham Leggett <minfrin@apache.org>
Sat, 12 Nov 2011 21:34:40 +0000 (21:34 +0000)
mod_cache: Make sure we merge headers correctly when we handle a
non cacheable conditional response. PR52120.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1201332 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/cache/mod_cache.c

diff --git a/CHANGES b/CHANGES
index 5a71c06d9c36a2d0d76f83f1f01b9f3f00fa6ff4..df4d48451b1ff417e7776559a91b6265be45dcfc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.0
 
+  *) mod_cache: Make sure we merge headers correctly when we handle a
+     non cacheable conditional response. PR52120. [Graham Leggett]
+
   *) Pre GA removal of components that will not be included:
      - mod_noloris was superseded by mod_reqtimeout
      - mod_serf
index b97a21c285b07e088dd7dbc248583d8d2e9036d0..af7be135231f51df82ba8f402c1a125d85239b17 100644 (file)
@@ -1081,6 +1081,20 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
             APR_BRIGADE_INSERT_TAIL(bb, bkt);
         }
         else {
+            /* RFC 2616 10.3.5 states that entity headers are not supposed
+             * to be in the 304 response.  Therefore, we need to combine the
+             * response headers with the cached headers *before* we update
+             * 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.
+             */
+            r->headers_out = ap_cache_cacheable_headers_out(r);
+
+            /* Merge in our cached headers.  However, keep any updated values. */
+            cache_accept_headers(cache->handle, r, 1);
+
             cache->provider->recall_body(cache->handle, r->pool, bb);
 
             bkt = apr_bucket_eos_create(bb->bucket_alloc);