Commit Graph
1799 Commits
Author SHA1 Message Date
e43030d051 websocket: add a wrapper around is_terminated (#3443)
Co-authored-by: Loic <[email protected]>
Co-authored-by: loikki <[email protected]>
2025-09-16 15:54:44 +00:00
othelot ab593bbab7 routing: omit the Allow header for non-405 method not allowed fallbacks (#3465) 2025-09-16 08:29:01 +00:00
Søren Løvborg 1073468163 axum::serve: Enable Hyper request header timeout (#3478)
It's possible for an HTTP request to get stuck (due to network issues or
malicious clients) halfway through the request line or header, in which
case no amount of timeouts configured by an application using axum/tower
will help, since Hyper hasn't yet handed off the request to the service.

This has two consequences:

- Wasted memory: Up to ~1 MB per connection in the worst case, compared
  to the ~2.5 kB used by a regular idle connection.

- A `with_graceful_shutdown` signal will cause the server to stop
  accepting new requests, but then hang instead of actually stopping.

This changes axum::serve to configure a Timer for HTTP/1 connections,
which activates Hyper's default timeout (currently 30 seconds).

The timeout applies only to the request line and request header, not the
request body or subsequent response (where axum applications can instead
simply configure a timeout using `tower_http::timeout::TimeoutLayer`).

The timeout does not currently apply to newly opened connections, even
though Hyper's `header_read_timeout` SHOULD apply here too since 1.4.0;
discussion on tokio-rs#2741 suggests a possible TokioIo issue. However, the
graceful shutdown still works as expected for such connections.

The timer is only enabled for HTTP/1 here since similar functionality
does not currently appear to exist for HTTP/2 connections in Hyper.

This is a breaking change for any axum::serve users who currently rely
on being able to begin sending a HTTP/1 request, and then take more than
30 seconds to finish the request line and headers, or rely on keeping
connections idle for 30+ seconds between requests.
2025-09-16 10:19:20 +02:00
David Mládek 5c090dcb3e axum-extra: make option_layer guarantee that the output body is axum::body::Body 2025-09-14 19:50:04 +02:00
David Mládek 853d7e707a axum: add ResponseAxumBodyLayer for mapping response body to axum::body::Body 2025-09-14 19:50:04 +02:00
Jonas Platte 4ab8df5e42 Switch serde dependency to serde_core (#3477) 2025-09-14 08:49:07 +02:00
K-tecchan 94af9c3262 axum: correct typo in append_allow_header (#3476) 2025-09-13 14:27:43 +00:00
tottoto d5e505619f Update to cargo-deny api version 2 (#3475) 2025-09-13 14:48:25 +02:00
tottoto e8ab6029d1 examples: Update to askama 0.14 (#3474) 2025-09-13 13:19:19 +02:00
tottoto 8d0497f793 examples: Update to brotli 8 (#3473) 2025-09-13 10:29:21 +02:00
tottoto 1b844c9fc6 examples: Update to metrics 0.24 (#3472) 2025-09-13 10:06:19 +02:00
tottoto 83d19e7b4f examples: Update to redis 0.32 (#3471) 2025-09-13 09:06:00 +02:00
tottoto 038f0966a8 examples: Update to diesel-async 0.6 (#3470) 2025-09-12 17:03:33 +02:00
tottoto 14f15252ee Remove resolved cargo-deny skip-tree config of tracing-subscriber (#3468) 2025-09-12 13:23:09 +00:00
tottoto 490cde6048 examples: Update to axum-server 0.7 (#3467) 2025-09-12 15:18:33 +02:00
tottoto a0748e5a74 examples: Update to tower-http 0.6 (#3466) 2025-09-12 13:44:24 +02:00
Niclas Klugmann 25acc8d131 Clarify that AddExtension is not the actual Layer (#3463) 2025-09-12 09:21:19 +02:00
tottoto e4550d23b1 examples: Update to oauth2 5 (#3462) 2025-09-11 15:34:41 +02:00
Joel Uckelman 5d5ba01be9 Add axum_extra::extract::Query::try_from_uri (#3460)
`axum::extract::Query` has a try_from_uri, which is useful for testing. This adds the same function to `axum_extra::extract::Query`.
2025-09-08 10:18:31 +02:00
Kenny Lau 64ae48347e Fix typo in file_stream error message (#3459) 2025-09-07 12:49:22 +02:00
Canmi 3fc8e4ae0a Add axum-governor to community maintained axum ecosystem (#3456) 2025-09-05 10:10:56 +02:00
tottoto 8f707ca9fd ci: Refactor dependencies-are-sorted job (#3445) 2025-09-05 00:13:45 +02:00
Antoine Vandecreme 86868de80e Reject JSON bodies with trailing chars (#3453) 2025-09-02 19:34:17 +00:00
Antoine Vandecreme 49c8facad3 Bump tracing-subscriber (#3454) 2025-09-02 13:01:31 -04:00
baerwang ee1519c82f Add openapi-rs to ECOSYSTEM.md (#3414) 2025-08-30 13:29:14 +00:00
tottoto 94db5273a5 ci: Update to actions/checkout v5 (#3450) 2025-08-28 15:41:09 +02:00
Poliorcetics 9ec85d6970 fix(axum-extra): don't require S generic param when using FileStream::from_path() (#3437) 2025-08-17 07:14:07 +02:00
Patrik LundinandDavid Mládek 4b0590b30e examples/prometheus-metrics: run upkeep task (#3430)
Co-authored-by: David Mládek <[email protected]>
2025-08-14 12:42:01 +00:00
Lukas BergdollandDavid Mládek a57935c039 Generalize Connected implementation to all Listeners for SocketAddr (#3331)
Co-authored-by: David Mládek <[email protected]>
2025-08-14 13:01:04 +02:00
reivilibre 76268ae52b Document type parameter T on Handler (#3435)
Signed-off-by: Olivier 'reivilibre <[email protected]>
2025-08-14 11:10:52 +02:00
Glen De Cauwsemaecker dfc15bce9d Support custom (binary) data to be written into SSE Event (#3425) 2025-08-13 23:32:08 +02:00
Glen De Cauwsemaecker d66cabd5e9 Fix ci failures (#3432) 2025-08-13 10:53:53 +02:00
Theodore Bjernhed 7f5cea0e6b Update and centralize the LICENSE file to the repo root (#3401) 2025-08-12 23:31:12 +02:00
Jan Runge 2977bd4adf Extractors doc: correct linked example section (#3349) 2025-08-01 21:47:55 +00:00
Jonas Platte ff031867df Update minimum Rust version to 1.78 (#3412) 2025-07-20 07:47:56 +00:00
Yann Simon 3bd445d9ee remove unused dep in tls examples (#3411) 2025-07-17 12:51:12 +00:00
chenlunfu d9609d754f Add qiluo-admin to ECOSYSTEM.md (#3409) 2025-07-16 13:37:44 -04:00
Kyle Nweeia 0832de443c Use via extractor's rejection instead of axum::response::Response (#3261) 2025-07-16 09:50:59 +00:00
Theodore Bjernhed 6bc0717b06 Improve value and reference passing efficiency (#3406) 2025-07-11 05:38:45 +02:00
Glen De Cauwsemaecker 420d7b6aaa Update ECOSYSTEM.md: Add datastar with axum support (#3383) 2025-07-09 19:16:12 +00:00
Theodore Bjernhed 1b157a461e Enable and fix control flow related clippy lints 2025-07-09 18:48:28 +00:00
Glen De Cauwsemaecker 617594cd4a sse: Add space between duration and : (#3403) 2025-07-09 12:20:05 +02:00
Theodore BjernhedandTheodore Bjernhed fb64e72de9 Add #[must_use] to types and methods (#3395)
Co-authored-by: Theodore Bjernhed <[email protected]>
2025-07-05 19:07:24 +02:00
tottoto d7104313cb Update tokio-tungstenite to 0.27 (#3398) 2025-07-05 16:47:42 +02:00
Theodore Bjernhed 0f255c3c4c style: use Self to avoid unnecessary repetition (#3396) 2025-07-04 21:10:01 +00:00
Theodore Bjernhed b8d9a3e764 style: Reorder macro-generated items to fix lints (#3392) 2025-07-01 23:01:54 +02:00
zeon 7dc70bf0d3 New redirect inspection (#3377) 2025-06-27 19:04:46 +00:00
lee suk-jae 6d78e84398 Add Axum Clean Demo to project showcase (#3371) 2025-06-08 11:35:53 +02:00
David Mládek fc14f5c728 axum: add router nesting fallback changelog (#3339) 2025-06-03 21:16:36 +00:00
Sabrina Jewson 8202c66a4d Add DefaultBodyLimit::apply (#3368) 2025-06-03 14:21:22 +02:00