Error in http client

Ingela Anderton <>
Wed May 25 14:56:08 CEST 2005


Corrado Santoro wrote:
> Hi all,
> 
> I'm using the http client module of inets to realise an http proxy. When 
>   I invoke "http:request" I often receive the result:
> {error,session_remotly_closed}
>
> It seems that the remote site has closed the connection, but the strange 
> thing is that I receive such a reply when I issue a request to Google.
Which version of inets are you using?

Both 

http:request(get, {"http://www.google.com", []}, [], []).

and

http:request(get, {"http://www.google.se", []}, [], []).

works fine for me on the latest version, that is inets-4.4.1. However I do
not think this version made it to open source yet!

> Could someone explain the exact meaning of such a message.
It means that the socket was closed by the server and that this was
not expected. In some situations the server will close the
socket to indicate that that all data has been sent instead of using
a length header or chunked-encoding. (In that situation you will not
get an error, as then, it is expected that the socket can be closed.)

Google sends a length header:

7>  http:request(get, {"http://www.google.com", []}, [], []).
{ok,{{"HTTP/1.1",200,"OK"},
     [{"connection","Keep-Alive"},
      {"date","Wed, 25 May 2005 12:32:01 GMT"},
      {"server","GWS/2.1"},
      {"content-length","5170"},
      {"content-type","text/html"},
      {"cache-control","private"},
      {"set-cookie",
       "PREF=ID=4ab7f9cf7a993 ....

-- 
/Ingela - OTP team









More information about the erlang-questions mailing list