diff options
| author | dcc <dcc@logografos.com> | 2024-05-15 00:57:23 -0700 |
|---|---|---|
| committer | dcc <dcc@logografos.com> | 2024-05-15 00:57:23 -0700 |
| commit | b31a934a804aed3f35442ceafe2080b0955e7317 (patch) | |
| tree | 947b13a0388ecea81e05dd980baa10f7546860b9 /patches/3(fix_searches_p2).patch | |
| parent | ea33a0d3427f8b30b82a6ddbc0ff7429cfaf8d91 (diff) | |
| download | anni-b31a934a804aed3f35442ceafe2080b0955e7317.tar.gz anni-b31a934a804aed3f35442ceafe2080b0955e7317.tar.bz2 anni-b31a934a804aed3f35442ceafe2080b0955e7317.zip | |
Diffstat (limited to 'patches/3(fix_searches_p2).patch')
| -rwxr-xr-x | patches/3(fix_searches_p2).patch | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/patches/3(fix_searches_p2).patch b/patches/3(fix_searches_p2).patch deleted file mode 100755 index dcc6490..0000000 --- a/patches/3(fix_searches_p2).patch +++ /dev/null @@ -1,57 +0,0 @@ -From ed31bad2c481633520cc593912586b403c1ac6d4 Mon Sep 17 00:00:00 2001 -From: Mint <> -Date: Wed, 31 May 2023 19:50:20 +0300 -Subject: [PATCH] In-house redirect handler for mediaproxy with Hackney adapter - ---- - lib/pleroma/reverse_proxy/client/hackney.ex | 32 ++++++++++++++++++++- - 1 file changed, 31 insertions(+), 1 deletion(-) - -diff --git a/lib/pleroma/reverse_proxy/client/hackney.ex b/lib/pleroma/reverse_proxy/client/hackney.ex -index d3e9869121..ca4a0c29f0 100644 ---- a/lib/pleroma/reverse_proxy/client/hackney.ex -+++ b/lib/pleroma/reverse_proxy/client/hackney.ex -@@ -5,9 +5,39 @@ - defmodule Pleroma.ReverseProxy.Client.Hackney do - @behaviour Pleroma.ReverseProxy.Client - -+ # redirect handler from Pleb, slightly modified to work with Hackney -+ # https://declin.eu/objects/d4f38e62-5429-4614-86d1-e8fc16e6bf33 -+ # seven years without upstream fix! -+ # https://github.com/benoitc/hackney/issues/273 -+ @redirect_statuses [301, 302, 303, 307, 308] -+ defp get_location(headers) do -+ location = -+ Enum.find(headers, fn {header, _location} -> -+ String.downcase(header) == "location" -+ end) -+ -+ elem(location, 1) -+ end -+ - @impl true - def request(method, url, headers, body, opts \\ []) do -- :hackney.request(method, url, headers, body, opts) -+ if opts[:follow_redirect] != false do -+ {_state, req_opts} = Access.get_and_update(opts, :follow_redirect, fn a -> {a, false} end) -+ res = :hackney.request(method, url, headers, body, req_opts) -+ -+ case res do -+ {:ok, code, reply_headers, _client} when code in @redirect_statuses -> -+ :hackney.request(method, get_location(reply_headers), headers, body, req_opts) -+ -+ {:ok, code, reply_headers} when code in @redirect_statuses -> -+ :hackney.request(method, get_location(reply_headers), headers, body, req_opts) -+ -+ _ -> -+ res -+ end -+ else -+ :hackney.request(method, url, headers, body, opts) -+ end - end - - @impl true --- -GitLab - |
