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

Chandru chandrashekhar.mullaparthi@REDACTED
Wed Oct 13 11:05:04 CEST 2010


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


More information about the erlang-questions mailing list