correct pool and uniform headers format
authorAlexander Strizhakov <alex.strizhakov@gmail.com>
Wed, 2 Sep 2020 06:16:51 +0000 (09:16 +0300)
committerAlexander Strizhakov <alex.strizhakov@gmail.com>
Wed, 2 Sep 2020 06:16:51 +0000 (09:16 +0300)
lib/mix/tasks/pleroma/frontend.ex
lib/pleroma/instances/instance.ex
lib/pleroma/object/fetcher.ex
lib/pleroma/web/rich_media/helpers.ex
lib/pleroma/web/web_finger/web_finger.ex
test/support/http_request_mock.ex

index 2adbf8d72c9835cfbc01cf76aaabc306952742cc..484af6da70bd3d77ba6aa3c91b0499e6490aa3d4 100644 (file)
@@ -124,7 +124,9 @@ defmodule Mix.Tasks.Pleroma.Frontend do
     url = String.replace(frontend_info["build_url"], "${ref}", frontend_info["ref"])
 
     with {:ok, %{status: 200, body: zip_body}} <-
-           Pleroma.HTTP.get(url, [], timeout: 120_000, recv_timeout: 120_000) do
+           Pleroma.HTTP.get(url, [],
+             adapter: [pool: :media, timeout: 120_000, recv_timeout: 120_000]
+           ) do
       unzip(zip_body, dest)
     else
       e -> {:error, e}
index a1f935232e69642362be744881f1db6a311125fa..711c42158b1580b1a88da2c1f26cdadbc715fa36 100644 (file)
@@ -150,7 +150,9 @@ defmodule Pleroma.Instances.Instance do
   defp scrape_favicon(%URI{} = instance_uri) do
     try do
       with {:ok, %Tesla.Env{body: html}} <-
-             Pleroma.HTTP.get(to_string(instance_uri), [{:Accept, "text/html"}]),
+             Pleroma.HTTP.get(to_string(instance_uri), [{"accept", "text/html"}],
+               adapter: [pool: :media]
+             ),
            favicon_rel <-
              html
              |> Floki.parse_document!()
index 6fdbc8efd175006f73d3bda0a2a8e180a5f06d21..374d8704ad966bab3512aa538f85243976ac705a 100644 (file)
@@ -164,12 +164,12 @@ defmodule Pleroma.Object.Fetcher do
         date: date
       })
 
-    [{"signature", signature}]
+    {"signature", signature}
   end
 
   defp sign_fetch(headers, id, date) do
     if Pleroma.Config.get([:activitypub, :sign_object_fetches]) do
-      headers ++ make_signature(id, date)
+      [make_signature(id, date) | headers]
     else
       headers
     end
@@ -177,7 +177,7 @@ defmodule Pleroma.Object.Fetcher do
 
   defp maybe_date_fetch(headers, date) do
     if Pleroma.Config.get([:activitypub, :sign_object_fetches]) do
-      headers ++ [{"date", date}]
+      [{"date", date} | headers]
     else
       headers
     end
index 6210f2c5af6d154875df94b2177fadba62025021..2fb482b51806a7507ccff42de9738270ccfc97ec 100644 (file)
@@ -96,6 +96,6 @@ defmodule Pleroma.Web.RichMedia.Helpers do
         @rich_media_options
       end
 
-    Pleroma.HTTP.get(url, headers, options)
+    Pleroma.HTTP.get(url, headers, adapter: options)
   end
 end
index c4051e63e40979321304eef1b13614ffcae87f6e..6629f5356fb9038ae389aee5beeded159cbd2803 100644 (file)
@@ -136,12 +136,12 @@ defmodule Pleroma.Web.WebFinger do
 
   def find_lrdd_template(domain) do
     with {:ok, %{status: status, body: body}} when status in 200..299 <-
-           HTTP.get("http://#{domain}/.well-known/host-meta", []) do
+           HTTP.get("http://#{domain}/.well-known/host-meta") do
       get_template_from_xml(body)
     else
       _ ->
         with {:ok, %{body: body, status: status}} when status in 200..299 <-
-               HTTP.get("https://#{domain}/.well-known/host-meta", []) do
+               HTTP.get("https://#{domain}/.well-known/host-meta") do
           get_template_from_xml(body)
         else
           e -> {:error, "Can't find LRDD template: #{inspect(e)}"}
index eeeba7880da95927b5dac7c8f8450fff35077733..a0ebf65d978febfdca68dce5c71729c04b5992ee 100644 (file)
@@ -1350,11 +1350,11 @@ defmodule HttpRequestMock do
     {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/relay/relay.json")}}
   end
 
-  def get("http://localhost:4001/", _, "", Accept: "text/html") do
+  def get("http://localhost:4001/", _, "", [{"accept", "text/html"}]) do
     {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/7369654.html")}}
   end
 
-  def get("https://osada.macgirvin.com/", _, "", Accept: "text/html") do
+  def get("https://osada.macgirvin.com/", _, "", [{"accept", "text/html"}]) do
     {:ok,
      %Tesla.Env{
        status: 200,