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 /src | |
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 'src')
-rw-r--r-- | src/cowboy_http.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index 8dd2870..abaab06 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -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}) -> |