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 bounded download size
Date Tue, 13 Dec 2016 10:01:35 GMT
On Mon, 2016-12-12 at 17:47 -0500, Joseph Naegele wrote:
> Hi all, back again.
> 
> Now I'm wondering how to properly limit the number of bytes downloaded by the synchronous
HttpClient (v4.5, i.e. most recent versions).
> 
> Like the HttpAsyncClient, even if I only read the desired number of bytes from a response
entity's InputStream, closing the entity results in the remainder of the response entity being
downloaded from the connection. I found this in ContentLengthInputStream's close method, which
is wrapped by EofSensorInputStream.
> 
> Again, my goal is to intentionally collect a truncated response if it's larger than my
limit.
> 
> Thanks!
> Joe Naegele
> 

Call CloseableHttpResponse#close without closing the entity. 

Oleg


---------------------------------------------------------------------
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