1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.ReverseProxy.Client.Hackney do
6 @behaviour Pleroma.ReverseProxy.Client
9 def request(method, url, headers, body, opts \\ []) do
10 opts = Keyword.put(opts, :ssl_options, versions: [:"tlsv1.2", :"tlsv1.1", :tlsv1])
11 :hackney.request(method, url, headers, body, opts)
15 def stream_body(ref) do
16 case :hackney.stream_body(ref) do
18 {:ok, data} -> {:ok, data, ref}
19 {:error, error} -> {:error, error}
24 def close(ref), do: :hackney.close(ref)