Merge pull request #14645 from rabbitmq/mergify/bp/v4.2.x/pr-14644
Test (make) / Build and Xref (1.18, 26) (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 27) (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 28) (push) Waiting to run
Details
Test (make) / Test (1.18, 28, khepri) (push) Waiting to run
Details
Test (make) / Test (1.18, 28, mnesia) (push) Waiting to run
Details
Test (make) / Test mixed clusters (1.18, 28, khepri) (push) Waiting to run
Details
Test (make) / Test mixed clusters (1.18, 28, mnesia) (push) Waiting to run
Details
Test (make) / Type check (1.18, 28) (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 26) (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 27) (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 28) (push) Waiting to run
Details
Test (make) / Test (1.18, 28, khepri) (push) Waiting to run
Details
Test (make) / Test (1.18, 28, mnesia) (push) Waiting to run
Details
Test (make) / Test mixed clusters (1.18, 28, khepri) (push) Waiting to run
Details
Test (make) / Test mixed clusters (1.18, 28, mnesia) (push) Waiting to run
Details
Test (make) / Type check (1.18, 28) (push) Waiting to run
Details
amqp_ssl: simplify (backport #14644)
This commit is contained in:
commit
9de1afcee3
|
@ -18,10 +18,6 @@
|
||||||
%%---------------------------------------------------------------------------
|
%%---------------------------------------------------------------------------
|
||||||
|
|
||||||
start() ->
|
start() ->
|
||||||
%% rabbit_common needs compiler and syntax_tools, see
|
|
||||||
%%
|
|
||||||
%% * https://github.com/rabbitmq/rabbitmq-erlang-client/issues/72
|
|
||||||
%% * https://github.com/rabbitmq/rabbitmq-common/pull/149
|
|
||||||
{ok, _} = application:ensure_all_started(rabbit_common),
|
{ok, _} = application:ensure_all_started(rabbit_common),
|
||||||
{ok, _} = application:ensure_all_started(amqp_client),
|
{ok, _} = application:ensure_all_started(amqp_client),
|
||||||
ok.
|
ok.
|
||||||
|
|
|
@ -19,9 +19,10 @@ maybe_enhance_ssl_options(Params) ->
|
||||||
|
|
||||||
% https://github.com/erlang/otp/blob/master/lib/inets/src/http_client/httpc_handler.erl
|
% https://github.com/erlang/otp/blob/master/lib/inets/src/http_client/httpc_handler.erl
|
||||||
maybe_add_sni(Host, Options) ->
|
maybe_add_sni(Host, Options) ->
|
||||||
maybe_add_sni_0(lists:keyfind(server_name_indication, 1, Options), Host, Options).
|
ServerNameIndicationKeyFound = lists:keyfind(server_name_indication, 1, Options),
|
||||||
|
maybe_add_sni_0(ServerNameIndicationKeyFound, Host, Options).
|
||||||
|
|
||||||
maybe_add_sni_0(false, Host, Options) ->
|
maybe_add_sni_0(false = _ServerNameIndicationKeyFound, Host, Options) ->
|
||||||
% NB: this is the case where the user did not specify
|
% NB: this is the case where the user did not specify
|
||||||
% server_name_indication at all. If Host is a DNS host name,
|
% server_name_indication at all. If Host is a DNS host name,
|
||||||
% we will specify server_name_indication via code
|
% we will specify server_name_indication via code
|
||||||
|
@ -37,23 +38,14 @@ maybe_add_sni_1(false, _Host, Options) ->
|
||||||
maybe_add_sni_1(true, Host, Options) ->
|
maybe_add_sni_1(true, Host, Options) ->
|
||||||
[{server_name_indication, Host} | Options].
|
[{server_name_indication, Host} | Options].
|
||||||
|
|
||||||
%% This check is no longer necessary starting with OTP-26.
|
|
||||||
%% @todo Remove the check once we support only OTP-26 and above.
|
|
||||||
maybe_add_verify(Options) ->
|
maybe_add_verify(Options) ->
|
||||||
%% This function is only defined starting in OTP-26.
|
|
||||||
case erlang:function_exported(user_drv, whereis_group, 0) of
|
|
||||||
true -> Options;
|
|
||||||
false -> maybe_add_verify1(Options)
|
|
||||||
end.
|
|
||||||
|
|
||||||
maybe_add_verify1(Options) ->
|
|
||||||
case lists:keymember(verify, 1, Options) of
|
case lists:keymember(verify, 1, Options) of
|
||||||
true ->
|
true ->
|
||||||
% NB: user has explicitly set 'verify'
|
% NB: user has explicitly set 'verify'
|
||||||
Options;
|
Options;
|
||||||
_ ->
|
_ ->
|
||||||
?LOG_WARNING("Connection (~tp): certificate chain verification is not enabled for this TLS connection. "
|
?LOG_WARNING("Connection (~tp): certificate chain verification is not enabled for this TLS connection. "
|
||||||
"Please see https://rabbitmq.com/ssl.html for more information.", [self()]),
|
"Please see https://rabbitmq.com/ssl.html for more information.", [self()]),
|
||||||
Options
|
Options
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue