summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@apache.org>2010-10-23 16:11:20 +0200
committerGraham Leggett <minfrin@apache.org>2010-10-23 16:11:20 +0200
commit9619a17b78945cdd444d377d1063d4dac453c532 (patch)
treeea1c2f3d618ddc5fbe2bc4d20b6e7f6b51760f01
parentmod_disk_cache: Make sure we step down cleanly when we've ben configured (diff)
downloadapache2-9619a17b78945cdd444d377d1063d4dac453c532.tar.xz
apache2-9619a17b78945cdd444d377d1063d4dac453c532.zip
mod_cache: Respect the original Cache-Control header if no header arrives
with a 304 Not Modified. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1026617 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--modules/cache/mod_cache.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c
index bbdec894e1..8d1652486f 100644
--- a/modules/cache/mod_cache.c
+++ b/modules/cache/mod_cache.c
@@ -868,12 +868,21 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
cc_out = apr_table_get(r->err_headers_out, "Cache-Control");
pragma = apr_table_get(r->err_headers_out, "Pragma");
headers = r->err_headers_out;
- if (cc_out == NULL && pragma == NULL) {
+ if (!cc_out && !pragma) {
cc_out = apr_table_get(r->headers_out, "Cache-Control");
pragma = apr_table_get(r->headers_out, "Pragma");
headers = r->headers_out;
}
+ /* Have we received a 304 response without any headers at all? Fall back to
+ * the original headers in the original cached request.
+ */
+ if (r->status == HTTP_NOT_MODIFIED && cache->stale_handle && !cc_out
+ && !pragma) {
+ cc_out = apr_table_get(cache->stale_handle->resp_hdrs, "Cache-Control");
+ pragma = apr_table_get(cache->stale_handle->resp_hdrs, "Pragma");
+ }
+
/* Parse the cache control header */
memset(&control, 0, sizeof(cache_control_t));
ap_cache_control(r, &control, cc_out, pragma, headers);