0
Fork 0
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:
Dmitri Vereshchagin 2022-10-06 00:24:43 +03:00 committed by Loïc Hoguin
parent 03a3bf4474
commit 2558ba65ad
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
4 changed files with 36 additions and 27 deletions

View file

@ -157,6 +157,12 @@ raw_recv_head(Socket, Transport, Buffer) ->
Buffer
end.
raw_recv_rest({raw_client, _, _}, Length, Buffer) when Length =:= byte_size(Buffer) ->
Buffer;
raw_recv_rest({raw_client, Socket, Transport}, Length, Buffer) when Length > byte_size(Buffer) ->
{ok, Data} = Transport:recv(Socket, Length - byte_size(Buffer), 10000),
<< Buffer/binary, Data/binary >>.
raw_recv({raw_client, Socket, Transport}, Length, Timeout) ->
Transport:recv(Socket, Length, Timeout).