hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurent Perez <hak...@gmail.com>
Subject Does HttpClient v3 handle Keep-Alive properly ? (code analysis and description inside)
Date Tue, 15 Jun 2010 16:37:48 GMT

I'm trying to understand if the v3, which my application currently
uses, handles Keep-Alive properly - because our client says it does

On several requests, using lsof, I can see that httpclient connections
in state ESTABLISHED gradually fall back to a CLOSE_WAIT state, and
they also stay in this state, unless I explicitely call
A question : if Keep-Alive was working properly, should the
connections stay in ESTABLISHED forever ?

By looking at the source,
looks correct, we are using HTTP/1.1, it implies connections are
However, org.apache.commons.httpclient.HttpConnection#closeIfStale
seems to think connections are staled, hence closing them, so it's not
reusing them. I don't understand the
org.apache.commons.httpclient.HttpConnection#isStale part, with
socket.setSoTimeout(1);/inputStream.mark(1);/inputStream.read() : why
is the timeout set to 1 and how would it affect the read ?

Is the stale checking code broken in v3, breaking connections reuse ?
I've read the Connection keep alive strategy chapter at
and I can't figure out if v4 fixes it or not : if v4 assumes it can
keep the connection forever, will it still do a stale check ?

Thanks for your input

<a href="http://blog.jdeuxe.info/">http://blog.jdeuxe.info/ - Java
entreprise tips & tricks</a>

To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message