Allow Pleroma.HTTP to connect to raw-HTTP without freaking mint out
This commit is contained in:
parent
8670d89316
commit
31d7cc9a9c
2 changed files with 7 additions and 1 deletions
|
@ -269,7 +269,6 @@ defp http_children do
|
||||||
|> Config.get([])
|
|> Config.get([])
|
||||||
|> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size)
|
|> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size)
|
||||||
|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy)
|
|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy)
|
||||||
|> Pleroma.HTTP.AdapterHelper.maybe_add_cacerts(:public_key.cacerts_get())
|
|
||||||
|> Keyword.put(:name, MyFinch)
|
|> Keyword.put(:name, MyFinch)
|
||||||
|
|
||||||
[{Finch, config}]
|
[{Finch, config}]
|
||||||
|
|
|
@ -62,6 +62,13 @@ def request(method, url, body, headers, options) when is_binary(url) do
|
||||||
uri = URI.parse(url)
|
uri = URI.parse(url)
|
||||||
adapter_opts = AdapterHelper.options(uri, options || [])
|
adapter_opts = AdapterHelper.options(uri, options || [])
|
||||||
|
|
||||||
|
adapter_opts =
|
||||||
|
if uri.scheme == :https do
|
||||||
|
AdapterHelper.maybe_add_cacerts(adapter_opts, :public_key.cacerts_get())
|
||||||
|
else
|
||||||
|
adapter_opts
|
||||||
|
end
|
||||||
|
|
||||||
options = put_in(options[:adapter], adapter_opts)
|
options = put_in(options[:adapter], adapter_opts)
|
||||||
params = options[:params] || []
|
params = options[:params] || []
|
||||||
request = build_request(method, headers, options, url, body, params)
|
request = build_request(method, headers, options, url, body, params)
|
||||||
|
|
Loading…
Reference in a new issue