0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Make sure we don't send error_responses on the wrong stream

This commit is contained in:
Loïc Hoguin 2018-10-31 15:35:49 +01:00
parent 5ab5615ff0
commit 30e117a942
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764

View file

@ -899,7 +899,8 @@ commands(State, StreamID, [{flow, _Length}|Tail]) ->
commands(State, StreamID, Tail); commands(State, StreamID, Tail);
%% Error responses are sent only if a response wasn't sent already. %% Error responses are sent only if a response wasn't sent already.
commands(State=#state{out_state=wait}, StreamID, [{error_response, Status, Headers0, Body}|Tail]) -> commands(State=#state{out_state=wait, out_streamid=StreamID}, StreamID,
[{error_response, Status, Headers0, Body}|Tail]) ->
%% We close the connection when the error response is 408, as it %% We close the connection when the error response is 408, as it
%% indicates a timeout and the RFC recommends that we stop here. (RFC7231 6.5.7) %% indicates a timeout and the RFC recommends that we stop here. (RFC7231 6.5.7)
Headers = case Status of Headers = case Status of