如何在erlang中的http客户端(httpc)中禁用SSL对等验证

如何在erlang中的http客户端(httpc)中禁用SSL对等验证,ssl,https,erlang,ca,Ssl,Https,Erlang,Ca,我通过http客户端发送了一个restfull api请求,但出现以下错误: {error,{failed_connect,[{to_address,{"https://example.com",443}}, {inet,[inet],{tls_alert,"record overflow"}}]}} 我发现SSL对等验证造成了这个问题。如何禁用它 我的代码: test() -> inets:start(), ssl:start(), RequestBody = "",

我通过http客户端发送了一个restfull api请求,但出现以下错误:

{error,{failed_connect,[{to_address,{"https://example.com",443}},
{inet,[inet],{tls_alert,"record overflow"}}]}}
我发现SSL对等验证造成了这个问题。如何禁用它

我的代码:

test() ->
   inets:start(),
   ssl:start(),
   RequestBody = "",
   Request = {"https://example.com", [{"X-API-CODE",""}, {"Accept","application/json"}, {"access-token",""}], "application/json", RequestBody},
   {ok, {_, _, ResponseBody}} = httpc:request(post, Request, [], []),
   io:format("~st", [ResponseBody]).

尽管禁用验证不是一个好主意,但是可以通过在选项中使用
{ssl,[{verify,verify\u none}]}
来实现。 例子: httpc:request(get,{code>https://revoked.badssl.com/“,[]},[{ssl,[{verify,verify_none}]}],][])。