aboutsummaryrefslogtreecommitdiffstats
path: root/test/req_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-09-13 14:20:04 +0200
committerLoïc Hoguin <[email protected]>2019-09-14 18:21:05 +0200
commit49af57d546b5e2fd5aaa9fcd43d09060b9682c5a (patch)
treea59b73e1039fe33081491bf2a55621a7d2563356 /test/req_SUITE.erl
parent4427108b69fcd1e6a8233a217fa0e99d0564b714 (diff)
downloadcowboy-49af57d546b5e2fd5aaa9fcd43d09060b9682c5a.tar.gz
cowboy-49af57d546b5e2fd5aaa9fcd43d09060b9682c5a.tar.bz2
cowboy-49af57d546b5e2fd5aaa9fcd43d09060b9682c5a.zip
Implement backpressure on cowboy_req:stream_body
This should limit the amount of memory that Cowboy is using when a handler is sending data much faster than the network. The new max_stream_buffer_size is a soft limit and only has an effect when the cowboy_stream_h handler is used.
Diffstat (limited to 'test/req_SUITE.erl')
-rw-r--r--test/req_SUITE.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/req_SUITE.erl b/test/req_SUITE.erl
index a30e33f..cbb0991 100644
--- a/test/req_SUITE.erl
+++ b/test/req_SUITE.erl
@@ -98,7 +98,7 @@ do_get(Path, Headers, Config) ->
Ref = gun:get(ConnPid, Path, [{<<"accept-encoding">>, <<"gzip">>}|Headers]),
{response, IsFin, Status, RespHeaders} = gun:await(ConnPid, Ref),
{ok, RespBody} = case IsFin of
- nofin -> gun:await_body(ConnPid, Ref);
+ nofin -> gun:await_body(ConnPid, Ref, 30000);
fin -> {ok, <<>>}
end,
gun:close(ConnPid),
@@ -891,6 +891,11 @@ stream_body_multiple(Config) ->
{200, _, <<"Hello world!">>} = do_get("/resp/stream_body/multiple", Config),
ok.
+stream_body_loop(Config) ->
+ doc("Streamed body via a fast loop."),
+ {200, _, <<0:32000000/unit:8>>} = do_get("/resp/stream_body/loop", Config),
+ ok.
+
stream_body_nofin(Config) ->
doc("Unfinished streamed body."),
{200, _, <<"Hello world!">>} = do_get("/resp/stream_body/nofin", Config),