Merge pull request #14644 from rabbitmq/mk-amqp-091-client-tls-simplification
Trigger a 4.2.x alpha release build / trigger_alpha_build (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
This commit is contained in:
Michael Klishin 2025-09-29 21:57:35 -04:00 committed by GitHub
commit 1158aca30e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 16 deletions

View File

@ -18,10 +18,6 @@
%%---------------------------------------------------------------------------
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(amqp_client),
ok.

View File

@ -19,9 +19,10 @@ maybe_enhance_ssl_options(Params) ->
% https://github.com/erlang/otp/blob/master/lib/inets/src/http_client/httpc_handler.erl
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
% server_name_indication at all. If Host is a DNS host name,
% we will specify server_name_indication via code
@ -37,16 +38,7 @@ maybe_add_sni_1(false, _Host, Options) ->
maybe_add_sni_1(true, 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) ->
%% 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
true ->
% NB: user has explicitly set 'verify'