Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion bitreq/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl Write for HttpStream {
}
}

#[cfg(feature = "tokio-rustls")]
#[cfg(all(feature = "async", feature = "tokio-rustls"))]
type AsyncSecuredStream = rustls_stream::AsyncSecuredStream;

#[cfg(feature = "async")]
Expand Down
27 changes: 21 additions & 6 deletions bitreq/src/connection/rustls_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ use tokio_rustls::{client::TlsStream, TlsConnector};
#[cfg(feature = "rustls-webpki")]
use webpki_roots::TLS_SERVER_ROOTS;

#[cfg(feature = "tokio-rustls")]
#[cfg(all(feature = "async", feature = "tokio-rustls"))]
use super::{AsyncHttpStream, AsyncTcpStream};
#[cfg(all(feature = "native-tls", not(feature = "rustls"), feature = "tokio-native-tls"))]
#[cfg(all(
feature = "async",
feature = "native-tls",
not(feature = "rustls"),
feature = "tokio-native-tls"
))]
use super::{AsyncHttpStream, AsyncTcpStream};
use crate::Error;

Expand Down Expand Up @@ -66,10 +71,10 @@ pub(super) fn wrap_stream(tcp: TcpStream, host: &str) -> Result<SecuredStream, E

// Async rustls TLS implementation

#[cfg(all(feature = "rustls", feature = "tokio-rustls"))]
#[cfg(all(feature = "async", feature = "rustls", feature = "tokio-rustls"))]
pub type AsyncSecuredStream = TlsStream<tokio::net::TcpStream>;

#[cfg(all(feature = "rustls", feature = "tokio-rustls"))]
#[cfg(all(feature = "async", feature = "rustls", feature = "tokio-rustls"))]
pub(super) async fn wrap_async_stream(
tcp: AsyncTcpStream,
host: &str,
Expand Down Expand Up @@ -127,10 +132,20 @@ pub(super) fn wrap_stream(tcp: TcpStream, host: &str) -> Result<SecuredStream, E
connector.connect(host, tcp).map_err(native_tls_err)
}

#[cfg(all(feature = "native-tls", not(feature = "rustls"), feature = "tokio-native-tls"))]
#[cfg(all(
feature = "async",
feature = "native-tls",
not(feature = "rustls"),
feature = "tokio-native-tls"
))]
pub type AsyncSecuredStream = tokio_native_tls::TlsStream<tokio::net::TcpStream>;

#[cfg(all(feature = "native-tls", not(feature = "rustls"), feature = "tokio-native-tls"))]
#[cfg(all(
feature = "async",
feature = "native-tls",
not(feature = "rustls"),
feature = "tokio-native-tls"
))]
pub(super) async fn wrap_async_stream(
tcp: AsyncTcpStream,
host: &str,
Expand Down
Loading