Author: timw
Date: Mon Apr 11 08:23:46 2011
New Revision: 1090973
URL: http://svn.apache.org/viewvc?rev=1090973&view=rev
Log:
Suppressing sending of Content-Length header at all times that it shouldn't be
sent (Content-Length > 4GB and Transfer-Encoding:chunked).
IIS appears to provide a Content-Length header under some circumstances when
the chunk encoded request can be entirely decoded into the available buffer.
Fixes https://issues.apache.org/bugzilla/show_bug.cgi?id=50975
Modified:
tomcat/jk/trunk/native/iis/jk_isapi_plugin.c
Modified: tomcat/jk/trunk/native/iis/jk_isapi_plugin.c
URL:
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/iis/jk_isapi_plugin.c?rev=1090973&r1=1090972&r2=1090973&view=diff
==============================================================================
--- tomcat/jk/trunk/native/iis/jk_isapi_plugin.c (original)
+++ tomcat/jk/trunk/native/iis/jk_isapi_plugin.c Mon Apr 11 08:23:46 2011
@@ -3209,22 +3209,27 @@ static int init_ws_service(isapi_private
}
else if (!strnicmp(tmp, CONTENT_LENGTH,
sizeof(CONTENT_LENGTH) - 1)) {
- if (need_content_length_header) {
- need_content_length_header = FALSE;
- /* If the content-length is unknown
- * or larger then 4Gb do not send it.
- */
- if (unknown_content_length || s->is_chunked) {
- if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG,
- "Header Content-Length is %s",
- s->is_chunked ? "chunked" : "unknown");
- }
- real_header = JK_FALSE;
+ need_content_length_header = FALSE;
+
+ /* If the content-length is unknown
+ * or larger then 4Gb do not send it.
+ * IIS can also create a synthetic Content-Length header
to make
+ * lpcbTotalBytes and the CONTENT_LENGTH server variable
agree
+ * on small requests where the entire chunk encoded
message is
+ * read into the available buffer.
+ */
+ if (unknown_content_length || s->is_chunked) {
+ if (JK_IS_DEBUG_LEVEL(logger)) {
+ jk_log(logger, JK_LOG_DEBUG,
+ "Disregarding Content-Length in request -
content is %s",
+ s->is_chunked ? "chunked" : "unknown
length");
}
+ cnt--;
+ real_header = JK_FALSE;
}
- if (real_header)
+ else {
s->headers_names[i] = tmp;
+ }
}
else if (!strnicmp(tmp, TOMCAT_TRANSLATE_HEADER_NAME,
strlen(TOMCAT_TRANSLATE_HEADER_NAME))) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]