From: Rainer Jung Date: Sun, 27 Jan 2013 16:32:00 +0000 (+0000) Subject: mod_cache does no longer send Content-Type header X-Git-Tag: 2.4.4~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4361631ed956413b7a4a458132fb111123bbb52b;p=apache mod_cache does no longer send Content-Type header for fresh content. Followup to trunk r1361153+r1373447 resp. 2.4.x r1373115+r1393191 (PR 53539, wrong Content-Type for stale content). Backport of r1439083 from trunk. No CHANGES needed, because problem was introduced after 2.4.3. Submitted by: rjung Backported by: rjung Reviewed by: rjung, covener, minfrin git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1439113 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 492a09f189..1014c51985 100644 --- a/STATUS +++ b/STATUS @@ -100,7 +100,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: http://mail-archives.apache.org/mod_mbox/httpd-dev/201301.mbox/%3C20130103112044.GA19653%40redhat.com%3E kbrand: configure option added in r1429228 - * mod_status: Add useful mod_status info... try to determine last time a specific vhost was accessed/used. trunk patch: https://svn.apache.org/viewvc?view=revision&revision=1417529 @@ -137,19 +136,12 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: 2.4.x patch: http://people.apache.org/~jailletc36/backport4.patch +1: jailletc36, rjung, covener - * Speed-up 'ap_fputs'. This change is just the inline version of what is remaining in apr_brigade_puts() after http://svn.apache.org/viewvc?view=revision&revision=1402870 trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1409437 2.4.x patch: trunk patches works +1: jailletc36, rjung, covener - * mod_cache: Cache does no longer send Content-Type header for fresh content. - Followup to r1361153+r1373447 (PR 53539, wrong Content-Type for stale content). - trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1439083 - 2.4.x patch: trunk patches works - +1: rjung, covener, minfrin - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index 30b51cc408..4f2d3e0468 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -573,9 +573,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;