Skip to content

Commit

Permalink
Use only TLS 1.2 on OTP vesions < 25
Browse files Browse the repository at this point in the history
Several users have reported issues downloading sources from
GitHub with a TLS 1.3 handshake.

See elixir-cldr/cldr#184 (comment)
  • Loading branch information
mcrumm committed Aug 26, 2022
1 parent 114b224 commit 79ff481
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## Unreleased

- Use only TLS 1.2 on OTP versions less than 25.

## v0.5.0 (2022-04-28)

- Support upstream arm64 binaries
Expand Down
15 changes: 14 additions & 1 deletion lib/dart_sass.ex
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ defmodule DartSass do
depth: 2,
customize_hostname_check: [
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
]
],
versions: protocol_versions()
]
]

Expand All @@ -389,6 +390,18 @@ defmodule DartSass do
end
end

defp protocol_versions do
if otp_version() < 25 do
[:"tlsv1.2"]
else
[:"tlsv1.2", :"tlsv1.3"]
end
end

defp otp_version do
:erlang.system_info(:otp_release) |> List.to_integer()
end

defp cacertfile() do
Application.get_env(:dart_sass, :cacerts_path) || CAStore.file_path()
end
Expand Down

0 comments on commit 79ff481

Please sign in to comment.