geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sangjin Lee" <>
Subject [AsyncHttpClient] protocol codec throws exception if Content-Length is not specified
Date Thu, 07 Feb 2008 01:16:16 GMT
While testing AHC against different servers, I encountered an interesting

I configured AHC not to reuse connections so connections get closed every
time.  When I pointed AHC to one server (based on Tomcat 5.5.25), the server
sent a response which was not chunked but Content-Length was missing.  The
server simply closed the connection to terminate the response.

This is not a good thing to do, but it is not exactly illegal either per
spec.  The RFC 2616 says the server closing the connection is one way of
determining the message body length.

HttpResponseDecoder makes an explicit assumption that you either have a
chunked response or Content-Length header must exist.  As a result, a
protocol decoder exception gets thrown eventually.

I think at least we should be able to handle a case where the server
terminates a response without specifying the Content-Length header, e.g. by
detecting the extra CRLF or by some other means.  Thoughts?


View raw message