was used with hackney
This commit is contained in:
parent
540338aaa0
commit
6e66bb35d1
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user