fix(http): make Hackney use HTTP/1.1 only

Hackney 4 negotiates HTTP/2 and shares one connection per host. The
media proxy closes a response with :hackney.close/1, which stops the
whole connection, so parallel downloads from one host broke each other.
This commit is contained in:
Lain Soykaf 2026-10-22 16:24:47 +04:00
commit e52ba68303
No known key found for this signature in database
3 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1 @@
Hackney: use HTTP/1.1 only, so closing one media proxy response no longer breaks other downloads from the same host

View file

@ -163,6 +163,10 @@ config :mime, :types, %{
config :tesla, adapter: Tesla.Adapter.Hackney config :tesla, adapter: Tesla.Adapter.Hackney
# Hackney 4 shares one HTTP/2 connection per host, and closing one response
# (as the media proxy does) stops it for every other stream on it.
config :hackney, default_protocols: [:http1]
# Configures http settings, upstream proxy etc. # Configures http settings, upstream proxy etc.
config :pleroma, :http, config :pleroma, :http,
proxy_url: nil, proxy_url: nil,

View file

@ -13,6 +13,12 @@ defmodule Pleroma.HTTP.AdapterHelper.HackneyTest do
{:ok, uri: uri} {:ok, uri: uri}
end end
# Hackney 4 shares one HTTP/2 connection per host, and closing a response
# stops that connection for every stream on it.
test "Hackney only speaks HTTP/1.1" do
assert :hackney_util.default_protocols() == [:http1]
end
describe "options/2" do describe "options/2" do
setup do: clear_config([:http, :adapter], a: 1, b: 2) setup do: clear_config([:http, :adapter], a: 1, b: 2)