little refactoring
This commit is contained in:
parent
65fd5bdf4c
commit
431cf60510
@ -160,11 +160,7 @@ defmodule Pleroma.Gun.Connections do
|
|||||||
|
|
||||||
result =
|
result =
|
||||||
if opts[:proxy] do
|
if opts[:proxy] do
|
||||||
with {proxy_host, proxy_port} <- opts[:proxy],
|
tls_opts = Map.get(opts, :tls_opts, [])
|
||||||
tls_opts <- Map.get(opts, :tls_opts, []),
|
|
||||||
open_opts <- Map.delete(opts, :tls_opts),
|
|
||||||
{:ok, conn} <- API.open(proxy_host, proxy_port, open_opts),
|
|
||||||
{:ok, _} <- API.await_up(conn) do
|
|
||||||
connect_opts = %{host: host, port: port}
|
connect_opts = %{host: host, port: port}
|
||||||
|
|
||||||
connect_opts =
|
connect_opts =
|
||||||
@ -176,10 +172,13 @@ defmodule Pleroma.Gun.Connections do
|
|||||||
connect_opts
|
connect_opts
|
||||||
end
|
end
|
||||||
|
|
||||||
with stream <- API.connect(conn, connect_opts),
|
with {proxy_host, proxy_port} <- opts[:proxy],
|
||||||
|
open_opts <- Map.delete(opts, :tls_opts),
|
||||||
|
{:ok, conn} <- API.open(proxy_host, proxy_port, open_opts),
|
||||||
|
{:ok, _} <- API.await_up(conn),
|
||||||
|
stream <- API.connect(conn, connect_opts),
|
||||||
{:response, :fin, 200, _} <- API.await(conn, stream) do
|
{:response, :fin, 200, _} <- API.await(conn, stream) do
|
||||||
{:ok, conn, true}
|
{:ok, conn, true}
|
||||||
end
|
|
||||||
else
|
else
|
||||||
{:error, error} ->
|
{:error, error} ->
|
||||||
{:error, error}
|
{:error, error}
|
||||||
|
Loading…
Reference in New Issue
Block a user