diff --git a/bitreq/src/connection.rs b/bitreq/src/connection.rs index f8b98c13..b323c6af 100644 --- a/bitreq/src/connection.rs +++ b/bitreq/src/connection.rs @@ -158,13 +158,13 @@ impl Write for HttpStream { } } -#[cfg(feature = "tokio-rustls")] +#[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] type AsyncSecuredStream = rustls_stream::AsyncSecuredStream; #[cfg(feature = "async")] pub(crate) enum AsyncHttpStream { Unsecured(AsyncTcpStream), - #[cfg(feature = "tokio-rustls")] + #[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] Secured(Box), } @@ -177,7 +177,7 @@ impl AsyncRead for AsyncHttpStream { ) -> Poll> { match &mut *self { AsyncHttpStream::Unsecured(inner) => Pin::new(inner).poll_read(cx, buf), - #[cfg(feature = "tokio-rustls")] + #[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] AsyncHttpStream::Secured(inner) => Pin::new(inner).poll_read(cx, buf), } } @@ -192,7 +192,7 @@ impl AsyncWrite for AsyncHttpStream { ) -> Poll> { match &mut *self { AsyncHttpStream::Unsecured(inner) => Pin::new(inner).poll_write(cx, buf), - #[cfg(feature = "tokio-rustls")] + #[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] AsyncHttpStream::Secured(inner) => Pin::new(inner).poll_write(cx, buf), } } @@ -200,7 +200,7 @@ impl AsyncWrite for AsyncHttpStream { fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { match &mut *self { AsyncHttpStream::Unsecured(inner) => Pin::new(inner).poll_flush(cx), - #[cfg(feature = "tokio-rustls")] + #[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] AsyncHttpStream::Secured(inner) => Pin::new(inner).poll_flush(cx), } } @@ -208,7 +208,7 @@ impl AsyncWrite for AsyncHttpStream { fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { match &mut *self { AsyncHttpStream::Unsecured(inner) => Pin::new(inner).poll_shutdown(cx), - #[cfg(feature = "tokio-rustls")] + #[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] AsyncHttpStream::Secured(inner) => Pin::new(inner).poll_shutdown(cx), } } @@ -271,9 +271,12 @@ impl AsyncConnection { let socket = Self::connect(params).await?; if params.https { - #[cfg(not(feature = "tokio-rustls"))] + #[cfg(not(any( + feature = "async-https-rustls", + feature = "async-https-rustls-probe" + )))] return Err(Error::HttpsFeatureNotEnabled); - #[cfg(feature = "tokio-rustls")] + #[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] rustls_stream::wrap_async_stream(socket, params.host).await } else { Ok(AsyncHttpStream::Unsecured(socket)) diff --git a/bitreq/src/connection/rustls_stream.rs b/bitreq/src/connection/rustls_stream.rs index c21db715..62602b0f 100644 --- a/bitreq/src/connection/rustls_stream.rs +++ b/bitreq/src/connection/rustls_stream.rs @@ -15,12 +15,12 @@ use rustls::pki_types::ServerName; use rustls::{self, ClientConfig, ClientConnection, RootCertStore, StreamOwned}; #[cfg(all(feature = "native-tls", not(feature = "rustls"), feature = "tokio-native-tls"))] use tokio_native_tls::TlsConnector as AsyncTlsConnector; -#[cfg(feature = "tokio-rustls")] +#[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] use tokio_rustls::{client::TlsStream, TlsConnector}; #[cfg(feature = "rustls-webpki")] use webpki_roots::TLS_SERVER_ROOTS; -#[cfg(feature = "tokio-rustls")] +#[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] use super::{AsyncHttpStream, AsyncTcpStream}; #[cfg(all(feature = "native-tls", not(feature = "rustls"), feature = "tokio-native-tls"))] use super::{AsyncHttpStream, AsyncTcpStream}; @@ -66,10 +66,10 @@ pub(super) fn wrap_stream(tcp: TcpStream, host: &str) -> Result; -#[cfg(all(feature = "rustls", feature = "tokio-rustls"))] +#[cfg(any(feature = "async-https-rustls", feature = "async-https-rustls-probe"))] pub(super) async fn wrap_async_stream( tcp: AsyncTcpStream, host: &str,