diff --git a/Cargo.toml b/Cargo.toml index 8b0ec063..55d2b9bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,6 +68,7 @@ default = ["rustls", "timeout", "tracing", "retry"] retry = ["tower/retry", "futures-util"] rustls = ["hyper-rustls"] +rustls-webpki-tokio = ["hyper-rustls/webpki-tokio"] opentls = ["hyper-tls"] stream = ["futures-core", "futures-util", "hyper/stream"] timeout = ["hyper-timeout", "tokio", "tower/timeout"] diff --git a/src/lib.rs b/src/lib.rs index 5660ff38..7b6f77fd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -539,11 +539,18 @@ impl OctocrabBuilder let mut connector = HttpConnector::new(); #[cfg(all(feature = "rustls", not(feature = "opentls")))] - let connector = HttpsConnectorBuilder::new() - .with_native_roots() // enabled the `rustls-native-certs` feature in hyper-rustls - .https_or_http() // Disable .https_only() during tests until: https://github.com/LukeMathWalker/wiremock-rs/issues/58 is resolved. Alternatively we can use conditional compilation to only enable this feature in tests, but it becomes rather ugly with integration tests. - .enable_http1() - .build(); + let connector = { + let builder = HttpsConnectorBuilder::new(); + #[cfg(all(feature = "rustls-webpki-tokio"))] + let builder = builder.with_webpki_roots(); + #[cfg(all(not(feature = "rustls-webpki-tokio")))] + let builder = builder.with_native_roots(); // enabled the `rustls-native-certs` feature in hyper-rustls + + builder + .https_or_http() // Disable .https_only() during tests until: https://github.com/LukeMathWalker/wiremock-rs/issues/58 is resolved. Alternatively we can use conditional compilation to only enable this feature in tests, but it becomes rather ugly with integration tests. + .enable_http1() + .build() + }; #[cfg(all(feature = "opentls", not(feature = "rustls")))] let connector = HttpsConnector::new();