Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ futures-util = { version = "0.3.1", default-features = false }

[features]
default = ["native-tokio"]
http2 = ["hyper/http2"]
webpki-tokio = ["tokio-runtime", "webpki-roots"]
native-tokio = ["tokio-runtime", "rustls-native-certs"]
tokio-runtime = ["hyper/runtime", "ct-logs"]
Expand Down
10 changes: 9 additions & 1 deletion src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@ impl HttpsConnector<HttpConnector> {
let mut http = HttpConnector::new();
http.enforce_http(false);

config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
#[cfg(feature = "http2")]
{
config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
}
#[cfg(not(feature = "http2"))]
{
config.alpn_protocols = vec![b"http/1.1".to_vec()];
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think alpn_protocols should just be omitted if it only contains "http/1.1".

config.ct_logs = Some(&ct_logs::LOGS);
(http, config).into()
}
Expand Down