[erlang-bugs] http client bug while getting zero-length response

Gunilla Arendt <>
Fri Mar 2 09:08:17 CET 2007


Thanks for the bug report.
We'll take a look at it as soon as possible.

Regards,
Gunilla, Erlang/OTP team

Igor Goryachev wrote:
> Hello everyone.
> 
> I've just found a bug in inets http-client (or somewhere in chunk decode
> routines). It is reproduced when a remote http-server sends zero-length
> response:
> 
> 
> :~% erl
> Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [hipe] [kernel-poll:false]
> 
> Eshell V5.5.3  (abort with ^G)
> 1> http:request(get, {"http://www.goryachev.org/", []}, [], []).
> 
> =INFO REPORT==== 27-Feb-2007::17:04:20 ===
> The inets application was not started. Has now been started as a temporary application.
> {error,session_remotly_closed}
> 2> 
> =ERROR REPORT==== 27-Feb-2007::17:05:36 ===
> ** Generic server <0.41.0> terminating 
> ** Last message in was {tcp_closed,#Port<0.114>}
> ** When Server state == {state,
>                          {request,
>                           #Ref<0.0.0.68>,
>                           <0.29.0>,
>                           0,
>                           http,
>                           {"www.goryachev.org",80},
>                           "/",
>                           [],
>                           get,
>                           {http_request_h,
>                            undefined,
>                            "keep-alive",
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            "www.goryachev.org",
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            [],
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            "0",
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            undefined,
>                            []},
>                           {[],[]},
>                           {http_options,infinity,true,[],undefined,false},
>                           "http://www.goryachev.org/",
>                           [],
>                           none,
>                           []},
>                          {tcp_session,
>                           {{"www.goryachev.org",80},<0.41.0>},
>                           false,
>                           http,
>                           #Port<0.114>,
>                           1},
>                          {"HTTP/1.1",200,"OK"},
>                          {http_response_h,
>                           undefined,
>                           "keep-alive",
>                           "Tue, 27 Feb 2007 14:03:13 GMT",
>                           undefined,
>                           undefined,
>                           "chunked",
>                           undefined,
>                           undefined,
>                           undefined,
>                           undefined,
>                           undefined,
>                           undefined,
>                           undefined,
>                           undefined,
>                           undefined,
>                           "nginx/0.5.11",
>                           "Accept-Encoding, Cookie",
>                           undefined,
>                           undefined,
>                           undefined,
>                           undefined,
>                           "-1",
>                           undefined,
>                           undefined,
>                           undefined,
>                           "text/html; charset=utf-8",
>                           undefined,
>                           undefined,
>                           []},
>                          undefined,
>                          {http_chunk,
>                           decode_data,
>                           [0,
>                            <<"\r\n">>,
>                            {nolimit,
>                             <<>>,
>                             0,
>                             nolimit,
>                             {200,
>                              {request,
>                               #Ref<0.0.0.68>,
>                               <0.29.0>,
>                               0,
>                               http,
>                               {"www.goryachev.org",80},
>                               "/",
>                               [],
>                               get,
>                               {http_request_h,
>                                undefined,
>                                "keep-alive",
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                "www.goryachev.org",
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                [],
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                "0",
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                undefined,
>                                []},
>                               {[],[]},
>                               {http_options,infinity,true,[],undefined,false},
>                               "http://www.goryachev.org/",
>                               [],
>                               none,
>                               []}}}]},
>                          {[],[]},
>                          new,
>                          [],
>                          nolimit,
>                          nolimit,
>                          {options,{undefined,[]},0,2,2,disabled,enabled,false},
>                          {timers,[],undefined}}
> ** Reason for termination == 
> ** session_remotly_closed
> 
> 
> This behaviour could be worked around using timeout param (i.e. {timeout, 10000}).
> 
> 
> 




More information about the erlang-bugs mailing list