From 19faf0ae7f123b6e20fca0d77a4bd2ec5d7495b3 Mon Sep 17 00:00:00 2001 From: Alexandre Rodrigues Date: Wed, 5 Feb 2020 13:41:49 +0100 Subject: [PATCH] fix badarith on commands --- src/cowboy_http.erl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index 9f0b865d..ccdf6155 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -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