]> granicus.if.org Git - apache/commitdiff
Cache does no longer send Content-Type header
authorRainer Jung <rjung@apache.org>
Sun, 27 Jan 2013 13:49:17 +0000 (13:49 +0000)
committerRainer Jung <rjung@apache.org>
Sun, 27 Jan 2013 13:49:17 +0000 (13:49 +0000)
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

index c106aedba1558ce01768faa12c536a817199cbd9..abee1e3663a33a9931b80c64e43da8986816eb93 100644 (file)
@@ -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;