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
|
@ -1472,10 +1472,12 @@ early_error(StatusCode0, State=#state{socket=Socket, transport=Transport,
|
|||
|
||||
initiate_closing(State=#state{streams=[]}, Reason) ->
|
||||
terminate(State, Reason);
|
||||
initiate_closing(State=#state{streams=[_Stream|Streams],
|
||||
initiate_closing(State=#state{streams=Streams,
|
||||
out_streamid=OutStreamID}, Reason) ->
|
||||
terminate_all_streams(State, Streams, Reason),
|
||||
State#state{last_streamid=OutStreamID}.
|
||||
{value, LastStream, TerminatedStreams}
|
||||
= lists:keytake(OutStreamID, #stream.id, Streams),
|
||||
terminate_all_streams(State, TerminatedStreams, Reason),
|
||||
State#state{streams=[LastStream], last_streamid=OutStreamID}.
|
||||
|
||||
%% Function replicated in cowboy_http2.
|
||||
maybe_socket_error(State, {error, closed}) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue