summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Hoguin <lhoguin@vmware.com>2021-09-09 13:15:08 +0200
committerLoïc Hoguin <lhoguin@vmware.com>2021-09-09 13:15:08 +0200
commit0a2bde4ab1954f93298d3993c56b034da3ec4210 (patch)
treeb85f1541b215ce1973fe2cd60068874dc3b84285
parentd327e8a7cb937eceab98b7a2d6e1e9066487f44d (diff)
downloadrabbitmq-server-git-lh-ranch-2.1.tar.gz
Use the new function ranch_proxy_header:to_connection_info/1lh-ranch-2.1
-rw-r--r--deps/rabbit_common/src/rabbit_net.erl26
1 files changed, 6 insertions, 20 deletions
diff --git a/deps/rabbit_common/src/rabbit_net.erl b/deps/rabbit_common/src/rabbit_net.erl
index a2325c45be..865ca6f253 100644
--- a/deps/rabbit_common/src/rabbit_net.erl
+++ b/deps/rabbit_common/src/rabbit_net.erl
@@ -100,26 +100,12 @@ ssl_info(_Sock) ->
nossl.
proxy_ssl_info(Sock, {rabbit_proxy_socket, _, ProxyInfo}) ->
- case ProxyInfo of
- #{ssl := #{version := Version, cipher := Cipher}} ->
- Proto = case Version of
- <<"SSL3">> -> 'ssl3';
- <<"TLSv1">> -> 'tlsv1';
- <<"TLSv1.1">> -> 'tlsv1.1';
- <<"TLSv1.2">> -> 'tlsv1.2';
- <<"TLSv1.3">> -> 'tlsv1.3';
- _ -> nossl
- end,
- CipherSuite = case ssl:str_to_suite(binary_to_list(Cipher)) of
- #{} = CS -> CS;
- _ -> nossl
- end,
- case {Proto, CipherSuite} of
- {nossl, _} -> ssl_info(Sock);
- {_, nossl} -> ssl_info(Sock);
- _ -> {ok, [{protocol, Proto}, {selected_cipher_suite, CipherSuite}]}
- end;
- _ ->
+ ConnInfo = ranch_proxy_header:to_connection_info(ProxyInfo),
+ case lists:keymember(protocol, 1, ConnInfo) andalso
+ lists:keymember(selected_cipher_suite, 1, ConnInfo) of
+ true ->
+ {ok, ConnInfo};
+ false ->
ssl_info(Sock)
end;
proxy_ssl_info(Sock, _) ->