commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ortwin Gl├╝ck" <>
Subject Re: [HttpClient] Retriving an unbuffered stream
Date Mon, 26 Aug 2002 12:27:28 GMT
I am trying to get a patch ready for this issue.

However I'd like to point out a subtle problem that comes up along the 
way: Who is responsible for closing the socket?

Because if we do not buffer the response, we can not close the socket 
until the response is fully read. Moreover the socket must only be 
closed if the connection is not keep-alive.

In my opinion the stream should handle the closing of the connection:
Create a AutoClosingInputStream extends FilterInputStream that is used 
to close the socket after the end of the stream is reached. It is only 
used if this behaviour is desired. Disadvantage is the small performance 
penalty. Better ideas?

More problems may arise if the user set a SO_TIMEOUT on the socket. What 
happens if the user does not read the response stream for the duration 
of the timeout? Will the socket close itself down and so break the 

Comments appreciated.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message