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:
parent
4943e6a914
commit
e52ba68303
3 changed files with 11 additions and 0 deletions
1
changelog.d/hackney-http1.fix
Normal file
1
changelog.d/hackney-http1.fix
Normal 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
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue