new_ssl in R13B03

Filipe David Manana <>
Fri Sep 17 01:18:53 CEST 2010


Hello,

I'm trying to use the new_ssl module in R13B03.

In the ssl:connect call I pass the options {ssl_imp, new} and {verify, 0}.

However I get the error:

=ERROR REPORT==== 16-Sep-2010::23:47:07 ===
SSL: certify_certificate: ./ssl_handshake.erl:486:Fatal error:
handshake_failure
** exception error: no match of right hand side value {error,esslconnect}
    in function  ssl_test:test/0

Tried as well passing {verify, verify_none} and {fail_if_no_peer_cert,
false} instead of {verify, 0} (since they're mentioned in the man page for
new_ssl module) but doesn't work either:

** exception exit: badarg
    in function  gen_tcp:connect/4
    in call from ssl:do_new_connect/4
    in call from ssl_test:test/0

I need to get my code running on at least R13B03.
The code is:

-module(ssl_test).
-compile(export_all).

test() ->
   Body = iolist_to_binary([
       "GET / HTTP/1.1\r\n",
       "Host: foo.bar.com\r\n",
       "Accept: */*\r\n",
       "Connection: close\r\n", "\r\n"
   ]),
   application:start(crypto),
   application:start(public_key),
   application:start(ssl),
   Options = [
               {ssl_imp, new},
               binary,
               {nodelay, true},
               {active, false},
               {verify, 0}
               % {reuse_sessions, false},
               % {ciphers, ssl:cipher_suites(erlang)}
   ],
   {ok, S} = ssl:connect("foo.bar.com", 443, Options),
   ok = ssl:send(S, Body),
   loop(S),
   ssl:close(S).

loop(S) ->
   ssl:setopts(S, [{active, once}]),
   receive
   {ssl, _, Data} ->
       io:format("received data:  ~p~n", [Data]),
       loop(S);
   {ssl_closed, _} ->
       io:format("socket closed", []);
   {ssl_error, _, Error} ->
       io:format("socket error:  ~p", [Error])
   end.


Am I missing something?
cheers

-- 
Filipe David Manana,
, 

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."


More information about the erlang-questions mailing list