Skip to content

Commit 4e78bba

Browse files
committed
feat(lib): add upgrade feature
1 parent da3fc76 commit 4e78bba

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Diff for: Cargo.toml

+6-3
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ httparse = "1.8"
3030
h2 = { version = "0.3.9", optional = true }
3131
itoa = "1"
3232
pin-project-lite = "0.2.4"
33-
tokio = { version = "1", features = ["sync"] }
3433

3534
# Optional
3635

3736
httpdate = { version = "1.0", optional = true }
3837
libc = { version = "0.2", optional = true }
38+
tokio = { version = "1", features = ["sync"], optional = true }
3939
tracing = { version = "0.1", default-features = false, features = ["std"], optional = true }
4040
want = { version = "0.3", optional = true }
4141

@@ -74,13 +74,16 @@ full = [
7474
]
7575

7676
# HTTP versions
77-
http1 = []
78-
http2 = ["dep:h2"]
77+
http1 = ["upgrade"]
78+
http2 = ["upgrade", "dep:h2"]
7979

8080
# Client/Server
8181
client = ["dep:want"]
8282
server = ["dep:httpdate"]
8383

84+
# HTTP Upgrades
85+
upgrade = ["dep:tokio"]
86+
8487
# C-API support (currently unstable (no semver))
8588
ffi = ["dep:libc", "dep:http-body-util"]
8689

Diff for: src/lib.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@
4949
//! - `http2`: Enables HTTP/2 support.
5050
//! - `client`: Enables the HTTP `client`.
5151
//! - `server`: Enables the HTTP `server`.
52+
//! - `upgrade`: Enables [HTTP Upgrades].
5253
//!
5354
//! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section
55+
//! [Http Upgrades]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism
5456
//!
5557
//! # Unstable Features
5658
//! hyper includes a set of unstable optional features that can be enabled through the use of a
@@ -65,6 +67,7 @@
6567
//! RUSTFLAGS="--cfg hyper_unstable_tracing" cargo rustc --features client,http1,http2,tracing --crate-type cdylib
6668
//!```
6769
//! [configuration flag]: https://doc.rust-lang.org/reference/conditional-compilation.html
70+
6871
#[doc(hidden)]
6972
pub use http;
7073

@@ -93,7 +96,6 @@ pub mod ext;
9396
mod mock;
9497
pub mod rt;
9598
pub mod service;
96-
pub mod upgrade;
9799

98100
#[cfg(feature = "ffi")]
99101
#[cfg_attr(docsrs, doc(cfg(all(feature = "ffi", hyper_unstable_ffi))))]
@@ -115,3 +117,9 @@ cfg_feature! {
115117

116118
pub mod server;
117119
}
120+
121+
cfg_feature! {
122+
#![feature = "upgrade"]
123+
124+
pub mod upgrade;
125+
}

0 commit comments

Comments
 (0)