adds ability access the internal &SslContext of an SslAcceptor and SslConnector

This commit is contained in:
Akos Vandra 2020-02-05 16:00:32 +01:00
parent 62187377b5
commit c81810d869
1 changed files with 17 additions and 1 deletions

View File

@ -4,7 +4,7 @@ use std::ops::{Deref, DerefMut};
use dh::Dh; use dh::Dh;
use error::ErrorStack; use error::ErrorStack;
use ssl::{ use ssl::{
HandshakeError, Ssl, SslContext, SslContextBuilder, SslMethod, SslMode, SslOptions, SslRef, HandshakeError, Ssl, SslContext, SslContextRef, SslContextBuilder, SslMethod, SslMode, SslOptions, SslRef,
SslStream, SslVerifyMode, SslStream, SslVerifyMode,
}; };
use version; use version;
@ -91,6 +91,14 @@ impl SslConnector {
verify_hostname: true, verify_hostname: true,
}) })
} }
pub fn into_ssl_context(self) -> SslContext {
self.0
}
pub fn ssl_context_ref(&self) -> &SslContextRef {
&*self.0
}
} }
/// A builder for `SslConnector`s. /// A builder for `SslConnector`s.
@ -301,6 +309,14 @@ impl SslAcceptor {
let ssl = Ssl::new(&self.0)?; let ssl = Ssl::new(&self.0)?;
ssl.accept(stream) ssl.accept(stream)
} }
pub fn into_ssl_context(self) -> SslContext {
self.0
}
pub fn ssl_context_ref(&self) -> &SslContextRef {
&*self.0
}
} }
/// A builder for `SslAcceptor`s. /// A builder for `SslAcceptor`s.