Allow Pleroma.HTTP to connect to raw-HTTP without freaking mint out

This commit is contained in:
FloatingGhost 2023-08-04 23:51:15 +01:00
parent 8670d89316
commit 31d7cc9a9c
2 changed files with 7 additions and 1 deletions

View file

@ -269,7 +269,6 @@ defp http_children do
|> Config.get([])
|> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size)
|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy)
|> Pleroma.HTTP.AdapterHelper.maybe_add_cacerts(:public_key.cacerts_get())
|> Keyword.put(:name, MyFinch)
[{Finch, config}]

View file

@ -62,6 +62,13 @@ def request(method, url, body, headers, options) when is_binary(url) do
uri = URI.parse(url)
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)
params = options[:params] || []
request = build_request(method, headers, options, url, body, params)