diff options
author | Jan Kaluža <jkaluza@apache.org> | 2015-03-09 13:48:11 +0100 |
---|---|---|
committer | Jan Kaluža <jkaluza@apache.org> | 2015-03-09 13:48:11 +0100 |
commit | 53e095830bf0b71c5ef5e915575b17cd888f7238 (patch) | |
tree | c8c373e5e390fe962c288f0f5c560f6db347f3ca /modules | |
parent | mod_proxy: use the original (non absolute) form of the request-line's URI (diff) | |
download | apache2-53e095830bf0b71c5ef5e915575b17cd888f7238.tar.xz apache2-53e095830bf0b71c5ef5e915575b17cd888f7238.zip |
* mod_cache: Preserve the Content-Type in case of 304 response.
304 does not contain Content-Type and mod_mime regenerates
the Content-Type based on the r->filename. This later leads to original
Content-Type to be lost (overwriten by whatever mod_mime generates).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1665216 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r-- | modules/cache/mod_cache.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index 5f478cd876..d84448d7f6 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -973,12 +973,20 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) /* 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 = cache_table_getm(r->pool, cache->stale_handle->resp_hdrs, - "Cache-Control"); - pragma = cache_table_getm(r->pool, cache->stale_handle->resp_hdrs, - "Pragma"); + if (r->status == HTTP_NOT_MODIFIED && cache->stale_handle) { + if (!cc_out && !pragma) { + cc_out = cache_table_getm(r->pool, cache->stale_handle->resp_hdrs, + "Cache-Control"); + pragma = cache_table_getm(r->pool, cache->stale_handle->resp_hdrs, + "Pragma"); + } + + /* 304 does not contain Content-Type and mod_mime regenerates the + * Content-Type based on the r->filename. This would lead to original + * Content-Type to be lost (overwriten by whatever mod_mime generates). + * We preserves the original Content-Type here. */ + ap_set_content_type(r, apr_table_get( + cache->stale_handle->resp_hdrs, "Content-Type")); } /* Parse the cache control header */ |