aboutsummaryrefslogtreecommitdiffstats
path: root/test/acceptor_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2022-10-07 11:46:26 +0200
committerLoïc Hoguin <[email protected]>2022-10-07 11:46:26 +0200
commite4720fc629ac056b1b9ec53a46a7af8aeaa43458 (patch)
tree2f555fe5ca6f69cba776fd1b74aefa3e80d0bd16 /test/acceptor_SUITE.erl
parent48476b475b4fed098ba75ab7574d3b451231dede (diff)
downloadranch-e4720fc629ac056b1b9ec53a46a7af8aeaa43458.tar.gz
ranch-e4720fc629ac056b1b9ec53a46a7af8aeaa43458.tar.bz2
ranch-e4720fc629ac056b1b9ec53a46a7af8aeaa43458.zip
Update for OTP-25+
Diffstat (limited to 'test/acceptor_SUITE.erl')
-rw-r--r--test/acceptor_SUITE.erl37
1 files changed, 22 insertions, 15 deletions
diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl
index 16fba78..851add3 100644
--- a/test/acceptor_SUITE.erl
+++ b/test/acceptor_SUITE.erl
@@ -731,7 +731,8 @@ ssl_active_echo(_) ->
ranch_ssl, Opts,
active_echo_protocol, []),
Port = ranch:get_port(Name),
- {ok, Socket} = ssl:connect("localhost", Port, [binary, {active, false}, {packet, raw}]),
+ {ok, Socket} = ssl:connect("localhost", Port,
+ [binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
ok = ssl:send(Socket, <<"SSL Ranch is working!">>),
{ok, <<"SSL Ranch is working!">>} = ssl:recv(Socket, 21, 1000),
ok = ranch:stop_listener(Name),
@@ -756,7 +757,8 @@ do_ssl_active_n_echo() ->
ranch_ssl, Opts,
batch_echo_protocol, [{batch_size, 3}]),
Port = ranch:get_port(Name),
- {ok, Socket} = ssl:connect("localhost", Port, [binary, {active, false}, {packet, raw}]),
+ {ok, Socket} = ssl:connect("localhost", Port,
+ [binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
ok = ssl:send(Socket, <<"One">>),
{ok, <<"OK">>} = ssl:recv(Socket, 2, 1000),
ok = ssl:send(Socket, <<"Two">>),
@@ -778,7 +780,8 @@ ssl_echo(_) ->
ranch_ssl, Opts,
echo_protocol, []),
Port = ranch:get_port(Name),
- {ok, Socket} = ssl:connect("localhost", Port, [binary, {active, false}, {packet, raw}]),
+ {ok, Socket} = ssl:connect("localhost", Port,
+ [binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
ok = ssl:send(Socket, <<"SSL Ranch is working!">>),
{ok, <<"SSL Ranch is working!">>} = ssl:recv(Socket, 21, 1000),
ok = ranch:stop_listener(Name),
@@ -800,12 +803,12 @@ ssl_handshake(_) ->
handshake_protocol, #{"ranch1" => Opts1, "ranch2" => Opts2}),
Port = ranch:get_port(Name),
{ok, Socket1} = ssl:connect("localhost", Port, [binary, {active, false}, {packet, raw},
- {server_name_indication, "ranch1"}], 5000),
+ {versions, ['tlsv1.2']}, {server_name_indication, "ranch1"}], 5000),
{ok, Cert1} = ssl:peercert(Socket1),
ok = ssl:send(Socket1, <<"SSL Ranch is working!">>),
{ok, <<"SSL Ranch is working!">>} = ssl:recv(Socket1, 21, 1000),
{ok, Socket2} = ssl:connect("localhost", Port, [binary, {active, false}, {packet, raw},
- {server_name_indication, "ranch2"}], 5000),
+ {versions, ['tlsv1.2']}, {server_name_indication, "ranch2"}], 5000),
{ok, Cert2} = ssl:peercert(Socket2),
ok = ssl:send(Socket2, <<"SSL Ranch is working!">>),
{ok, <<"SSL Ranch is working!">>} = ssl:recv(Socket2, 21, 1000),
@@ -834,7 +837,8 @@ do_ssl_local_echo() ->
ranch_ssl, #{socket_opts => [{ip, {local, SockFile}}|Opts]},
echo_protocol, []),
undefined = ranch:get_port(Name),
- {ok, Socket} = ssl:connect({local, SockFile}, 0, [binary, {active, false}, {packet, raw}]),
+ {ok, Socket} = ssl:connect({local, SockFile}, 0,
+ [binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
ok = ssl:send(Socket, <<"SSL Ranch is working!">>),
{ok, <<"SSL Ranch is working!">>} = ssl:recv(Socket, 21, 1000),
ok = ranch:stop_listener(Name),
@@ -856,8 +860,6 @@ ssl_sni_echo(_) ->
ranch_ssl, [{sni_hosts, [{"localhost", Opts}]}],
echo_protocol, []),
Port = ranch:get_port(Name),
- %% We stick to TLS 1.2 because there seems to be a bug in OTP-23.0rc2
- %% that leads to a malformed_handshake_data error.
{ok, Socket} = ssl:connect("localhost", Port,
[binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
ok = ssl:send(Socket, <<"SSL Ranch is working!">>),
@@ -935,12 +937,15 @@ ssl_upgrade_from_tcp(_) ->
ranch_tcp, #{},
ssl_upgrade_protocol, []),
Port = ranch:get_port(Name),
- {ok, Socket} = gen_tcp:connect("localhost", Port, [binary, {active, false}, {packet, raw}]),
+ {ok, Socket} = gen_tcp:connect("localhost", Port,
+ [binary, {active, false}, {packet, raw}]),
ok = gen_tcp:send(Socket, <<"ECHO Before upgrading to SSL">>),
{ok, <<"Before upgrading to SSL">>} = gen_tcp:recv(Socket, 23, 1000),
ok = gen_tcp:send(Socket, <<"UPGRADE">>),
{ok, <<"READY">>} = gen_tcp:recv(Socket, 5, 1000),
- {ok, SslSocket} = ssl:connect(Socket, [{verify, verify_none}], 5000),
+ {ok, SslSocket} = ssl:connect(Socket,
+ [{verify, verify_none}, {versions, ['tlsv1.2']}],
+ 5000),
ok = ssl:send(SslSocket, <<"ECHO After upgrading to SSL">>),
{ok, <<"After upgrading to SSL">>} = ssl:recv(SslSocket, 22, 1000),
ok = ranch:stop_listener(Name),
@@ -959,7 +964,7 @@ ssl_graceful(_) ->
%% Make sure connections with a fresh listener work.
running = ranch:get_status(Name),
{ok, Socket1} = ssl:connect("localhost", Port,
- [binary, {active, false}, {packet, raw}]),
+ [binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
ok = ssl:send(Socket1, <<"SSL with fresh listener">>),
{ok, <<"SSL with fresh listener">>} = ssl:recv(Socket1, 23, 1000),
%% Suspend listener, make sure established connections keep running.
@@ -969,14 +974,14 @@ ssl_graceful(_) ->
{ok, <<"SSL with suspended listener">>} = ssl:recv(Socket1, 27, 1000),
%% Make sure new connections are refused on the suspended listener.
{error, econnrefused} = ssl:connect("localhost", Port,
- [binary, {active, false}, {packet, raw}]),
+ [binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
%% Make sure transport options can be changed when listener is suspended.
ok = ranch:set_transport_options(Name, #{socket_opts => [{port, Port}|Opts]}),
%% Resume listener, make sure connections can be established again.
ok = ranch:resume_listener(Name),
running = ranch:get_status(Name),
{ok, Socket2} = ssl:connect("localhost", Port,
- [binary, {active, false}, {packet, raw}]),
+ [binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
ok = ssl:send(Socket2, <<"SSL with resumed listener">>),
{ok, <<"SSL with resumed listener">>} = ssl:recv(Socket2, 25, 1000),
ok = ranch:stop_listener(Name),
@@ -993,7 +998,8 @@ ssl_getopts_capability(_) ->
ranch_ssl, Opts,
transport_capabilities_protocol, []),
Port=ranch:get_port(Name),
- {ok, Socket}=ssl:connect("localhost", Port, [binary, {active, false}, {packet, raw}]),
+ {ok, Socket}=ssl:connect("localhost", Port,
+ [binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
ok=ssl:send(Socket, <<"getopts/2">>),
{ok, <<"OK">>}=ssl:recv(Socket, 0, 1000),
ok=ranch:stop_listener(Name),
@@ -1009,7 +1015,8 @@ ssl_getstat_capability(_) ->
ranch_ssl, Opts,
transport_capabilities_protocol, []),
Port=ranch:get_port(Name),
- {ok, Socket}=ssl:connect("localhost", Port, [binary, {active, false}, {packet, raw}]),
+ {ok, Socket}=ssl:connect("localhost", Port,
+ [binary, {active, false}, {packet, raw}, {versions, ['tlsv1.2']}]),
ok=ssl:send(Socket, <<"getstat/1">>),
{ok, <<"OK">>}=ssl:recv(Socket, 0, 1000),
ok=ssl:send(Socket, <<"getstat/2">>),