curl 返回结果为空,但是相同的url在浏览器上正常返回
可能原因是erlang 编写的http服务器返回结果没有添加http头。
将内容添加Http头代码如下
encode_http_bin(List) ->
Head = io_lib:format("HTTP/1.1 200 OK\r\n" "Content-Type: text/plain\r\n" "Content-Length: ~p\r\n\r\n, lenght(List)),
<<(list_to_binary(Head))/binary, (list_to_binary(List))/binary>>.