Skip to content

Commit

Permalink
Improve rustls feature logic (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex authored Sep 5, 2024
1 parent 5972f7e commit ae6f92c
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 ae6f92c

Please sign in to comment.