actix-web/actix-http/src
asonix 4df9953c86
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 <robjtede@icloud.com>
Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2025-10-05 01:07:35 +00:00
..
body chore: address clippy lints 2025-05-09 20:21:02 +01:00
encoding chore: address clippy lints 2025-05-09 20:21:02 +01:00
h1 actix-http: h1: stop pipelining when not reading full requests (#3721) 2025-10-05 01:07:35 +00:00
h2 chore: move deny lints to manifests 2024-07-07 03:54:00 +01:00
header build(deps): update derive_more requirement from 1 to 2 (#3571) 2025-02-10 01:27:56 +00:00
requests ci: faster cargo-public-api install (#3255) 2024-01-22 02:19:19 +00:00
responses test: fix tests based on mime-guess inference 2024-06-30 20:28:11 +01:00
ws Fix integer overflow in actix_http::ws::Parser::parse (#3728) 2025-08-22 06:24:22 +00:00
builder.rs Add option to allow/disallow half closures in HTTP/1 (#3777) 2025-10-04 23:03:26 +00:00
config.rs Add option to allow/disallow half closures in HTTP/1 (#3777) 2025-10-04 23:03:26 +00:00
date.rs perf: remove unnecessary allocation when writing http dates (#3261) 2024-02-07 03:47:30 +00:00
error.rs chore: address clippy lints 2025-05-09 20:21:02 +01:00
extensions.rs Add `Extensions::get_or_insert[_with]()` methods (#3561) 2025-02-09 22:04:21 +00:00
helpers.rs chore: address clippy warnings 2024-12-29 15:03:43 +00:00
http_message.rs chore: address clippy warnings 2024-12-29 15:03:43 +00:00
keep_alive.rs add ws and http2 feature flags (#2618) 2022-01-31 21:22:23 +00:00
lib.rs Add option to allow/disallow half closures in HTTP/1 (#3777) 2025-10-04 23:03:26 +00:00
message.rs chore: move deny lints to manifests 2024-07-07 03:54:00 +01:00
notify_on_drop.rs chore: clippy 2024-02-12 23:02:45 +00:00
payload.rs Add from_bytes/u8_bytes to dev::Payload (#3595) 2025-03-09 16:40:00 +00:00
service.rs chore: disallow e bindings 2024-08-10 05:15:49 +01:00
test.rs Add option to allow/disallow half closures in HTTP/1 (#3777) 2025-10-04 23:03:26 +00:00