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: HttpClient write timeout
Date Sat, 11 Apr 2015 16:52:36 GMT
On Fri, 2015-04-10 at 22:58 -0700, natl wrote:
> As mentioned in
> http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201206.mbox/%3C1339619106.2755.17.camel@ubuntu%3E,
> I understand that HttpClient does not have write timeout. However, I ran
> into a situation when I upload a large file to a bad written service where
> if it cannot read the data with a specific time, it will write the response
> back to the client with 408 timeout. However, it will stop reading more data
> from the client. This causes Entity.writeTo(OutputStream) to get stuck even
> though the response has been received. I wonder whether there is any good
> workaround to this one apart from interrupting the thread based on the the
> content length. I'd rather prefer the mechanism similar to
> socket.setSoTimeout() where the call will fail as soon as a write cannot be
> completed within a specific timeframe. 
> One thing I notice is that SocketOutputStream.write / SocketInputStream.read
> cannot be interrupted. So even though you have another thread waiting for
> timeout and then trying to interrupt the thread, you won't be able to do so
> with Socket API. 
> Thanks, 

Try using the async version of HttpClient which can handle out of
sequence response messages 



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

View raw message