-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Description
Hi,
I am not totally sure if this is a bug but I found a stranged behaviour in Req when I'm sending a body larger than 64Kb and it seems to be related to Finch protocols option.
It seems a change in the protocols provides different behaviours:
With protocols: [:http1]:
iex(1)> {:ok, pid} = Finch.start_link(name: MyFinch, pools: %{ default: [ protocols: [:http1] ] })
{:ok, #PID<0.648.0>}
iex(2)> Finch.build(:post, "https://nghttp2.org/httpbin/post", [], :crypto.strong_rand_bytes(65538)) |> Finch.request(MyFinch)
{:ok,
%Finch.Response{
status: 200,
body: "{\n \"args\": {}, \n \"data\": \"data:application/octet-stream;base64,TRUNCATED",
headers: [
{"date", "Tue, 20 Feb 2024 18:31:19 GMT"},
{"content-type", "application/json"},
{"content-length", "87690"},
{"access-control-allow-origin", "*"},
{"access-control-allow-credentials", "true"},
{"x-backend-header-rtt", "0.156761"},
{"strict-transport-security", "max-age=31536000"},
{"connection", "close"},
{"alt-svc", "h3=\":443\"; ma=3600, h3-29=\":443\"; ma=3600"},
{"server", "nghttpx"},
{"via", "1.1 nghttpx"},
{"x-frame-options", "SAMEORIGIN"},
{"x-xss-protection", "1; mode=block"},
{"x-content-type-options", "nosniff"}
],
trailers: []
}}
With protocols: [:http2]:
iex(1)> {:ok, pid} = Finch.start_link(name: MyFinch, pools: %{ default: [ protocols: [:http2] ] })
{:ok, #PID<0.648.0>}
iex(2)> Finch.build(:post, "https://nghttp2.org/httpbin/post", [], :crypto.strong_rand_bytes(65538)) |> Finch.request(MyFinch)
{:ok,
%Finch.Response{
status: 200,
body: "{\n \"args\": {}, \n \"data\": \"data:application/octet-stream;base64,TRUNCATED",
headers: [
{"date", "Tue, 20 Feb 2024 18:27:43 GMT"},
{"content-type", "application/json"},
{"content-length", "87695"},
{"access-control-allow-origin", "*"},
{"access-control-allow-credentials", "true"},
{"x-backend-header-rtt", "0.508807"},
{"strict-transport-security", "max-age=31536000"},
{"server", "nghttpx"},
{"alt-svc", "h3=\":443\"; ma=3600, h3-29=\":443\"; ma=3600"},
{"via", "1.1 nghttpx"},
{"x-frame-options", "SAMEORIGIN"},
{"x-xss-protection", "1; mode=block"},
{"x-content-type-options", "nosniff"}
],
trailers: []
}}
With protocols: [:http1, :http2]:
iex(1)> {:ok, pid} = Finch.start_link(name: MyFinch, pools: %{ default: [ protocols: [:http1, :http2] ] })
{:ok, #PID<0.648.0>}
iex(2)> Finch.build(:post, "https://nghttp2.org/httpbin/post", [], :crypto.strong_rand_bytes(65538)) |> Finch.request(MyFinch)
{:error,
%Mint.HTTPError{
reason: {:exceeds_window_size, :request, 65535},
module: Mint.HTTP2
}}
Is it related to the lack of multiplexing when :http1 is provided?
Regards,
sneako
Metadata
Metadata
Assignees
Labels
No labels