From 507f587916d1ab0fb1d1b892fb8df7aee6a40ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ml=C3=A1dek?= Date: Sun, 18 Feb 2024 13:56:11 +0100 Subject: [PATCH 1/4] chore: remove h2 from dependencies when http2 feature is off --- axum/Cargo.toml | 6 +++--- axum/src/serve.rs | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/axum/Cargo.toml b/axum/Cargo.toml index c582696d24..5eeb761813 100644 --- a/axum/Cargo.toml +++ b/axum/Cargo.toml @@ -24,8 +24,8 @@ default = [ "tracing", ] form = ["dep:serde_urlencoded"] -http1 = ["dep:hyper", "hyper?/http1"] -http2 = ["dep:hyper", "hyper?/http2"] +http1 = ["dep:hyper", "hyper?/http1", "hyper-util?/http1"] +http2 = ["dep:hyper", "hyper?/http2", "hyper-util?/http2"] json = ["dep:serde_json", "dep:serde_path_to_error"] macros = ["dep:axum-macros"] matched-path = [] @@ -64,7 +64,7 @@ tower-service = "0.3" axum-macros = { path = "../axum-macros", version = "0.4.1", optional = true } base64 = { version = "0.21.0", optional = true } hyper = { version = "1.1.0", optional = true } -hyper-util = { version = "0.1.2", features = ["tokio", "server", "server-auto"], optional = true } +hyper-util = { version = "0.1.2", features = ["tokio", "server"], optional = true } multer = { version = "3.0.0", optional = true } serde_json = { version = "1.0", features = ["raw_value"], optional = true } serde_path_to_error = { version = "0.1.8", optional = true } diff --git a/axum/src/serve.rs b/axum/src/serve.rs index b253cb5def..a2df756b09 100644 --- a/axum/src/serve.rs +++ b/axum/src/serve.rs @@ -16,10 +16,9 @@ use std::{ use axum_core::{body::Body, extract::Request, response::Response}; use futures_util::{pin_mut, FutureExt}; use hyper::body::Incoming; -use hyper_util::{ - rt::{TokioExecutor, TokioIo}, - server::conn::auto::Builder, -}; +use hyper_util::rt::{TokioExecutor, TokioIo}; +#[cfg(any(feature = "http1", feature = "http2"))] +use hyper_util::server::conn::auto::Builder; use pin_project_lite::pin_project; use tokio::{ net::{TcpListener, TcpStream}, From ac344c2c010a8248758def801df0430209e33dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ml=C3=A1dek?= Date: Tue, 20 Feb 2024 22:20:48 +0100 Subject: [PATCH 2/4] axum: update hyper-util to 0.1.3 --- axum/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/axum/Cargo.toml b/axum/Cargo.toml index 5eeb761813..ba22ee8ba3 100644 --- a/axum/Cargo.toml +++ b/axum/Cargo.toml @@ -64,7 +64,7 @@ tower-service = "0.3" axum-macros = { path = "../axum-macros", version = "0.4.1", optional = true } base64 = { version = "0.21.0", optional = true } hyper = { version = "1.1.0", optional = true } -hyper-util = { version = "0.1.2", features = ["tokio", "server"], optional = true } +hyper-util = { version = "0.1.3", features = ["tokio", "server"], optional = true } multer = { version = "3.0.0", optional = true } serde_json = { version = "1.0", features = ["raw_value"], optional = true } serde_path_to_error = { version = "0.1.8", optional = true } From 63858bf143d4c88b0ff8f68232f7523a9f71311f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ml=C3=A1dek?= Date: Sat, 16 Mar 2024 16:04:39 +0100 Subject: [PATCH 3/4] chore: add changelog entry for h2 dependency --- axum/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 80ce95c379..179f2c4898 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **fixed:** Fixed layers being cloned when calling `axum::serve` directly with a `Router` or `MethodRouter` ([#2586]) +- **fixed:** `h2` is no longer pulled as a dependency unless the `http2` feature + is enabled feature is enabled ([#2605]) [#2586]: https://github.com/tokio-rs/axum/pull/2586 From 1fb8d8b903df2c3234ed9adee41165360e5a43a6 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 16 Mar 2024 16:53:52 +0100 Subject: [PATCH 4/4] Apply suggestions from code review --- axum/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 179f2c4898..e62ba1c873 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -10,9 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **fixed:** Fixed layers being cloned when calling `axum::serve` directly with a `Router` or `MethodRouter` ([#2586]) - **fixed:** `h2` is no longer pulled as a dependency unless the `http2` feature - is enabled feature is enabled ([#2605]) + is enabled ([#2605]) [#2586]: https://github.com/tokio-rs/axum/pull/2586 +[#2605]: https://github.com/tokio-rs/axum/pull/2605 # 0.7.4 (13. January, 2024)