diff --git a/http/src/lib.rs b/http/src/lib.rs index 916328829..a731a493c 100644 --- a/http/src/lib.rs +++ b/http/src/lib.rs @@ -36,8 +36,6 @@ #![forbid(unsafe_code)] -mod tls; - #[cfg(feature = "runtime")] mod builder; #[cfg(feature = "runtime")] @@ -49,6 +47,7 @@ pub mod body; pub mod config; pub mod error; pub mod http; +pub mod tls; pub mod util; #[cfg(feature = "runtime")] diff --git a/http/src/tls/error.rs b/http/src/tls/error.rs index db2f1a2f4..65c3efee0 100644 --- a/http/src/tls/error.rs +++ b/http/src/tls/error.rs @@ -10,6 +10,7 @@ pub enum TlsError { Rustls(super::rustls::RustlsError), #[cfg(feature = "native-tls")] NativeTls(super::native_tls::NativeTlsError), + OtherTls(Box), } impl fmt::Debug for TlsError { @@ -22,6 +23,7 @@ impl fmt::Debug for TlsError { Self::Rustls(ref e) => fmt::Debug::fmt(e, _f), #[cfg(feature = "native-tls")] Self::NativeTls(ref e) => fmt::Debug::fmt(e, _f), + Self::OtherTls(ref e) => fmt::Debug::fmt(e, _f), } } } @@ -36,12 +38,19 @@ impl fmt::Display for TlsError { Self::Rustls(ref e) => fmt::Debug::fmt(e, _f), #[cfg(feature = "native-tls")] Self::NativeTls(ref e) => fmt::Display::fmt(e, _f), + Self::OtherTls(ref e) => fmt::Display::fmt(e, _f), } } } impl error::Error for TlsError {} +impl From> for TlsError { + fn from(e: Box) -> Self { + Self::OtherTls(e) + } +} + impl From for HttpServiceError { fn from(e: TlsError) -> Self { Self::Tls(e)