Request for Review 6886723: light weight http server doesn't return correct status code for HEAD requests

Chris Hegarty chris.hegarty at oracle.com
Mon Apr 26 02:54:51 PDT 2010


Hi Michael,

The HttpExchange implementation, sun.net.httpserver.ExchangeImpl, does 
not correctly handle HEAD requests. The test, described in the 
'description section' of 6886723, invokes sendResponseHeaders with a 0 
responseLength, i.e. chunked encoding. The "Transfer-encoding: chunked" 
header should be added to the response headers but no 
ChunkedOutputStream should be created. The current implementation does 
send an empty chunk causing subsequent requests on the same persistent 
connection to have problems.

The solution is to correctly set response headers, but create no 
corresponding OutputStreams when dealing with HEAD requests.

Webrev:
   http://cr.openjdk.java.net/~chegar/6886723/webrev.00/webrev/

Thanks,
-Chris



More information about the net-dev mailing list