[rfc][icedtea-web] disconnecting httpurlconnections
Andrew Azores
aazores at redhat.com
Fri May 2 14:42:07 UTC 2014
On 05/02/2014 10:25 AM, Omair Majid wrote:
> * Jiri Vanek <jvanek at redhat.com> [2014-05-02 09:34]:
>> I will elaborate a bit more, but if you may say few more words, it
>> would be nice:((
> Sorry, but I know next to nothing about this area. All I know is that
> Adam looked into it and decided that disconnect() is best avoided.
>
> Thanks,
> Omair
>
Maybe I'm just missing something but I really don't see how he came to
the conclusion that disconnect() should be avoided... the initial
problem seems to be that a new connection was being made and only the
response code being read, nothing else. The proposed solution was to do
this but then close the connection. The comment Adam refers to states
that rather than simply disconnecting after reading the response code,
the connection should actually do something - consume and discard it, or
simply use a HEAD request in the first place - so as to not confuse
these "mediocre" web servers (which presumably are expecting a GET
request to actually want the response body, so they hang on sending it
unless interrupted by a disconnect). Adam himself even says that it's
difficult to actually reuse connections, which is AFAICT the reason they
weren't disconnected to begin with. Why would it not be correct to both
(1) use HEAD request with consume/discard fallback, (2) disconnect when
finished, if the connection is not going to be reused later? As Jiri
says, is the overhead incurred by creating new connections really that
bad that we should deal with evidently flaky connection reuse?
Thanks,
--
Andrew A
More information about the distro-pkg-dev
mailing list