was used with hackney

This commit is contained in:
Alex S 2019-08-22 12:37:33 +03:00
parent 540338aaa0
commit 6e66bb35d1

View File

@ -28,9 +28,7 @@ defmodule Pleroma.HTTP do
""" """
def request(method, url, body \\ "", headers \\ [], options \\ []) do def request(method, url, body \\ "", headers \\ [], options \\ []) do
try do try do
options = options = process_request_options(options)
process_request_options(options)
|> process_sni_options(url)
adapter_gun? = Application.get_env(:tesla, :adapter) == Tesla.Adapter.Gun adapter_gun? = Application.get_env(:tesla, :adapter) == Tesla.Adapter.Gun
@ -65,21 +63,6 @@ defmodule Pleroma.HTTP do
end end
end end
defp process_sni_options(options, nil), do: options
defp process_sni_options(options, url) do
uri = URI.parse(url)
host = uri.host |> to_charlist()
case uri.scheme do
"https" ->
options ++ [ssl: [server_name_indication: host]]
_ ->
options
end
end
def process_request_options(options) do def process_request_options(options) do
Keyword.merge(Pleroma.HTTP.Connection.options([]), options) Keyword.merge(Pleroma.HTTP.Connection.options([]), options)
end end