From 69c7b9eea935a21a01b9923ba0a6370cc3d31476 Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Wed, 3 May 2006 19:34:35 +0000 Subject: [PATCH] * Add Content-Type to headers_out if not already set. This ensures that the Content-Type of the cached entity gets restored correctly. PR: 39266 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@399388 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/cache/mod_mem_cache.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGES b/CHANGES index 2c7fcdc9bdc..995e42b09e4 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_mem_cache: Set content type correctly when delivering data from + cache. PR 39266. [Ruediger Pluem] + *) worker and event MPMs: fix excessive forking if fork() or child_init take a long time. PR 39275. [Greg Ames, Jeff Trawick, Chris Darroch ] diff --git a/modules/cache/mod_mem_cache.c b/modules/cache/mod_mem_cache.c index 0b108374abd..645c782b32f 100644 --- a/modules/cache/mod_mem_cache.c +++ b/modules/cache/mod_mem_cache.c @@ -690,6 +690,14 @@ static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info /* Precompute how much storage we need to hold the headers */ headers_out = ap_cache_cacheable_hdrs_out(r->pool, r->headers_out, r->server); + + /* If not set in headers_out, set Content-Type */ + if (!apr_table_get(headers_out, "Content-Type") + && r->content_type) { + apr_table_setn(headers_out, "Content-Type", + ap_make_content_type(r, r->content_type)); + } + headers_out = apr_table_overlay(r->pool, headers_out, r->err_headers_out); rc = serialize_table(&mobj->header_out, &mobj->num_header_out, -- 2.47.2