From dba4500a80aa8e7d41b8fee99b60c0d2a1ed77bc Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Sun, 27 Jan 2013 13:49:17 +0000 Subject: [PATCH] Cache does no longer send Content-Type header for fresh content. Followup to r1361153+r1373447 (PR 53539, wrong Content-Type for stale content). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1439083 13f79535-47bb-0310-9956-ffa450edef68 --- modules/cache/mod_cache.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index c106aedba1..abee1e3663 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -604,9 +604,12 @@ static apr_status_t cache_out_filter(ap_filter_t *f, apr_bucket_brigade *in) apr_bucket_brigade *bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); - /* restore content type of cached response */ - ap_set_content_type(r, apr_table_get(cache->handle->resp_hdrs, - "Content-Type")); + /* restore content type of cached response if available */ + /* Needed especially when stale content gets served. */ + const char *ct = apr_table_get(cache->handle->resp_hdrs, "Content-Type"); + if (ct) { + ap_set_content_type(r, ct); + } /* restore status of cached response */ r->status = cache->handle->cache_obj->info.status;