diff options
author | Graham Leggett <minfrin@apache.org> | 2013-05-07 18:16:16 +0200 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2013-05-07 18:16:16 +0200 |
commit | e225273e6a81cb91d41ff42648d13dd215848904 (patch) | |
tree | 195e84d4706494bd20781e8c11ea3556d8ac3af1 /modules/cache/mod_cache.c | |
parent | core, mod_cache: Ensure RFC2616 compliance in ap_meets_conditions() (diff) | |
download | apache2-e225273e6a81cb91d41ff42648d13dd215848904.tar.xz apache2-e225273e6a81cb91d41ff42648d13dd215848904.zip |
mod_cache: Ensure that we don't attempt to replace a cached response
with an older response as per RFC2616 13.12.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1479966 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/cache/mod_cache.c')
-rw-r--r-- | modules/cache/mod_cache.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index 90a4efa670..e183b3a257 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -1089,6 +1089,25 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) /* or we've been asked not to cache it above */ reason = "r->no_cache present"; } + else if (cache->stale_handle + && APR_DATE_BAD + != (date = apr_date_parse_http( + apr_table_get(r->headers_out, "Date"))) + && date < cache->stale_handle->cache_obj->info.date) { + + /** + * 13.12 Cache Replacement: + * + * Note: a new response that has an older Date header value than + * existing cached responses is not cacheable. + */ + reason = "updated entity is older than cached entity"; + + /* while this response is not cacheable, the previous response still is */ + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00770) + "cache: Removing CACHE_REMOVE_URL filter."); + ap_remove_output_filter(cache->remove_url_filter); + } else if (r->status == HTTP_NOT_MODIFIED && cache->stale_handle) { apr_table_t *left = cache->stale_handle->resp_hdrs; apr_table_t *right = r->headers_out; |