[Fwd: http client hell]

blaguehubert blaguehubert@REDACTED
Wed Dec 8 01:54:30 CET 2004


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...






More information about the erlang-questions mailing list