Bug 50363 - Chunked encoding is applied to 304 responses with no bodies
Summary: Chunked encoding is applied to 304 responses with no bodies
Status: RESOLVED FIXED
Alias: None
Product: Tomcat Connectors
Classification: Unclassified
Component: isapi (show other bugs)
Version: 1.2.30
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-29 05:42 UTC by Tim Whittington
Modified: 2010-11-29 13:39 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Whittington 2010-11-29 05:42:00 UTC
When the ISAPI redirector processes a response to a 304 (or 204/205) response with chunked encoding enabled, and a Content-Length is not specified, chunked encoding is applied to the empty body, which created an invalid response.

Under normal operation (e.g. DefaultServlet responses), the closing of the output buffer writes a Content-Length: 0 to the response, which the AJP connectors don't try to remove for 304 etc. responses (the HTTP connectors do). This results in 304 responses with Content-Length: 0 headers, which is valid (if quirky).

This issue can be reproduced by setting a 304 response status and explicitly calling response.flushBuffer() to commit the response prior to closing the output buffer.

The ISAPI Redirector also isn't handling a similar case for HEAD requests.
Comment 1 Tim Whittington 2010-11-29 05:45:33 UTC
Fixed in trunk - will be released in 1.2.32.