tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Whittington <>
Subject [PATCH] <jakarta-tomcat-connectors> Chunked transfer encoding for IIS
Date Thu, 09 Jun 2005 04:59:04 GMT
This patch adds chunked encoding for IIS responses - i.e. 
Transfer-Encoding: chunked responses for HTTP/1.1 clients - allowing IIS 
to maintain persistent connections to HTTP/1.1 clients through the ISAPI 

IIS hands a lot of the responsibility for HTTP protocol handling to the 
ISAPI extension - Apache is sooo much nicer to deal with.
IIS will keep connections alive if there is a Content-Length specified 
in the request, but won't do transfer encoding for requests that don't 
like Apache does.

Contents of the patch:
 - Added 'enable_chunked_encoding' param (bool) to enable chunked 
encoding (default is disabled)
 - Modified isapi_private_data_t to track whether chunked encoding is 
enabled per request
 - Modified start_response to:
    - Detect HTTP 1.1 clients and enable chunked encoding for the 
response (if the Tomcat response hasn't already precluded that)
    - Determine whether IIS should be told to keep the connection alive 
(IIS makes us manage this as well if we want to have the ability to keep 
    - Set the Transfer-Encoding: chunked header when used
    - Use the HSE_SEND_HEADER_EX_INFO/ServerSupportFunction API to allow 
us to tell IIS to keep the connections open
 - Factored the WriteClient calls into a new function (for the new write())
 - Added support in write() for writing a chunked encoded response chunk
 - Added a flush hook for IIS (with flush_packets false) to allow the 
chunked encoded terminator (the 0 chunk) to be written on response 

I'd consider the chunked encoding experimental at the moment - we're 
beta testing at the moment - which is why it's disabled by default.
We've run this against fairly complex web applications, with a mix of 
jsp, htm, xml, Content-Length, no Content-Length and some Connection: 
close behaviour, IE, Firefox etc.
All seems to work fine at the moment - chunked encoding isn't that 
complex - though IE does get confused if there are non-chunk-encoded 
files in the cache.
The only reported failure is when using Fiddler with an HTTP/1.0 client, 
though I suspect this is Fiddlers problem.
Straight HTTP/1.0 from IE works fine.

It'd be great to get this into the codebase and have people beta test it 
to see if if any problems show up.
Any problems are likely to be the result of incorrect negotiation of 
keep-alive or incorrect detection of responses from Tomcat that preclude 
using chunked encoding.


View raw message