Index: modules/proxy/proxy_http.c =================================================================== --- modules/proxy/proxy_http.c (revision 193172) +++ modules/proxy/proxy_http.c (working copy) @@ -1201,8 +1201,24 @@ return r->status; } else { + const char *buf; + + /* can't have both Content-Length and Transfer-Encoding */ + if (apr_table_get(r->headers_out, "Transfer-Encoding") + && apr_table_get(r->headers_out, "Content-Length")) { + /* 2616 section 4.4, point 3: "if both Transfer-Encoding + * and Content-Length are received, the latter MUST be + * ignored"; so unset it here to prevent any confusion + * later. */ + apr_table_unset(r->headers_out, "Content-Length"); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, + r->server, + "proxy: server %s returned Transfer-Encoding and Content-Length", + p_conn->name); + p_conn->close += 1; + } + /* strip connection listed hop-by-hop headers from response */ - const char *buf; p_conn->close += ap_proxy_liststr(apr_table_get(r->headers_out, "Connection"), "close");