projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix atom leak in AdminAPIController
[akkoma]
/
lib
/
pleroma
/
gun
/
conn.ex
diff --git
a/lib/pleroma/gun/conn.ex
b/lib/pleroma/gun/conn.ex
index 77f78c7fff17294266c5d54a63a9b01bbc78cb00..75b1ffc0a6a1cef762cc44de0815047eb5efb0d3 100644
(file)
--- a/
lib/pleroma/gun/conn.ex
+++ b/
lib/pleroma/gun/conn.ex
@@
-13,9
+13,7
@@
defmodule Pleroma.Gun.Conn do
opts =
opts
|> Enum.into(%{})
opts =
opts
|> Enum.into(%{})
- |> Map.put_new(:retry, pool_opts[:retry] || 1)
- |> Map.put_new(:retry_timeout, pool_opts[:retry_timeout] || 1000)
- |> Map.put_new(:await_up_timeout, pool_opts[:await_up_timeout] || 5_000)
+ |> Map.put_new(:connect_timeout, pool_opts[:connect_timeout] || 5_000)
|> Map.put_new(:supervise, false)
|> maybe_add_tls_opts(uri)
|> Map.put_new(:supervise, false)
|> maybe_add_tls_opts(uri)
@@
-24,15
+22,14
@@
defmodule Pleroma.Gun.Conn do
defp maybe_add_tls_opts(opts, %URI{scheme: "http"}), do: opts
defp maybe_add_tls_opts(opts, %URI{scheme: "http"}), do: opts
- defp maybe_add_tls_opts(opts, %URI{scheme: "https"
, host: host
}) do
+ defp maybe_add_tls_opts(opts, %URI{scheme: "https"}) do
tls_opts = [
verify: :verify_peer,
cacertfile: CAStore.file_path(),
depth: 20,
reuse_sessions: false,
tls_opts = [
verify: :verify_peer,
cacertfile: CAStore.file_path(),
depth: 20,
reuse_sessions: false,
- verify_fun:
- {&:ssl_verify_hostname.verify_fun/3,
- [check_hostname: Pleroma.HTTP.AdapterHelper.format_host(host)]}
+ log_level: :warning,
+ customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)]
]
tls_opts =
]
tls_opts =
@@
-53,7
+50,7
@@
defmodule Pleroma.Gun.Conn do
with open_opts <- Map.delete(opts, :tls_opts),
{:ok, conn} <- Gun.open(proxy_host, proxy_port, open_opts),
with open_opts <- Map.delete(opts, :tls_opts),
{:ok, conn} <- Gun.open(proxy_host, proxy_port, open_opts),
- {:ok, _} <- Gun.await_up(conn, opts[:
await_up
_timeout]),
+ {:ok, _} <- Gun.await_up(conn, opts[:
connect
_timeout]),
stream <- Gun.connect(conn, connect_opts),
{:response, :fin, 200, _} <- Gun.await(conn, stream) do
{:ok, conn}
stream <- Gun.connect(conn, connect_opts),
{:response, :fin, 200, _} <- Gun.await(conn, stream) do
{:ok, conn}
@@
-91,7
+88,7
@@
defmodule Pleroma.Gun.Conn do
|> Map.put(:socks_opts, socks_opts)
with {:ok, conn} <- Gun.open(proxy_host, proxy_port, opts),
|> Map.put(:socks_opts, socks_opts)
with {:ok, conn} <- Gun.open(proxy_host, proxy_port, opts),
- {:ok, _} <- Gun.await_up(conn, opts[:
await_up
_timeout]) do
+ {:ok, _} <- Gun.await_up(conn, opts[:
connect
_timeout]) do
{:ok, conn}
else
error ->
{:ok, conn}
else
error ->
@@
-109,7
+106,7
@@
defmodule Pleroma.Gun.Conn do
host = Pleroma.HTTP.AdapterHelper.parse_host(host)
with {:ok, conn} <- Gun.open(host, port, opts),
host = Pleroma.HTTP.AdapterHelper.parse_host(host)
with {:ok, conn} <- Gun.open(host, port, opts),
- {:ok, _} <- Gun.await_up(conn, opts[:
await_up
_timeout]) do
+ {:ok, _} <- Gun.await_up(conn, opts[:
connect
_timeout]) do
{:ok, conn}
else
error ->
{:ok, conn}
else
error ->