https://issues.apache.org/bugzilla/show_bug.cgi?id=53539
--- Comment #9 from Rainer Jung <[email protected]> --- (In reply to comment #8) > (In reply to comment #6) > > (In reply to comment #5) > > > Some more information: > > > > > > 1) Reproduction > > > =============== > > > > > > I can easily reproduce with 2.4.x head using > > > > > > > Have you checked with or without r1361153? > > Ok forget this. Should have read more carefully through your analysis. How > about: > > Index: http_protocol.c > =================================================================== > --- http_protocol.c (revision 1373239) > +++ http_protocol.c (working copy) > @@ -1221,18 +1221,21 @@ > r->content_encoding = NULL; > r->clength = 0; > > - if (apr_table_get(r->subprocess_env, > - "suppress-error-charset") != NULL) { > - core_request_config *request_conf = > - ap_get_core_module_config(r->request_config); > - request_conf->suppress_charset = 1; /* avoid adding default > - * charset later > - */ > - ap_set_content_type(r, "text/html"); > + /* Only set content type if none is already set, e.g. by mod_cache > */ > + if (!r->content_type) { > + if (apr_table_get(r->subprocess_env, > + "suppress-error-charset") != NULL) { > + core_request_config *request_conf = > + ap_get_core_module_config(r->request_config); > + request_conf->suppress_charset = 1; /* avoid adding default > + * charset later > + */ > + ap_set_content_type(r, "text/html"); > + } > + else { > + ap_set_content_type(r, "text/html; charset=iso-8859-1"); > + } > } > - else { > - ap_set_content_type(r, "text/html; charset=iso-8859-1"); > - } > > if ((status == HTTP_METHOD_NOT_ALLOWED) > || (status == HTTP_NOT_IMPLEMENTED)) { > > Another option would be to let mod_cache set someting into r->note and do > not set the content type if found. Both would work, but: to me it seems the problem is something else: this content type setting code in ap_send_error_response() is part of a bigger block, that actually prepares for sending out a standard or customized error page. When reproducing the problem the code runs through all of the error page construction further down although we had already inserted the cached normal page. That error page does not go through to the client but instead is later replaced by the mod_cache OUT filter with the cached content. So fix 1 would be setting the content type in this OUT filter: Index: modules/cache/mod_cache.c =================================================================== --- modules/cache/mod_cache.c (revision 1373297) +++ modules/cache/mod_cache.c (working copy) @@ -573,6 +573,10 @@ 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 status of cached response */ r->status = cache->handle->cache_obj->info.status; I checked it would work. Fix 2 would be to shortcut ap_send_error_response() due to some marker a filter or module could set to indicate, that it is going to provide the error page itself. I guess there is no such mechanism defined at the moment so I would prefer to use Fix 1 on the short hand. For trunk it would be nice if we could define an enhancement like proposed as Fix 2. Regards, Rainer -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
