[Fwd: http client hell]

Raimo Niskanen raimo@REDACTED
Wed Dec 8 08:47:01 CET 2004


You got the message {tcp_closed,Port}, so the http server closed the
connection for some reason, and it seems that the http client did
not expect this.

Don't ask me why, I hope someone with better http client knowledge 
will enlighten you.

blaguehubert@REDACTED (blaguehubert) writes:

> I'm trying to use the http:request function, but I randomly get this
> 
> horrible message before it crash my program:
> 
> *=ERROR REPORT==== 7-Dec-2004::23:39:22 ===
> ** Generic server <0.64.0> terminating
> ** Last message in was {tcp_closed,#Port<0.137>}
> ** When Server state == {state,{request,
>                                   #Ref<0.0.0.822>,
>                                   <0.114.0>,
>                                   0,
>                                   http,
>                                   {"perso.efrei.fr",80},
>                                   "/~colombi//",
>                                   [],
>                                   get,
>                                   {http_request_h,
>                                       undefined,
>                                       "keep-alive",
>                                       undefined,
>                                       undefined,
>                                       undefined,
>                                       undefined,
> 
> etc...
> 
> 
> 
> Here is my code :
> *
> req(Url) ->
> case (catch req(Url,10)) of
>        {ok, Body} ->
>                {ok, Body};
>        _ ->
>                error
>        end.
> 
> req(Url, NbTry) ->
> {ok, RequestId} = http:request(get, {Url, []}, [], [{sync, false}]),
> receive
> {http, {RequestId, Result}} ->
>        {N, Header, Body} = Result,
>        {ok, binary_to_list(Body)}
> after 60000 ->
>        if
>                NbTry) > 0 ->
>                        req(Url, NbEssais-1);
>                true ->
>                        error
>        end
> end.
> 
> Like you can see, I use catch statement and timeout because I thought
> it was only an exception, but it seems more serious...
> 
> 
> 

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list