开发者

lhttpc client error

I tried lhttpc client and got strange error:

7> lhttpc:request("https://money.yandex.ru",head,[],infinity).
{ok,{{200,"OK"},
 [{"Server","lighttpd/1.4.26"},
  {"Date","Fri, 02 Sep 2011 20:29:02 GMT"},
  {"Expires","Fri, 02 Sep 2011 20:29:02 GMT"},
  {"Content-Type","text/html; charset=windows-1251"},
  {"Cache-Control","max-age=0, proxy-revalidate"}],
 <<>>}}
8> lhttpc:request("https://money.yandex.ru",get,[],infinity). 
** exception exit: {{case_clause,{ok,<<"\r\n">>}},
                [{lhttpc_client,read_trailers,4},
                 {lhttpc_client,read_chunked_body,4},
                 {lhttpc_client,handle_response_body,4},
                 {lhttpc_client,read_response,4},
                 {lhttpc_client,ex开发者_JS百科ecute,9},
                 {lhttpc_client,request,9}]}
 in function  lhttpc:request/9

As you can see I firstly tried to perform a HEAD request and it went ok, and then I made a GET request and it failed. Did anyone come across this bug and maybe somebody do know how to fix it?


I solved this problem. It seems that it's not the error of lhttpc library but Erlang itself.

It seems that sometimes erlang:decode_packet function does not return http_eoh when it should.

I use R14B04 Erlang cloned from their git repository, may be that was a reason. I've no time to dig it deeper so I patched lhttpc itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜