aboutsummaryrefslogtreecommitdiffstats
path: root/test/proxy_protocol.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/proxy_protocol.erl')
-rw-r--r--test/proxy_protocol.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/proxy_protocol.erl b/test/proxy_protocol.erl
index 6a161c7..9c679e3 100644
--- a/test/proxy_protocol.erl
+++ b/test/proxy_protocol.erl
@@ -9,9 +9,12 @@ start_link(Ref, _Socket, Transport, Opts) ->
{ok, Pid}.
init(Ref, Transport, _Opts = []) ->
+ {ok, ProxyInfo} = ranch:recv_proxy_header(Ref, 1000),
{ok, Socket} = ranch:handshake(Ref),
- {ok, ProxyInfo} = Transport:recv_proxy_header(Socket, 1000),
- Pid = ct_helper:get_remote_pid_tcp(Socket),
+ Pid = case Transport of
+ ranch_tcp -> ct_helper:get_remote_pid_tcp(Socket);
+ ranch_ssl -> ct_helper:get_remote_pid_tls(Socket)
+ end,
Pid ! {?MODULE, ProxyInfo},
loop(Socket, Transport).