aboutsummaryrefslogtreecommitdiffstats
path: root/test/stream_handler_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-02-07 11:32:15 +0100
committerLoïc Hoguin <[email protected]>2020-02-07 11:32:15 +0100
commit8fc3da2fc31a04281b0ba8dc0cdc1e1650067da5 (patch)
tree40756e591a9cec6226f30e7b5278fdf865d724be /test/stream_handler_SUITE.erl
parent47ecfd73181dc888f01479069cb7e076352da9ca (diff)
downloadcowboy-8fc3da2fc31a04281b0ba8dc0cdc1e1650067da5.tar.gz
cowboy-8fc3da2fc31a04281b0ba8dc0cdc1e1650067da5.tar.bz2
cowboy-8fc3da2fc31a04281b0ba8dc0cdc1e1650067da5.zip
Fix HTTP/1.1 bug when a flow command is returned after fin
This resulted in a badarith error due to the current flow being set to infinity when the body has been fully read. A test case has been added reproducing the issue.
Diffstat (limited to 'test/stream_handler_SUITE.erl')
-rw-r--r--test/stream_handler_SUITE.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/stream_handler_SUITE.erl b/test/stream_handler_SUITE.erl
index 1d5bd27..46a05b2 100644
--- a/test/stream_handler_SUITE.erl
+++ b/test/stream_handler_SUITE.erl
@@ -282,6 +282,19 @@ early_error_stream_error_reason(Config) ->
{response, fin, Status, _} = gun:await(ConnPid, Ref),
ok.
+flow_after_body_fully_read(Config) ->
+ doc("A flow command may be returned even after the body was read fully."),
+ Self = self(),
+ ConnPid = gun_open(Config),
+ Ref = gun:post(ConnPid, "/long_polling", [
+ {<<"x-test-case">>, <<"flow_after_body_fully_read">>},
+ {<<"x-test-pid">>, pid_to_list(Self)}
+ ], <<"Hello world!">>),
+ %% Receive a 200 response, sent after the second flow command,
+ %% confirming that the flow command was accepted.
+ {response, _, 200, _} = gun:await(ConnPid, Ref),
+ ok.
+
set_options_ignore_unknown(Config) ->
doc("Confirm that unknown options are ignored when using the set_options commands."),
Self = self(),