<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0b5394">Hi Luke.</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0b5394"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0b5394">Thanks for your email.</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0b5394"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0b5394">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.</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0b5394"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0b5394">Br. Stefano</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 13, 2020 at 4:03 PM Luke Bakken <<a href="mailto:luke@bakken.io">luke@bakken.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Stefano,<br>
<br>
I may be mistaken, but this might be due to how Wireshark is decoding<br>
the data and presenting it to you. I see that the IP and TCP<br>
information for both "packets" is the same. Most importantly, the Seq<br>
and Ack numbers.<br>
<br>
If they were distinct TCP packets I would expect to see different<br>
numbers (<a href="https://packetlife.net/blog/2010/jun/7/understanding-tcp-sequence-acknowledgment-numbers/" rel="noreferrer" target="_blank">https://packetlife.net/blog/2010/jun/7/understanding-tcp-sequence-acknowledgment-numbers/</a>).<br>
<br>
Also, your code is making a connection to port 8088 but the Wireshark<br>
output shows port 80.<br>
<br>
Thanks,<br>
Luke<br>
<br>
On Sun, Sep 13, 2020 at 6:07 AM Stefano Bertuola<br>
<<a href="mailto:stefano.bertuola@gmail.com" target="_blank">stefano.bertuola@gmail.com</a>> wrote:<br>
><br>
> Hi all.<br>
><br>
> When sending an HTTP2 request using Gun:<br>
><br>
> {ok, ConnPid} = gun:open({127,0,0,1}, 8088, #{protocols => [http2]}).<br>
> gun:post(ConnPid, "/test", [ {<<"content-type">>, <<"application/json">>} ], <<"{\"test\": \"test\" }">>).<br>
><br>
> the HEADER and DATA frames are sent in different HTTPs packets:<br>
><br>
> Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)<br>
> Transmission Control Protocol, Src Port: 1299, Dst Port: 80, Seq: 266, Ack: 229, Len: 46<br>
> HyperText Transfer Protocol 2<br>
> Stream: HEADERS, Stream ID: 1, Length 37, POST /test<br>
> Length: 37<br>
> Type: HEADERS (1)<br>
> Flags: 0x04<br>
> 0... .... .... .... .... .... .... .... = Reserved: 0x0<br>
> .000 0000 0000 0000 0000 0000 0000 0001 = Stream Identifier: 1<br>
> [Pad Length: 0]<br>
> Header Block Fragment: 8644846125427f83418a089d5c0b8170dc780f3d5f8b1d75…<br>
> [Header Length: 148]<br>
> [Header Count: 6]<br>
> Header: :scheme: http<br>
> Header: :path: /test<br>
> Header: :method: POST<br>
> Header: :authority: <a href="http://127.0.0.1:8088" rel="noreferrer" target="_blank">127.0.0.1:8088</a><br>
> Header: content-type: application/json<br>
> Header: content-length: 17<br>
><br>
> Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)<br>
> Transmission Control Protocol, Src Port: 1299, Dst Port: 80, Seq: 266, Ack: 229, Len: 46<br>
> HyperText Transfer Protocol 2<br>
> Stream: DATA, Stream ID: 1, Length 17<br>
> Length: 17<br>
> Type: DATA (0)<br>
> Flags: 0x01<br>
> 0... .... .... .... .... .... .... .... = Reserved: 0x0<br>
> .000 0000 0000 0000 0000 0000 0000 0001 = Stream Identifier: 1<br>
> [Pad Length: 0]<br>
> Data: 7b2274657374223a20227465737422207d<br>
> JavaScript Object Notation: application/json<br>
> JSON compact form: {...}<br>
> test: "test"<br>
> Object<br>
> Member Key: test<br>
> String value: test<br>
> Key: test<br>
><br>
> Why Gun is acting in this way? How to get both HEADER and DATA in the same HTTP2 request?<br>
><br>
> I did the test with both 1.3.3 and 2.0.0-pre.2 releases.<br>
><br>
> Br. Stefano<br>
</blockquote></div>