mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix HTTP/1.1 bug when a flow command is returned after fin
This resulted in a badarith error due to the current flow being set to infinity when the body has been fully read. A test case has been added reproducing the issue.
This commit is contained in:
parent
47ecfd7318
commit
8fc3da2fc3
3 changed files with 20 additions and 0 deletions
|
@ -970,6 +970,9 @@ commands(State=#state{out_streamid=Current, streams=Streams0}, StreamID, Command
|
|||
Streams = lists:keyreplace(StreamID, #stream.id, Streams0,
|
||||
Stream#stream{queue=Queue ++ Commands}),
|
||||
State#state{streams=Streams};
|
||||
%% When we have finished reading the request body, do nothing.
|
||||
commands(State=#state{flow=infinity}, StreamID, [{flow, _}|Tail]) ->
|
||||
commands(State, StreamID, Tail);
|
||||
%% Read the request body.
|
||||
commands(State0=#state{flow=Flow0}, StreamID, [{flow, Size}|Tail]) ->
|
||||
%% We must read *at least* Size of data otherwise functions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue