diff --git a/Cargo.toml b/Cargo.toml index 73f1643..f441aea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,9 @@ hyper = { version = "0.14", features = ["full"] } futures-util = { version = "0.3.1", default-features = false } [features] -default = ["native-tokio"] +default = ["native-tokio", "http1"] +http1 = ["hyper/http1"] +http2 = ["hyper/http2"] webpki-tokio = ["tokio-runtime", "webpki-roots"] native-tokio = ["tokio-runtime", "rustls-native-certs"] tokio-runtime = ["hyper/runtime", "ct-logs"] diff --git a/src/connector.rs b/src/connector.rs index 76dbf52..48b75a7 100644 --- a/src/connector.rs +++ b/src/connector.rs @@ -61,7 +61,17 @@ impl HttpsConnector { let mut http = HttpConnector::new(); http.enforce_http(false); - config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()]; + config.alpn_protocols.clear(); + #[cfg(feature = "http2")] + { + config.alpn_protocols.push(b"h2".to_vec()); + } + + #[cfg(feature = "http1")] + { + config.alpn_protocols.push(b"http/1.1".to_vec()); + } + config.ct_logs = Some(&ct_logs::LOGS); (http, config).into() }