diff options
author | Dmitri Vereshchagin <[email protected]> | 2022-10-06 00:24:43 +0300 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2023-12-18 15:39:39 +0100 |
commit | 2558ba65ad3e39dd10ab65196af8f4dbb067f476 (patch) | |
tree | 3ce5bbafdd6735fac59925049bc7bb978a0dce5a /test/rfc7230_SUITE.erl | |
parent | 03a3bf4474a6ab30b8f66c2cc3051f61678b290a (diff) | |
download | cowboy-2558ba65ad3e39dd10ab65196af8f4dbb067f476.tar.gz cowboy-2558ba65ad3e39dd10ab65196af8f4dbb067f476.tar.bz2 cowboy-2558ba65ad3e39dd10ab65196af8f4dbb067f476.zip |
Fix shutdown for HTTP/1.1 pipeline
Sending extra response prevented by terminating all streams except
the one currently executing.
LH: Reworded some variables to make what happens more obvious.
Diffstat (limited to 'test/rfc7230_SUITE.erl')
-rw-r--r-- | test/rfc7230_SUITE.erl | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/test/rfc7230_SUITE.erl b/test/rfc7230_SUITE.erl index ed3fff3..50a6c71 100644 --- a/test/rfc7230_SUITE.erl +++ b/test/rfc7230_SUITE.erl @@ -22,6 +22,7 @@ -import(cowboy_test, [raw_open/1]). -import(cowboy_test, [raw_send/2]). -import(cowboy_test, [raw_recv_head/1]). +-import(cowboy_test, [raw_recv_rest/3]). -import(cowboy_test, [raw_recv/3]). suite() -> @@ -63,13 +64,7 @@ do_raw(Config, Data) -> {Headers, Rest2} = cow_http:parse_headers(Rest), case lists:keyfind(<<"content-length">>, 1, Headers) of {_, LengthBin} when LengthBin =/= <<"0">> -> - Length = binary_to_integer(LengthBin), - Body = if - byte_size(Rest2) =:= Length -> Rest2; - true -> - {ok, Body0} = raw_recv(Client, Length - byte_size(Rest2), 5000), - << Rest2/bits, Body0/bits >> - end, + Body = raw_recv_rest(Client, binary_to_integer(LengthBin), Rest2), #{client => Client, version => Version, code => Code, reason => Reason, headers => Headers, body => Body}; _ -> #{client => Client, version => Version, code => Code, reason => Reason, headers => Headers, body => <<>>} |