diff options
author | Loïc Hoguin <[email protected]> | 2017-11-23 18:50:07 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-11-23 18:50:07 +0100 |
commit | 14173d592999bb0478d8e2a7d7334800ee26057c (patch) | |
tree | c94c2b2098521f7e79e295a759fc1c0a690e46f0 | |
parent | c4e43ec26ad5193b9665f159d294d133a2d34a85 (diff) | |
download | cowboy-14173d592999bb0478d8e2a7d7334800ee26057c.tar.gz cowboy-14173d592999bb0478d8e2a7d7334800ee26057c.tar.bz2 cowboy-14173d592999bb0478d8e2a7d7334800ee26057c.zip |
Move the pipeline test to the rfc7230 suite
-rw-r--r-- | test/http_SUITE.erl | 6 | ||||
-rw-r--r-- | test/rfc7230_SUITE.erl | 29 |
2 files changed, 21 insertions, 14 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index 33e7183..4370ab2 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -377,12 +377,6 @@ parse_host(Config) -> end || {Host, Body} <- Tests], ok. -pipeline(Config) -> - ConnPid = gun_open(Config), - Refs = [gun:get(ConnPid, "/") || _ <- lists:seq(1, 5)], - _ = [{response, nofin, 200, _} = gun:await(ConnPid, Ref) || Ref <- Refs], - ok. - rest_param_all(Config) -> ConnPid = gun_open(Config), %% Accept without param. diff --git a/test/rfc7230_SUITE.erl b/test/rfc7230_SUITE.erl index cdf9c89..f6344c7 100644 --- a/test/rfc7230_SUITE.erl +++ b/test/rfc7230_SUITE.erl @@ -1417,14 +1417,27 @@ limit_requests_keepalive(Config) -> %%A server that doesn't want to read the entire body of a message %%must close the connection, if possible after sending the "close" %%connection option in the response. (RFC7230 6.3) -% -%pipeline(Config) -> -%%% @todo pipeline_parallel (safe methods can, others can't) -%A server can receive more than one request before any response -%is sent. This is called pipelining. The requests can be processed -%in parallel if they all have safe methods. Responses must be sent -%in the same order as the requests. (RFC7230 6.3.2) -% + +pipeline(Config) -> + doc("A server can receive more than one request before any response " + "is sent. This is called pipelining. Responses must be sent " + "in the same order as the requests. (RFC7230 6.3.2)"), + ConnPid = gun_open(Config), + Refs = [{ + gun:get(ConnPid, "/"), + gun:delete(ConnPid, "/echo/method") + } || _ <- lists:seq(1, 25)], + _ = [begin + {response, nofin, 200, _} = gun:await(ConnPid, Ref1), + {ok, <<"Hello world!">>} = gun:await_body(ConnPid, Ref1), + {response, nofin, 200, _} = gun:await(ConnPid, Ref2), + {ok, <<"DELETE">>} = gun:await_body(ConnPid, Ref2) + end || {Ref1, Ref2} <- Refs], + ok. + +%% @todo pipeline_parallel (safe methods can, others can't) +%The requests can be processed in parallel if they all have safe methods. + %@todo %The server must reject abusive traffic by closing the connection. %Abusive traffic can come from the form of too many requests in a |