On Tue, May 7, 2013 at 4:15 PM, Albretch Mueller <[email protected]> wrote:

>  1) even if, since all I need are the headers, for which I "only" need to
> go:
>
>   Header[] RspnsHdrs = httpResponse.getAllHeaders();
> // __ closing underlying stream (just getting all HTTP headers for
> this URL's connection)
>  InputStream IS = httpEnt.getContent();
>  IS.close();
>
>  the InputStream is taking like a minute to actually close. Why is
> that happening?
>
>  It seems once you go "GET ..." the server does as you tell it and
> sends the data anyway, which seems to be patiently swallowed by HC,
> even if the data is not saved to local storage
>
>  Is there a way to just get the headers and the negotiation without
> the actual payload? (like the spider option of wget)
>

A HEAD request, instead of GET, should return just the headers. Although
I'm not a 100% sure about that... the server might still be allowed to
respond with a body for a HEAD request.

Either way, use EntityUtils.consumeQuietly(ent) is the best way to handle
unwanted entity content. Just closing the input stream is a little rude.

Reply via email to