aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/acceptor_SUITE.erl37
-rw-r--r--test/proxy_header_SUITE.erl2
-rw-r--r--test/upgrade_SUITE.erl2
3 files changed, 24 insertions, 17 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">>),
diff --git a/test/proxy_header_SUITE.erl b/test/proxy_header_SUITE.erl
index 7599abd..4842a58 100644
--- a/test/proxy_header_SUITE.erl
+++ b/test/proxy_header_SUITE.erl
@@ -216,7 +216,7 @@ do_proxy_header_ssl(Name, ProxyInfo, Data1, Data2) ->
Port = ranch:get_port(Name),
{ok, Socket0} = gen_tcp:connect("localhost", Port, [binary, {active, false}, {packet, raw}]),
ok = gen_tcp:send(Socket0, [ranch_proxy_header:header(ProxyInfo)]),
- {ok, Socket} = ssl:connect(Socket0, [], 1000),
+ {ok, Socket} = ssl:connect(Socket0, [{versions, ['tlsv1.2']}], 1000),
ok = ssl:send(Socket, Data1),
receive
{proxy_protocol, ProxyInfo} ->
diff --git a/test/upgrade_SUITE.erl b/test/upgrade_SUITE.erl
index 0e3b757..c70e1ce 100644
--- a/test/upgrade_SUITE.erl
+++ b/test/upgrade_SUITE.erl
@@ -90,7 +90,7 @@ do_compile_and_start(Example) ->
++ Dir ++ "/_rel/" ++ ExampleStr
++ "_example/releases/1/start.boot"),
_ = do_exec_log(Rel ++ " stop"),
- _ = do_exec_log(Rel ++ " start"),
+ _ = do_exec_log(Rel ++ " daemon"),
timer:sleep(2000),
_ = do_exec_log(Rel ++ " eval 'application:info()'"),
ok.