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

Fix request_timeout triggering when a request was in the buffer

The problem was that when a request immediately following another
request with a large enough body, the data for the new request
(including headers) would be buffered waiting for more data,
instead of being processed immediately. If no more data came
in on the socket the request_timeout would eventually trigger.
Now the buffer is processed immediately.
This commit is contained in:
Loïc Hoguin 2025-02-06 12:18:59 +01:00
parent 9d4912208e
commit 8e121d138c
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
2 changed files with 23 additions and 2 deletions

View file

@ -436,8 +436,8 @@ after_parse({data, StreamID, IsFin, Data, State0=#state{opts=Opts, buffer=Buffer
end;
%% No corresponding stream. We must skip the body of the previous request
%% in order to process the next one.
after_parse({data, _, IsFin, _, State}) ->
loop(set_timeout(State, case IsFin of
after_parse({data, StreamID, IsFin, _, State=#state{buffer=Buffer}}) ->
parse(Buffer, set_timeout(State, case IsFin of
fin -> request_timeout;
nofin -> idle_timeout
end));