Merge pull request #1229 from axos88/master

SslAcceptor and SslConnector: Ability to turn into SslContext
This commit is contained in:
Steven Fackler 2020-02-12 19:10:01 -05:00 committed by GitHub
commit eed35cefb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.