netty/netty — pull request #380 by jamestyrrell (2012-06-03 11:33:04+00:00)
Title: Improve HTTP message streaming in decoder

Currently HttpMessageDecoder reads a HTTP message in chunks if the message's content length is specified and is larger than the max chunk size or if the content length isn't specified then if buffer's readable bytes is larger than the max chunk size. If either of those conditions are satisfied the content is added to the message and the message isn't artificially chunked. The problem with this is that the content of the message is stored in memory whilst waiting for an arbitrary threshold like max chunk size or the content length before forwarding on the content as a HttpChunk. In the case where the content length isn't specified the message's content is read, seemingly without bound, until the connection is closed.

It would be better if HttpChunks were forwarded on as soon as data was available to read, this would be especially beneficial in the cases where Netty is being used in a HTTP forwarding scenario. The pull request that is associated with this issue uses the ReplayingDecoder.actualReadableBytes() to read as much data as possible and forward it on as soon as possible.