diff --git a/actix-web/Cargo.toml b/actix-web/Cargo.toml index 0091175be..4322fb871 100644 --- a/actix-web/Cargo.toml +++ b/actix-web/Cargo.toml @@ -28,7 +28,7 @@ name = "actix_web" path = "src/lib.rs" [features] -default = ["macros", "compress-brotli", "compress-gzip", "compress-zstd", "cookies"] +default = ["macros", "compress-brotli", "compress-gzip", "compress-zstd", "cookies", "http2"] # Brotli algorithm content-encoding support compress-brotli = ["actix-http/compress-brotli", "__compress"] @@ -46,11 +46,13 @@ cookies = ["cookie"] # Secure & signed cookies secure-cookies = ["cookies", "cookie/secure"] +http2 = ["actix-http/http2"] + # TLS via OpenSSL -openssl = ["actix-http/openssl", "actix-tls/accept", "actix-tls/openssl"] +openssl = ["http2", "actix-http/openssl", "actix-tls/accept", "actix-tls/openssl"] # TLS via Rustls -rustls = ["actix-http/rustls", "actix-tls/accept", "actix-tls/rustls"] +rustls = ["http2", "actix-http/rustls", "actix-tls/accept", "actix-tls/rustls"] # Internal (PRIVATE!) features used to aid testing and checking feature status. # Don't rely on these whatsoever. They may disappear at anytime. @@ -68,7 +70,7 @@ actix-service = "2" actix-utils = "3" actix-tls = { version = "3", default-features = false, optional = true } -actix-http = { version = "3.3", features = ["http2", "ws"] } +actix-http = { version = "3.3", features = ["ws"] } actix-router = "0.5" actix-web-codegen = { version = "4.2", optional = true } diff --git a/actix-web/src/server.rs b/actix-web/src/server.rs index b96a84939..a540da7c8 100644 --- a/actix-web/src/server.rs +++ b/actix-web/src/server.rs @@ -356,6 +356,7 @@ where /// Resolves socket address(es) and binds server to created listener(s) for plaintext HTTP/1.x /// or HTTP/2 connections. + #[cfg(feature = "http2")] pub fn bind_auto_h2c(mut self, addrs: A) -> io::Result { let sockets = bind_addrs(addrs, self.backlog)?; @@ -453,6 +454,7 @@ where } /// Binds to existing listener for accepting incoming plaintext HTTP/1.x or HTTP/2 connections. + #[cfg(feature = "http2")] pub fn listen_auto_h2c(mut self, lst: net::TcpListener) -> io::Result { let cfg = self.config.clone(); let factory = self.factory.clone();