Skip to content

Commit 2ce382f

Browse files
authored
Remove h2 from dependencies when http2 feature is off (#2605)
1 parent 8b13d4c commit 2ce382f

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

axum/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- **fixed:** Fixed layers being cloned when calling `axum::serve` directly with
1111
a `Router` or `MethodRouter` ([#2586])
12+
- **fixed:** `h2` is no longer pulled as a dependency unless the `http2` feature
13+
is enabled ([#2605])
1214

1315
[#2586]: https://github.com/tokio-rs/axum/pull/2586
16+
[#2605]: https://github.com/tokio-rs/axum/pull/2605
1417

1518
# 0.7.4 (13. January, 2024)
1619

axum/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ default = [
2424
"tracing",
2525
]
2626
form = ["dep:serde_urlencoded"]
27-
http1 = ["dep:hyper", "hyper?/http1"]
28-
http2 = ["dep:hyper", "hyper?/http2"]
27+
http1 = ["dep:hyper", "hyper?/http1", "hyper-util?/http1"]
28+
http2 = ["dep:hyper", "hyper?/http2", "hyper-util?/http2"]
2929
json = ["dep:serde_json", "dep:serde_path_to_error"]
3030
macros = ["dep:axum-macros"]
3131
matched-path = []
@@ -64,7 +64,7 @@ tower-service = "0.3"
6464
axum-macros = { path = "../axum-macros", version = "0.4.1", optional = true }
6565
base64 = { version = "0.21.0", optional = true }
6666
hyper = { version = "1.1.0", optional = true }
67-
hyper-util = { version = "0.1.2", features = ["tokio", "server", "server-auto"], optional = true }
67+
hyper-util = { version = "0.1.3", features = ["tokio", "server"], optional = true }
6868
multer = { version = "3.0.0", optional = true }
6969
serde_json = { version = "1.0", features = ["raw_value"], optional = true }
7070
serde_path_to_error = { version = "0.1.8", optional = true }

axum/src/serve.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ use std::{
1616
use axum_core::{body::Body, extract::Request, response::Response};
1717
use futures_util::{pin_mut, FutureExt};
1818
use hyper::body::Incoming;
19-
use hyper_util::{
20-
rt::{TokioExecutor, TokioIo},
21-
server::conn::auto::Builder,
22-
};
19+
use hyper_util::rt::{TokioExecutor, TokioIo};
20+
#[cfg(any(feature = "http1", feature = "http2"))]
21+
use hyper_util::server::conn::auto::Builder;
2322
use pin_project_lite::pin_project;
2423
use tokio::{
2524
net::{TcpListener, TcpStream},

0 commit comments

Comments
 (0)