aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2022-03-08 15:24:23 +0100
committerLoïc Hoguin <[email protected]>2022-03-08 15:24:23 +0100
commit5a175dc6d5c0beddb78900b2d4ad817c9be7c2df (patch)
treef540c5ccb1746cb50d76ee1ac52738c296844f11
parent1ee2a1913e79e010733991d8373b2517abf0d91b (diff)
downloadgun-5a175dc6d5c0beddb78900b2d4ad817c9be7c2df.tar.gz
gun-5a175dc6d5c0beddb78900b2d4ad817c9be7c2df.tar.bz2
gun-5a175dc6d5c0beddb78900b2d4ad817c9be7c2df.zip
Add a test for HTTP/2 empty DATA frame with fin set
-rw-r--r--test/gun_SUITE.erl23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index ad39317..00b8eab 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -143,6 +143,29 @@ ignore_empty_data_http2(_) ->
>> = Data,
gun:close(Pid).
+ignore_empty_data_fin_http2(_) ->
+ doc("When gun:data/4 is called with fin and empty data, it must send a final empty DATA frame."),
+ {ok, OriginPid, OriginPort} = init_origin(tcp, http2),
+ {ok, Pid} = gun:open("localhost", OriginPort, #{protocols => [http2]}),
+ {ok, http2} = gun:await_up(Pid),
+ handshake_completed = receive_from(OriginPid),
+ Ref = gun:put(Pid, "/", []),
+ gun:data(Pid, Ref, nofin, "hello "),
+ gun:data(Pid, Ref, nofin, "world!"),
+ gun:data(Pid, Ref, fin, ["", <<>>]),
+ Data = receive_all_from(OriginPid, 500),
+ <<
+ %% HEADERS frame.
+ Len1:24, 1, _:40, _:Len1/unit:8,
+ %% First DATA frame.
+ 6:24, 0, _:7, 0:1, _:32, "hello ",
+ %% Second DATA frame.
+ 6:24, 0, _:7, 0:1, _:32, "world!",
+ %% Final empty DATA frame.
+ 0:24, 0, _:7, 1:1, _:32
+ >> = Data,
+ gun:close(Pid).
+
info(_) ->
doc("Get info from the Gun connection."),
{ok, ListenSocket} = gen_tcp:listen(0, [binary, {active, false}]),