Skip to content

Commit

Permalink
Aktualisieren von http.ex
Browse files Browse the repository at this point in the history
  • Loading branch information
mruoss authored Jul 25, 2024
1 parent ac6915f commit 66aae90
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions lib/flame_k8s_backend/http.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ defmodule FlameK8sBackend.HTTP do
{:ok, String.t()} | {:error, String.t()}
defp request(http, verb, path, body \\ nil) do
headers = [{~c"Authorization", ~c"Bearer #{http.token}"}]
http_opts = [ssl: [verify: :verify_peer, cacertfile: http.cacertfile, customize_hostname_check: [match_fun: &check_ips_as_dns_id/2]]]
http_opts = [
ssl: [
verify: :verify_peer,
cacertfile: http.cacertfile,
customize_hostname_check: [match_fun: &check_ips_as_dns_id/2]
]
]
url = http.base_url <> path

request =
Expand All @@ -58,18 +64,18 @@ defmodule FlameK8sBackend.HTTP do
end
end

if String.to_integer(System.otp_release) < 27 do
# Workaround for an issue in OTP<27
# https://github.com/erlang/otp/issues/7968
defp check_ips_as_dns_id({:dns_id, hostname}, {:iPAddress, ip}) do
with {:ok, ip_tuple} <- :inet.parse_address(hostname),
^ip <- Tuple.to_list(ip_tuple) do
true
else
_ -> :default
if String.to_integer(System.otp_release) < 27 do
# Workaround for an issue in OTP<27
# https://github.com/erlang/otp/issues/7968
defp check_ips_as_dns_id({:dns_id, hostname}, {:iPAddress, ip}) do
with {:ok, ip_tuple} <- :inet.parse_address(hostname),
^ip <- Tuple.to_list(ip_tuple) do
true
else
_ -> :default
end
end
end
end

defp check_ips_as_dns_id(_, _), do: :default
end

0 comments on commit 66aae90

Please sign in to comment.