Hi.<br>So I want request to fail if server certificate is self-signed.<br>I tried different options but no luck.<br><br>-module(tst).<br>-compile(export_all).<br><br>get(Url, Opt)-><br> case http:request(get, {Url, []}, Opt,[]) of <br>
{ok, {H,_Headers,_Response}} -><br> {ok , H};<br> O -> O<br> end. <br><br>g()-><br> inets:start(),<br> ssl:start(),<br> http:set_options([{max_<div class="gmail_quote">
sessions, 0}<br> ,{max_keep_alive_length, 0}<br>
% ,{verbose, verbose}<br> ]),<br> Opts = [[{ssl,[{verify, verify_peer}]}]<br> ,[{ssl,[{verify, verify_peer}]}]<br> ,[{ssl,[{verify, 2}]}]<br> ,[{ssl,[{verify, 1}]}]<br>
,[{ssl,[{verify, 0}]}] <br> ,[{ssl,[{verify, verify_peer}]}]<br> ],<br> io:format("~p~n",[[get("<a href="https://localhost/" target="_blank">https://localhost</a>", O) || O <- Opts]]), <br>
io:format("~p~n",[[get("<a href="http://../../" target="_blank">https://mail.google.com/mail/</a>", O) || O <- Opts]]), <br> init:stop().<br><br>Typical output:<br>[{error,{connect_failed,eoptions}},<br>
{error,{connect_failed,eoptions}},<br> {ok,{"HTTP/1.1",200,"OK"}},<br> {ok,{"HTTP/1.1",200,"OK"}},<br> {ok,{"HTTP/1.1",200,"OK"}},<br> {error,{connect_failed,eoptions}}]<br>
[{error,{connect_failed,eoptions}},<br> {error,{connect_failed,eoptions}},<br> {ok,{"HTTP/1.1",200,"OK"}},<br> {ok,{"HTTP/1.1",200,"OK"}},<br> {ok,{"HTTP/1.1",200,"OK"}},<br>
{ok,{"HTTP/1.1",200,"OK"}}]<br><br>Note the 'verify_peer' variant. It fails unregularly independеntly of certificate validity.<br>Erlang versions under consideration:<br>R13B03@default ubuntu<br>
R14B02@windows</div>