Skip to content

Commit

Permalink
Improve rustls feature logic
Browse files Browse the repository at this point in the history
Features are additive, as downstream dependencies can always add features

Adjust logic so that priority is nativetls > aws-rs-lc > ring
  • Loading branch information
serprex committed Sep 4, 2024
1 parent 5972f7e commit abdbb0e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,23 @@ impl Default for Client {
))]
connector.enforce_http(false);

#[cfg(all(
feature = "native-tls",
not(feature = "rustls-tls"),
not(feature = "rustls-tls-aws")
))]
#[cfg(feature = "native-tls")]
let connector = hyper_tls::HttpsConnector::new_with_connector(connector);

#[cfg(all(feature = "rustls-tls", not(feature = "rustls-tls-aws")))]
let connector =
prepare_hyper_rustls_connector(connector, rustls::crypto::ring::default_provider());
#[cfg(all(feature = "rustls-tls-aws", not(feature = "rustls-tls")))]
#[cfg(all(feature = "rustls-tls-aws", not(feature = "native-tls")))]
let connector = prepare_hyper_rustls_connector(
connector,
rustls::crypto::aws_lc_rs::default_provider(),
);

#[cfg(all(
feature = "rustls-tls",
not(feature = "rustls-tls-aws"),
not(feature = "native-tls")
))]
let connector =
prepare_hyper_rustls_connector(connector, rustls::crypto::ring::default_provider());

let client = HyperClient::builder(TokioExecutor::new())
.pool_idle_timeout(POOL_IDLE_TIMEOUT)
.build(connector);
Expand Down

0 comments on commit abdbb0e

Please sign in to comment.