Closed GrahamBarnett closed 8 months ago
Please add accessors to get to the ssl::SslStream.
It would help a lot as we currently have to patch tokio-native-tls and native-tls just to add this accessor.
I am happy to do a a PR rather than a diff if I can get access.
Many thanks !
diff --git a/src/imp/openssl.rs b/src/imp/openssl.rs index 8fc4362..12775ab 100644 --- a/src/imp/openssl.rs +++ b/src/imp/openssl.rs @@ -401,6 +401,14 @@ impl<S> TlsStream<S> { pub fn get_mut(&mut self) -> &mut S { self.0.get_mut() } + + pub fn get_inner_ref(&self) -> &ssl::SslStream<S> { + &self.0 + } + + pub fn get_inner_mut(&mut self) -> &mut ssl::SslStream<S> { + &mut self.0 + } } impl<S: io::Read + io::Write> TlsStream<S> { diff --git a/src/lib.rs b/src/lib.rs index cc86502..8b85946 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -664,6 +664,16 @@ impl<S> TlsStream<S> { pub fn get_mut(&mut self) -> &mut S { self.0.get_mut() } + + /// Returns a shared reference to the inner object + pub fn get_inner_ref(&self) -> &imp::TlsStream<S> { + &self.0 + } + + /// Returns a mutable reference to the inner object + pub fn get_inner_mut(&mut self) -> &mut imp::TlsStream<S> { + &mut self.0 + } } impl<S: io::Read + io::Write> TlsStream<S> {
https://github.com/sfackler/rust-native-tls/issues/283
Please add accessors to get to the ssl::SslStream.
It would help a lot as we currently have to patch tokio-native-tls and native-tls just to add this accessor.
I am happy to do a a PR rather than a diff if I can get access.
Many thanks !