mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
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.
This commit is contained in:
parent
03a3bf4474
commit
2558ba65ad
4 changed files with 36 additions and 27 deletions
|
@ -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 => <<>>}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue