Hi,
I just debugged a case where Apache used as reverse proxy filters a
text/javascript file through mod_proxy_html and mod_xml2enc. As
mod_proxy_html sees no business in filtering that file, it removes
itself from the filter chain, but mod_xml2enc still tries to do its job.
In course of mod_xml2enc's processing, the file grows a few bytes due to
some charset conversions. But as the original server sends a
Content-Length header which is not removed by mod_xml2enc, no more than
the original length of the file is sent to the client.
The attached patch based on httpd-trunk fixes that issue by removing the
Content-Length header entirely. Please review it. I would appreciate it,
if it could get applied to trunk and then backported to the httpd-2.4.x
branch.
Regards,
Micha
Index: modules/filters/mod_xml2enc.c
===================================================================
--- modules/filters/mod_xml2enc.c (revision 1405021)
+++ modules/filters/mod_xml2enc.c (working copy)
@@ -370,6 +370,9 @@
/* nah, we only have one action here - call it inline */
fix_skipto(f->r, ctx);
+ /* we might change the Content-Length, so let's force its re-calculation */
+ apr_table_unset(f->r->headers_out, "Content-Length");
+
/* consume the data we just sniffed */
/* we need to omit any <meta> we just invalidated */
ctx->flags |= ENC_INITIALISED;