aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/http/adapter_helper
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-04 18:13:24 +0300
committerAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-04 18:13:24 +0300
commitd6bebd4f9c8086dd87c75f3637a5d392a05f2daf (patch)
tree31ea18b1c5b49c80385c4f6d8a34026efa046448 /lib/pleroma/http/adapter_helper
parent22d52f5691d985e7daaa955e97e0722f038f6fae (diff)
downloadpleroma-d6bebd4f9c8086dd87c75f3637a5d392a05f2daf.tar.gz
moving some logic to tesla adapter
- checking original inside gun adapter - flushing streams on max_body error
Diffstat (limited to 'lib/pleroma/http/adapter_helper')
-rw-r--r--lib/pleroma/http/adapter_helper/gun.ex17
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/pleroma/http/adapter_helper/gun.ex b/lib/pleroma/http/adapter_helper/gun.ex
index b3298ec7f..5d5870d90 100644
--- a/lib/pleroma/http/adapter_helper/gun.ex
+++ b/lib/pleroma/http/adapter_helper/gun.ex
@@ -26,7 +26,6 @@ defmodule Pleroma.HTTP.AdapterHelper.Gun do
@defaults
|> Keyword.merge(Pleroma.Config.get([:http, :adapter], []))
- |> add_original(uri)
|> add_scheme_opts(uri)
|> AdapterHelper.maybe_add_proxy(AdapterHelper.format_proxy(proxy))
|> maybe_get_conn(uri, connection_opts)
@@ -42,17 +41,12 @@ defmodule Pleroma.HTTP.AdapterHelper.Gun do
:ok
end
- defp add_original(opts, %URI{host: host, port: port}) do
- formatted_host = format_host(host)
-
- Keyword.put(opts, :original, "#{formatted_host}:#{port}")
- end
-
defp add_scheme_opts(opts, %URI{scheme: "http"}), do: opts
- defp add_scheme_opts(opts, %URI{scheme: "https", host: host, port: port}) do
+ defp add_scheme_opts(opts, %URI{scheme: "https", host: host}) do
adapter_opts = [
certificates_verification: true,
+ transport: :tls,
tls_opts: [
verify: :verify_peer,
cacertfile: CAStore.file_path(),
@@ -63,13 +57,6 @@ defmodule Pleroma.HTTP.AdapterHelper.Gun do
]
]
- adapter_opts =
- if port != 443 do
- Keyword.put(adapter_opts, :transport, :tls)
- else
- adapter_opts
- end
-
Keyword.merge(opts, adapter_opts)
end