diff options
author | Ingela Andin <[email protected]> | 2018-08-20 13:19:34 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2018-08-20 13:19:34 +0200 |
commit | 4197110f6811de1677f167e6ffd4efc54c807f0c (patch) | |
tree | 52b57771334307eff4782e5c283ecd0e5b5cc8dc | |
parent | 282ccae87d9629499d3f1669d72484ff27df663f (diff) | |
parent | 87721a511f2c9c5cc3ebb81804bc52191c280bdf (diff) | |
download | otp-4197110f6811de1677f167e6ffd4efc54c807f0c.tar.gz otp-4197110f6811de1677f167e6ffd4efc54c807f0c.tar.bz2 otp-4197110f6811de1677f167e6ffd4efc54c807f0c.zip |
Merge pull request #1901 from getong/fix_ssl_example
Modernized example
-rw-r--r-- | lib/ssl/examples/src/client_server.erl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/ssl/examples/src/client_server.erl b/lib/ssl/examples/src/client_server.erl index c150f43bff..7a266f544d 100644 --- a/lib/ssl/examples/src/client_server.erl +++ b/lib/ssl/examples/src/client_server.erl @@ -39,15 +39,15 @@ start() -> %% Accept {ok, ASock} = ssl:transport_accept(LSock), - ok = ssl:ssl_accept(ASock), + {ok, SslSocket} = ssl:handshake(ASock), io:fwrite("Accept: accepted.~n"), - {ok, Cert} = ssl:peercert(ASock), + {ok, Cert} = ssl:peercert(SslSocket), io:fwrite("Accept: peer cert:~n~p~n", [public_key:pkix_decode_cert(Cert, otp)]), io:fwrite("Accept: sending \"hello\".~n"), - ssl:send(ASock, "hello"), - {error, closed} = ssl:recv(ASock, 0), + ssl:send(SslSocket, "hello"), + {error, closed} = ssl:recv(SslSocket, 0), io:fwrite("Accept: detected closed.~n"), - ssl:close(ASock), + ssl:close(SslSocket), io:fwrite("Listen: closing and terminating.~n"), ssl:close(LSock), @@ -75,7 +75,7 @@ mk_opts(Role) -> [{active, false}, {verify, 2}, {depth, 2}, + {server_name_indication, disable}, {cacertfile, filename:join([Dir, Role, "cacerts.pem"])}, {certfile, filename:join([Dir, Role, "cert.pem"])}, {keyfile, filename:join([Dir, Role, "key.pem"])}]. - |