Re: Gun and HTTP2: HEADER and DATA frames in different packets

Loïc Hoguin <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Organization Nine Nines
Message-ID <[email protected]>
On 13/09/2020 11:13, Stefano Bertuola wrote:
> Hi all.
> 
> When sending an HTTP2 request using Gun:
> 
>    {ok, ConnPid} = gun:open({127,0,0,1}, 8088, #{protocols => [http2]}).
>    gun:post(ConnPid, "/test", [ {<<"content-type">>, 
> <<"application/json">>} ], <<"{\"test\": \"test\" }">>).
> 
> the HEADER and DATA frames are sent in different HTTPs packets:
> [...]
> Why Gun is acting in this way? How to get both HEADER and DATA in the 
> same HTTP2 request?

They're distinct send calls because HTTP/2 has flow control for the DATA 
frames and the body for the request may be queued partially or fully.

 > I can confirm the two frames (HEADER and DATA) are
 > sent in two different HTTP2 messages by Gun. In fact,
 > when receiving the 1st one containing the HEADER,
 > Cowboy is complaining the body is missing.

What's the exact error though? Cowboy is tested with Gun so if there's a 
client that should work it's this one. :-)

-- 
Loïc Hoguin
https://ninenines.eu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.