Commit Graph

121 Commits

Author SHA1 Message Date
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
Thales Fragoso fde7934243
Add option to allow/disallow half closures in HTTP/1 (#3777)
* Add ServiceConfigBuilder to facilitate future extensions

Signed-off-by: Thales Fragoso <thales.fragoso@axiros.com>

* Add option to allow/disallow h1 half closures

The default is set to allow, thus reverting a change made in 3.11.1

Signed-off-by: Thales Fragoso <thales.fragoso@axiros.com>

* Add tests for h1 half closures

Signed-off-by: Thales Fragoso <thales.fragoso@axiros.com>

* Comply with clippy

Signed-off-by: Thales Fragoso <thales.fragoso@axiros.com>

* Adjust imports to satisfy fmt

Signed-off-by: Thales Fragoso <thales.fragoso@axiros.com>

---------

Signed-off-by: Thales Fragoso <thales.fragoso@axiros.com>
2025-10-04 23:03:26 +00:00
yanyuxing 30f7df5853
fix(actix-http): wake before return pending when read half disconnect and need to shutdown (#3665) 2025-08-23 00:56:39 +00:00
Rob Ede c1a6388614
refactor: address clippy warnings 2024-05-06 06:03:44 +01:00
Rob Ede 022b052bd9
chore: clippy 2024-02-12 23:02:45 +00:00
Rob Ede d9b31b80ac
fix: standardize body stream error reporting 2024-02-04 03:11:48 +00:00
Rob Ede 79a38e0628
apply standard formatting 2023-07-17 02:38:12 +01:00
Rob Ede 6fdda45ca3
update bitflags to v2 2023-05-06 11:38:51 +01:00
Rob Ede a2e2c30d59
use tokio-util deps directly where possible 2022-10-30 19:47:49 +00:00
Rob Ede 8ff489aa90
apply fix from #2369 2022-07-24 16:35:00 +01:00
Rob Ede 264a703d94
revert broken fix in #2624 (#2779)
* revert broken fix in #2624

* update changelog
2022-06-11 13:43:13 +01:00
Rob Ede 80d222aa78
use tracing in actix-http 2022-03-10 03:12:29 +00:00
Rob Ede 49cd303c3b
fix dispatcher panic when conbining pipelining and keepalive
fixes #2678
2022-03-04 03:12:38 +00:00
Rob Ede 1ce58ecb30
fix dispatcher panic on pending flush
fixes thread panic in actix-http-3.0.0-rc.3 #2655
2022-02-22 00:19:48 +00:00
Rob Ede 5ca42df89a
fix stuck connection when handler doesn't read payload (#2624) 2022-02-03 07:03:39 +00:00
Rob Ede 3200de3f34
fix request head timeout (#2611) 2022-01-31 17:30:34 +00:00
Rob Ede 14a4f325d3
move dispatcher tests to own file 2022-01-27 06:06:55 +00:00
Rob Ede 1296e07c48
relax unpin bounds on payload types (#2545) 2021-12-24 17:47:47 +00:00
Ali MJ Al-Nasrawy 57ea322ce5
simplify MessageBody::complete_body interface (#2522) 2021-12-17 19:09:08 +00:00
Rob Ede 2cf27863cb
remove direct dep on pin-project in -http (#2524) 2021-12-17 14:13:54 +00:00
Rob Ede 5359fa56c2
include source for dispatch body errors 2021-12-17 01:29:41 +00:00
Rob Ede 406f694095
standardize rustfmt max_width 2021-12-08 06:01:11 +00:00
Rob Ede e49e559f47
fix some docs 2021-12-08 05:43:50 +00:00
Rob Ede d35b7644dc
add connection level data container (#2491) 2021-12-07 17:23:34 +00:00
Rob Ede 2d053b7036
remove `actix_http::http` module (#2488) 2021-12-05 14:37:20 +00:00
Rob Ede c7c02ef99d
body ergonomics v3 (#2468) 2021-12-04 19:40:47 +00:00
Rob Ede d8cbb879dd
make `AnyBody` generic on `Body` type (#2448) 2021-11-16 21:41:35 +00:00
Rob Ede 4df1cd78b7
simplify `AnyBody` and `BodySize` (#2446) 2021-11-16 09:21:10 +00:00
Rob Ede efdf3ab1c3
clippy 2021-10-19 01:32:58 +01:00
Rob Ede 5128b1bdfc
bump msrv to 1.51 2021-08-30 23:19:03 +01:00
Igor Aleksanov 262c6bc828
Various refactorings (#2281)
Co-authored-by: Rob Ede <robjtede@icloud.com>
2021-06-26 15:33:43 +01:00
Rob Ede 532f7b9923
refined error model (#2253) 2021-06-17 17:57:58 +01:00
fakeshadow 3847429d00
Response::from_error take impl Into<Error> (#2214) 2021-05-26 13:41:48 +09:00
Rob Ede 900c9e270e
remove responsebody indirection from response (#2201) 2021-05-09 20:12:48 +01:00
Rob Ede ddaf8c3e43
add associated error type to MessageBody (#2183) 2021-05-05 18:36:02 +01:00
fakeshadow a9f26286f9
reduce branches in h1 dispatcher poll_keepalive (#2089) 2021-04-14 05:20:45 +01:00
Rob Ede 23e0c9b6e0
remove http-codes builders from actix-http (#2159) 2021-04-14 02:00:14 +01:00
Rob Ede edd9f14752
remove unpin from body types (#2152) 2021-04-13 11:16:12 +01:00
Rob Ede 44c55dd036
remove cookie support from -http (#2065) 2021-04-09 18:07:10 +01:00
Rob Ede c8ed8dd1a4
migrate to -utils beta 4 (#2127) 2021-04-01 15:26:13 +01:00
fakeshadow 515d0e3fb4
change behavior of default upgrade handler (#2071) 2021-03-13 22:20:18 +00:00
fakeshadow f62a982a51
simplify the match on h1 message type (#2006) 2021-02-18 10:38:27 +00:00
fakeshadow dfa795ff9d
return poll in poll_flush (#2005) 2021-02-17 11:18:31 +00:00
fakeshadow 68d1bd88b1
remove unused flag upgrade (#1992) 2021-02-14 18:13:05 +00:00
fakeshadow 308b70b039
fix potential over read (#1991) 2021-02-14 17:36:18 +00:00
fakeshadow 95113ad12f
do not self wake up when have a payload (#1984) 2021-02-12 20:33:13 +00:00
fakeshadow ce9b2770e2
remove unused Dispatcher::new_timeout (#1985) 2021-02-12 10:37:28 +00:00
Rob Ede c1af5089b9
add 431 and 451 status codes 2021-02-11 22:58:40 +00:00
Rob Ede 77efc09362
hide httpmessage mod 2021-02-11 22:58:40 +00:00
Rob Ede 871ca5e4ae
stop claiming actor support 2021-02-11 22:58:40 +00:00