Skip to content

Commit ef582cb

Browse files
committed
disable middlebox_comp_mode on failed connect
1 parent b0a0009 commit ef582cb

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

lib/mix/lib/mix/utils.ex

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -738,21 +738,11 @@ defmodule Mix.Utils do
738738
file -> {:cacertfile, file}
739739
end
740740

741-
# disable middlebox compatibility mode by default
742-
# but allow it to be enabled via an environment variable
743-
# see https://github.com/elixir-lang/elixir/issues/14356
744-
middlebox_comp_mode =
745-
case System.get_env("HEX_MIDDLEBOX_COMP_MODE") do
746-
t when t in ["true", "t", "yes", "y", "1"] -> true
747-
_ -> false
748-
end
749-
750-
# Use the system certificates and set the middlebox compatibility mode
741+
# Use the system certificates
751742
ssl_options = [
752743
cacert_opt,
753744
verify: :verify_peer,
754-
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)],
755-
middlebox_comp_mode: middlebox_comp_mode
745+
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)]
756746
]
757747

758748
# We are using relaxed: true because some servers is returning a Location
@@ -775,6 +765,11 @@ defmodule Mix.Utils do
775765
:httpc.set_options([ipfamily: fallback(inet)], :mix)
776766
request |> httpc_request(http_options) |> httpc_response()
777767

768+
{:error, {:failed_connect, [{:to_address, _}, {inet, _, {:tls_alert, _}}]}}
769+
when inet in [:inet, :inet6] ->
770+
http_options = put_in(http_options, [:ssl, :middlebox_comp_mode], false)
771+
request |> httpc_request(http_options) |> httpc_response()
772+
778773
response ->
779774
httpc_response(response)
780775
end

0 commit comments

Comments
 (0)