On Wed, Apr 29, 2015 at 2:46 PM, Eric Covener <cove...@gmail.com> wrote: > On Wed, Apr 29, 2015 at 8:19 AM, Yann Ylavic <ylavic....@gmail.com> wrote: >> Hence how about removing this whole block (is there any module today >> "outsmarting" httpd that cannot be considered as buggy?) or least >> disable it for forwarded responses, eg: >> >> Index: modules/http/http_filters.c >> =================================================================== >> --- modules/http/http_filters.c (revision 1676716) >> +++ modules/http/http_filters.c (working copy) >> @@ -1292,6 +1292,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_heade >> * The default (unset) behavior is to squelch the C-L in this case. >> */ >> if (r->header_only >> + && !r->proxyreq >> && (clheader = apr_table_get(r->headers_out, "Content-Length")) >> && !strcmp(clheader, "0") >> && conf->http_cl_head_zero != AP_HTTP_CL_HEAD_ZERO_ENABLE) { > > > Maybe we could remember here if the CL was set by > ap_content_length_filter or someone else? >
Yes, I first thought about this, hence checking r->clength instead, but that would probably require to initialize it to something like UNSET (-1), or we still could not distinguish it from a zero length set... That would be: Index: modules/http/http_core.c =================================================================== --- modules/http/http_core.c (revision 1676716) +++ modules/http/http_core.c (working copy) @@ -254,6 +254,9 @@ static int ap_process_http_connection(conn_rec *c) static int http_create_request(request_rec *r) { + /* Content-Length unset by default. */ + r->clength = -1; + if (!r->main && !r->prev) { ap_add_output_filter_handle(ap_byterange_filter_handle, NULL, r, r->connection); Index: modules/http/http_filters.c =================================================================== --- modules/http/http_filters.c (revision 1676716) +++ modules/http/http_filters.c (working copy) @@ -1292,6 +1292,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_heade * The default (unset) behavior is to squelch the C-L in this case. */ if (r->header_only + && (r->clength < 0) && (clheader = apr_table_get(r->headers_out, "Content-Length")) && !strcmp(clheader, "0") && conf->http_cl_head_zero != AP_HTTP_CL_HEAD_ZERO_ENABLE) { --