From 6b175e597f2b2b386d3b3fbaadf4c2a62f0dd594 Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Tue, 30 May 2006 20:48:09 +0000 Subject: [PATCH] * Keep the Content-Type for successfully revalidated cached objects, by unsetting possible Content-Type headers in r->headers_out and r->err_headers_out as they may be different to what we have received from the cache. Actually they are not needed as r->content_type set by ap_set_content_type a few lines above will be used in the store_headers functions of the storage providers as a fallback and the HTTP_HEADER filter does overwrite the Content-Type header with r->content_type anyway. PR: 39647 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@410370 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/cache/cache_storage.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGES b/CHANGES index d5b66a3b84..e8e4843f6a 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] + *) mod_cache: Do not overwrite the Content-Type in the cache, for + successfully revalidated cached objects. PR 39647. [Ruediger Pluem] + *) mod_disk_cache: Delete temporary files if they cannot be renamed to their final name. [Davi Arnaut ] diff --git a/modules/cache/cache_storage.c b/modules/cache/cache_storage.c index bac7aa21e6..6e0a56228f 100644 --- a/modules/cache/cache_storage.c +++ b/modules/cache/cache_storage.c @@ -118,6 +118,17 @@ CACHE_DECLARE(void) ap_cache_accept_headers(cache_handle_t *h, request_rec *r, if (v) { ap_set_content_type(r, v); apr_table_unset(h->resp_hdrs, "Content-Type"); + /* + * Also unset possible Content-Type headers in r->headers_out and + * r->err_headers_out as they may be different to what we have received + * from the cache. + * Actually they are not needed as r->content_type set by + * ap_set_content_type above will be used in the store_headers functions + * of the storage providers as a fallback and the HTTP_HEADER filter + * does overwrite the Content-Type header with r->content_type anyway. + */ + apr_table_unset(r->headers_out, "Content-Type"); + apr_table_unset(r->err_headers_out, "Content-Type"); } /* If the cache gave us a Last-Modified header, we can't just -- 2.40.0