Commit Graph
1940 Commits
Author SHA1 Message Date
Adrian Garcia BadaraccoandClaude Opus 4.7 e5410160df refactor(axum): hoist std::hash import to the top of the module
Move the `BuildHasher`/`Hasher` import out of `random_duration` and into
the module-level `use` block.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-26 12:00:50 -05:00
Adrian Garcia BadaraccoandClaude Opus 4.7 d46e0fc99c docs(axum): add changelog entry; gate TokioTimer import to http1
Add the CHANGELOG entry for `ConnectionLimits` (#3779), and gate the
`TokioTimer` import under `feature = "http1"` since it is only used there,
fixing a pre-existing unused-import warning in http2-only builds.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-26 11:53:37 -05:00
Adrian Garcia BadaraccoandClaude Opus 4.7 8d9adb0b7b feat(axum): add ConnectionLimits for bounding connection lifetime
Add `axum::serve::ConnectionLimits`, applied via `Serve::connection_limits`
(and the `WithGracefulShutdown` equivalent), to bound the lifetime of
individual connections and force clients to rotate connections.

This is useful behind a load balancer that round-robins new connections
across backends: without rotation a client's connection pool keeps sending
work to the backends it first connected to, even after the pool has scaled
up. It mirrors tonic's `max_connection_age` and Envoy's
`max_connection_duration`.

Three knobs are supported:

- `max_connection_age`: soft cap on total connection lifetime. When it
  elapses the connection is gracefully shut down (HTTP/1 `Connection: close`
  after the in-flight request, HTTP/2 `GOAWAY`).
- `max_connection_age_jitter`: random per-connection jitter added to the age
  limit, to avoid synchronized reconnect storms.
- `max_connection_age_grace`: hard cap on how long to wait for in-flight work
  after the age limit fires before forcibly closing.

The mechanism reuses hyper's per-connection `graceful_shutdown`, the same
primitive `with_graceful_shutdown` already uses. Jitter uses `RandomState`
for cheap randomness without a new dependency.

Closes #3753

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-26 11:52:27 -05:00
tottoto b99e25d01f examples: Update to sqlx 0.9 (#3539) 2026-05-22 09:21:54 +02:00
Hugo MaandHugo Ma 7eee934487 fix(examples): add missing sink feature for futures-channel in example-testing-websockets (#3773)
Co-authored-by: Hugo Ma <[email protected]>
2026-05-18 17:33:17 +02:00
David Pedersen d97edd2eb3 chore: write changelogs manually (#3764) 2026-05-18 10:38:29 +02:00
吴杨帆andCursor c21fcae087 docs(axum): document that path must start with / in Router::route (#3771)
Co-authored-by: Cursor <[email protected]>
2026-05-17 10:51:06 +02:00
吴杨帆andCursor 16313be447 docs(axum-extra): clarify cookie-key-expansion for Key::derive_from (fixes #2646) (#3769)
Co-authored-by: Cursor <[email protected]>
2026-05-17 10:41:49 +02:00
patelshudhanshu1999-maker 6ed9210351 fix(axum-macros): use OptionalFromRequest for Option<T> fields (#3760) 2026-05-16 23:33:44 +02:00
ZelysandClaude Sonnet 4.6 a480d71f6d examples: fix using_serve_dir_with_assets_fallback to not expose assets at root (#3762)
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
2026-05-16 22:54:23 +02:00
tottoto 7a37cdd00a examples: Update to diesel-async 0.9 (#3759) 2026-05-15 16:14:10 +02:00
David Pedersen 5bc0046084 chore: fix typos (#3758) 2026-05-15 12:32:46 +00:00
David Pedersen c8276951b0 feat: Add RawPathParams::from_request_extensions (#3757) 2026-05-15 12:46:49 +02:00
Lorenz Leutgeb c2612e2839 feat: Introduce Bodies of Unknown Size 2026-05-15 10:13:47 +02:00
David Pedersen c853e44ffc chore: use a more recent nightly for axum-macros tests 2026-05-05 15:16:24 +02:00
Yann Simon 9b203a8912 integrate release-plz (#3739) 2026-05-05 13:16:39 +02:00
David Pedersen 986abe8df6 refactor: remove duplication between IntoResponse and IntoResponseParts for Redirect (#3743) 2026-05-02 19:19:13 +02:00
shonya3 5f679ce0fb chore: Remove ECOSYSTEM.md mentions from README.md (#3744) 2026-05-02 18:41:49 +02:00
Dihan Nahdi b0123f7051 feat: impl IntoResponseParts for Redirect (#3721) 2026-05-02 17:46:22 +02:00
Dihan Nahdi bff1764b70 test: add serve module integration tests (#3724) 2026-05-02 15:34:42 +00:00
David Pedersen 9f4d52e310 remove ECOSYSTEM.md (#3737) 2026-04-27 15:09:02 +00:00
Julián Montes de Oca de9f13d809 Add Serve::with_executor and Executor trait for custom task spawning (#3704)
## Motivation

axum::serve hardcodes TokioExecutor for spawning connection tasks and hyper's internal HTTP/2 tasks. This is the one thing that cannot be customized by wrapping axum's API from the outside, users are forced to reimplement the entire serve loop (~150 lines) just to swap the executor.

This is needed for use cases like runtime telemetry (e.g. dial9-tokio-telemetry) where we want to wrap task spawning, so that we can capture things like wake events.

The goal of this feature is to allow hooking into the current tokio spawns (by being able to set an executor that provides them, rather than hardcoding them) to attach instrumentation. The goal is not the make serve fully runtime agnostic.

## Solution

This PR adds Serve::with_executor() and WithGracefulShutdown::with_executor() builder methods that take an Executor, and an axum::serve::Executor trait for defining the Executor interface.

The default remains a new TokioExecutor (that spawns tokio spawns just like before), so we maintain backward compatibility.

Small design note: this defines a new axum::serve::Executor trait rather than reuse of hyper::rt::Executor<Fut> directly, because the latter is generic at the trait level and I couldn't find a way to bound E to cover all the internal future types hyper needs. So this new trait uses a generic method instead, and then a HyperExecutor<E> adapter bridges to hyper.
2026-04-20 14:49:30 +02:00
Dihan Nahdi 309d1bd953 feat: add #[diagnostic::on_unimplemented] to IntoResponse and IntoResponseParts (#3723) 2026-04-15 13:06:40 +02:00
Dihan Nahdi 7be02d7754 fix: add tracing calls to tracing-aka-logging example closures (#3722) 2026-04-15 11:34:16 +02:00
Gábor Szabó 7dcc0db31e chore: inline links in the ECOSYSTEM.md (#3729) 2026-04-14 11:51:56 +02:00
Gábor Szabó 99205dbb10 chore: remove axum-kit from ECOSYSTEM as the repository does not exists (any more) (#3727) 2026-04-14 09:48:04 +02:00
Gábor Szabó 080684c411 chore: remove axum_guard_logic from ECOSYSTEM.md (#3728) 2026-04-14 09:47:36 +02:00
Dmitry Marakasov 6fcf0a25b6 axum: Add missing PR link to changelog (#3635) (#3720) 2026-04-11 04:30:54 +09:00
Dmitry MarakasovandDavid Mládek f31dcd3c1e Bump matchit to 0.9.2 (#3702)
The new version now supports prefix and suffix captures such as `/{file}.png`, `/avatar.{extension}`, and `/user-{id}.png`.

Co-authored-by: David Mládek <[email protected]>
2026-04-10 19:47:51 +02:00
Gábor Szabó 67ce49aa52 chore: link to service does not work any more (#3705) 2026-04-10 13:09:38 +02:00
Gábor Szabó d71fd3d464 chore: update link to rgit, add gitore (#3706) 2026-04-10 13:08:57 +02:00
Gábor Szabó 0c4db046b2 chore: let's use only https links in the ECOSYSTEM.md (#3708) 2026-04-10 13:07:49 +02:00
Yann Simon 19fa67d481 Merge branch 'v0.8.x' into yanns/v0.8.9 2026-04-07 11:40:51 +02:00
Yann Simon c59208c86f revert axum-core changelog changes axum-macros-v0.5.1 axum-v0.8.9 axum-extra-v0.12.6 2026-04-06 18:57:37 +02:00
Yann Simon 99068f5a4b Revert "Fix IntoResponse for tuples overriding error response codes (#3603)"
This reverts commit 0e961504c2.
2026-04-06 18:47:42 +02:00
Yann Simon 23d7098691 Revert "axum-core 0.5.6"
This reverts commit 8c6bd2dfec.
2026-04-06 18:46:13 +02:00
Yann Simon e8a39ad416 axum-macros 0.5.1 2026-04-03 08:49:48 +02:00
Yann Simon 6e9a249a4f axum-extra 0.12.6 2026-04-03 08:49:48 +02:00
Yann Simon 0ec9041a1b axum 0.8.9 2026-04-03 08:49:48 +02:00
Yann Simon c3fcebb38f axum-core 0.5.6 2026-04-03 08:49:48 +02:00
Yann Simon a8790fc29b update release notes 2026-04-03 08:49:48 +02:00
kazeandYann Simon 26ba7bb6f2 docs: consolidate state management docs in crate root (#3683)
Co-authored-by: Yann Simon <[email protected]>
2026-04-03 08:49:48 +02:00
tottoto 9fc59efc1f Update to tokio-tungstenite 0.29 (#3689) 2026-04-03 08:49:48 +02:00
Tomaz Canabrava fc7e86c38d Improve typed path by disallowing deprecated variable definitions (#3618) 2026-04-03 08:49:48 +02:00
Andrea Bozzo ec4f5bbf9e fix: Return specific error message when multipart body limit is exceeded (#3611) 2026-04-03 08:49:48 +02:00
Yann Simon 7e7a1c96f0 Address tower-http deprecated warning 2026-04-03 08:49:48 +02:00
tottoto 0a24ff6b0a Address tower-http deprecated warning (#3672) 2026-04-03 08:49:48 +02:00
Mathieu 4fa5d80ab7 fix(axum-extra): escape filename in Content-Disposition header (#3664) 2026-04-03 08:49:48 +02:00
Alejandro González 880cc38174 fix: silence clippy::implicit_clone in TypedPath macro expansions (#3663) 2026-04-03 08:49:48 +02:00
Sindri Pétur Ingimundarson 27f4015986 fix: Set connect endpoint on correct field in MethodRouter (#3656) 2026-04-03 08:49:48 +02:00