[erlang-questions] confusing returns from httpc:request/4

Ingela Andin ingela.andin@REDACTED
Wed Oct 13 11:58:09 CEST 2010

2010/10/13 Chandru <chandrashekhar.mullaparthi@REDACTED>:
> On 13 October 2010 09:53, Ingela Andin <ingela.andin@REDACTED> wrote:
>> Hi!
>> The only reason that the httpc-client will return the value {error,
>> socket_closed_remotely}
>> is that the connection is prematurely  closed by the server.
>> Unfortunately  that something
>> is sent on a tcp socket does not mean it has been sent on the wire
>> yet, and depending on
>> the circumstances it is possible for the socket to be closed before
>> all data has been sent
>> so occasionally a tcp_close can come before all data is delivered.
>> When you use ibrowse do you verify that you always get a correct body?
>> (compleate body) from what I can tell from the code ibrowse will on a
>> tcp_closed  message always return whatever happens to be in the buffer
>> compleate or not.
> ibrowse does this only in the following cases:
>  * server returned a "Connection: Close"
>  * Server supports HTTP/0.9 or HTTP/1.0
> In all other cases, it returns an error to the caller.
> regards,
> Chandru

Well I do not know if any of these things is true in Dans senario. But
I do know that
getting the problem with a tcp close message before all data is
deliverd is a highly timing dependant problem
and if it happens in the server there is nothing inets-client or
ibrows can do about it except return an error.

Regards Ingela Erlang/OTP team - Ericsson AB

More information about the erlang-questions mailing list