Hi,

I just checked in my implementation of chunked encoding in tntnet.

To use chunked encoding a component can call 
"reply.setChunkedEncoding()". This call sends the http headers and 
starts sending the content collected so far to the client immediately. 
All content created after that is sent in chunks to the client as soon 
as the buffer is filled. The buffer is hard coded 8k big. Calling 
flush() on the stream (reply.out().flush()), sends all content collected 
so far.

The advantage of using chunked encoding is, that content is sent 
immediately to the client and for large components less memory is used 
since the content do not need to be held in memory. The downside is, 
that it is not possible to set additional reply headers in that request 
after chunked encoding is enabled since the headers are already sent to 
the client. This includes session cookies set by tntnet itself when the 
request runs in a new session. Also no exception must occur since tntnet 
has no chance to reply with a internal server error after it has started 
sending the http reply with a http ok return code.

I tested the code using a test component with firefox and curl. I have 
problems with ab (apache bench). It hangs when large components are 
requested with chunked encoding and keep alive enabled. It looks like ab 
expects something but I don't know what. The protocol looks fine and 
currently I have no idea, why ab do not work.


Tommi

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to