erlang - lhttpc 客户端错误

标签 erlang

我尝试了 lhttpc 客户端并得到了奇怪的错误:

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,execute,9},
                 {lhttpc_client,request,9}]}
 in function  lhttpc:request/9

如您所见,我首先尝试执行 HEAD 请求并且一切正常,然后我发出 GET 请求但失败了。有没有人遇到过这个错误,也许有人知道如何修复它?

最佳答案

我解决了这个问题。看来这不是 lhttpc 库的错误,而是 Erlang 本身的错误。

似乎有时 erlang:decode_packet 函数在应该返回时没有返回 http_eoh

我使用从他们的 git 存储库克隆的 R14B04 Erlang,这可能是一个原因。我没有时间深入挖掘它,所以我自己修补了 lhttpc。

关于erlang - lhttpc 客户端错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7289327/

相关文章:

Erlang:在一组动态节点上进行作业调度

routes - 在Erlang中查找路由接口(interface)

erlang - gen_server 中引发的 Redis 异常

ubuntu - 如何增加rabbitmq的erlang进程?

node.js - erlang 和 nodejs 之间通过 tcp 传递的数据

erlang - gen_fsm 的唯一原子 :start/3 in Erlang

erlang - 我怎样才能在 Elixir 中摆脱 Enum.reduce

erlang - Erlang 中的快速可变对象

erlang - 在 mnesia 中获取和更新数据

erlang - 无法从 shell 生成 erlang 主管