httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <>
Subject Re: Apache add content-length
Date Thu, 10 Dec 2015 00:01:21 GMT
On 2015-12-09 15:02, Pechoultres Xavier wrote:
> Hi everybody,
> 	I wrote an apache (2.2.x) module for special c++ app. It works fine for many years but
a problem resist to me.
> Apache automatically add a content-length header even I send a Transfer-Encoding: chunked
> I set Transfer-Encoding: chunked in cgi module, I’m sure I do not set a content-length
> I unset Content-length in my module :  apr_table_unset(r->headers_out, "Content-Length
> I’ve tried lot of stuff without success, and Apache always add a content-length. This
create bug with recent WebCore application.
> If somebody can give me the light !

I've checked the sources of the apache server. Apache adds some filters 
to the request processing chain, two of them being 
ap_content_length_filter and ap_http_header_filter. 
ap_content_length_filter executes before ap_http_header_filter.

ap_content_length_filter sets the Content-Length header if it can 
determine the size of the response body. ap_http_header_filter sets 
r->chunked only if the Content-Length header is not set. The response is 
chunked and the "Transfer-Encoding: chunked" header is set only if 
r->chunked = 1.

In short: if apache can determine the size of the response message then 
you cannot force it to send "Transfer-Encoding: chunked" and it will 
always set the Content-Length header.


View raw message