hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Connection Reset as a Proxy
Date Wed, 01 Jul 2009 14:40:11 GMT
On Tue, Jun 30, 2009 at 04:34:11PM +0300, Oz Levanon wrote:
> Hi.
> 
> I'm writing a server that acts as an HTTP Proxy, and I connect to the
> web using HttpClient (version 3.1)
> 
>  
> 
> From time to time I'm experiencing "Connection Reset" from the web. I
> guess this is because I try to reuse connections I have from previous
> requests, and (because too much time has passed), the website close the
> TCP connection, or some NAT dropped the TCP connection.
> 
>  
> 
> My question is how should I solve the problem in HTTP Client?
> 
> 1.       Should I set the sockets to work in keepAlive, maintaining the
> TCP connection? If so, how can I do that (I only found setSoTimeout
> methods, not setKeepAlive, and I can't access the socket itself, since
> the getSocket() method in HttpConnection are protected)?
> 
> 2.       Should I avoid using the same connection to a website as a
> proxy for different clients? If so, how can I do that (I'm using
> MultiThreadedHttpConnectionManager and it has no knowledge of the
> clients contacting me)?
> 
> 3.       Should I add a retry handler for such cases (and will it slow
> things down)?
> 
> 4.       Can I set some "session timeout" so that a socket will not
> outlive a preset duration (that way I can set a number low enough for
> any NATs on the way)?
> 
> 5.       Anything else?
> 

Oz,

Consider upgrading to HttpClient 4.0, which has a vastly improved connection
management API and code. For details see HttpClient tutorial:

http://wiki.apache.org/HttpComponents/HttpClientTutorial

Oleg

>  
> 
> Thanks in advance,
> 
> Oz
> 
>  
> 

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


Mime
View raw message