You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
actix-http: h1: stop pipelining when not reading full requests (#3721)
* actix-http: h1: stop pipelining when not reading full requests
The existing pipelining behavior of the h1 dispatcher can cause client timeouts
if the entire request body isn't read. It puts the dispatcher into a state where
it refuses to read more (payload dropped) but there are still bytes in the buffer
from the request body.
This solution adds the SHUTDOWN flag in addition to the FINISHED flag
when completing a response when both the following are true:
1. There are no messages in `this.messages`
2. There is still a payload in `this.payload`
This combination implies two things. First, that we have not parsed a
pipelined request after the request we have just responded to. Second,
that the current request payload has not been fed an EOF. Because there
are no pipelined requests, we know that the current request payload
belongs to the request we have just responded to, and because the
request payload has not been fed an EOF, we know we never finished
reading it.
When this occurs, adding the SHUTDOWN flag to the dispatcher triggers a
`flush` and a `poll_shutdown` on the IO resource on the next poll.
* Remove printlns from dispatcher
* Add test that fails without changes & passes with changes
* Add changelog entry for h1 shutdown
---------
Co-authored-by: Rob Ede <[email protected]>
Co-authored-by: Yuki Okushi <[email protected]>
0 commit comments