https://bz.apache.org/bugzilla/show_bug.cgi?id=64775
Bug ID: 64775 Summary: mod_jk is sending both Content-Length and Transfer-Encoding Product: Tomcat Connectors Version: unspecified Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P2 Component: mod_jk Assignee: dev@tomcat.apache.org Reporter: s...@daemoninc.com Target Milestone: --- Our application uses "Transfer Encoding: chunked" and it started to hang after upgrading mod_jk from 1.2.37 to 1.2.39. It's still broken in 1.2.48. Looking at the headers it's because mod_jk is sending both of the following: Transfer-Encoding: chunked Content-Length: 0 Our app is assuming the content is zero-length and stops reading. In 1.2.37 both headers were present but Content-Length was empty instead of zero, which our app had been ignoring. Transfer-Encoding: chunked Content-Length: According to the HTTP spec the web server should never send both of these headers in the same response. It looks like the patch in r1549202 started sending a numeric Content-Length instead of an empty one which is when it broke for us. The following patch checks if the Content-Length is empty and if so doesn't sent the header at all. With this patch I only see the Transfer-Encoding header and no Content-Length. --- tomcat-connectors-1.2.48-src.orig/native/apache-2.0/mod_jk.c 2020-02-20 11:43:15.000000000 -0500 +++ tomcat-connectors-1.2.48-src/native/apache-2.0/mod_jk.c 2020-09-18 10:56:14.564911842 -0400 @@ -395,7 +395,9 @@ apr_table_set(r->headers_out, header_names[h], header_values[h]); } else if (!strcasecmp(header_names[h], "Content-Length")) { - ap_set_content_length(r, apr_atoi64(header_values[h])); + if (strlen(header_values[h]) > 0) { + ap_set_content_length(r, apr_atoi64(header_values[h])); + } } else if (!strcasecmp(header_names[h], "Transfer-Encoding")) { apr_table_set(r->headers_out, header_names[h], header_values[h]); -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org