0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Move the pipeline test to the rfc7230 suite

This commit is contained in:
Loïc Hoguin 2017-11-23 18:50:07 +01:00
parent c4e43ec26a
commit 14173d5929
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
2 changed files with 21 additions and 14 deletions

View file

@ -377,12 +377,6 @@ parse_host(Config) ->
end || {Host, Body} <- Tests], end || {Host, Body} <- Tests],
ok. 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) -> rest_param_all(Config) ->
ConnPid = gun_open(Config), ConnPid = gun_open(Config),
%% Accept without param. %% Accept without param.

View file

@ -1417,14 +1417,27 @@ limit_requests_keepalive(Config) ->
%%A server that doesn't want to read the entire body of a message %%A server that doesn't want to read the entire body of a message
%%must close the connection, if possible after sending the "close" %%must close the connection, if possible after sending the "close"
%%connection option in the response. (RFC7230 6.3) %%connection option in the response. (RFC7230 6.3)
%
%pipeline(Config) -> pipeline(Config) ->
%%% @todo pipeline_parallel (safe methods can, others can't) doc("A server can receive more than one request before any response "
%A server can receive more than one request before any response "is sent. This is called pipelining. Responses must be sent "
%is sent. This is called pipelining. The requests can be processed "in the same order as the requests. (RFC7230 6.3.2)"),
%in parallel if they all have safe methods. Responses must be sent ConnPid = gun_open(Config),
%in the same order as the requests. (RFC7230 6.3.2) 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 %@todo
%The server must reject abusive traffic by closing the connection. %The server must reject abusive traffic by closing the connection.
%Abusive traffic can come from the form of too many requests in a %Abusive traffic can come from the form of too many requests in a