Struct openssl::ssl::MidHandshakeSslStream
source · pub struct MidHandshakeSslStream<S> { /* private fields */ }
Expand description
An SSL stream midway through the handshake process.
Implementations§
source§impl<S> MidHandshakeSslStream<S>
impl<S> MidHandshakeSslStream<S>
sourcepub fn ssl(&self) -> &SslRef
pub fn ssl(&self) -> &SslRef
Returns a shared reference to the Ssl
of the stream.
Examples found in repository?
src/ssl/error.rs (line 164)
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
HandshakeError::SetupFailure(ref e) => write!(f, "stream setup failed: {}", e)?,
HandshakeError::Failure(ref s) => {
write!(f, "the handshake failed: {}", s.error())?;
let verify = s.ssl().verify_result();
if verify != X509VerifyResult::OK {
write!(f, ": {}", verify)?;
}
}
HandshakeError::WouldBlock(ref s) => {
write!(f, "the handshake was interrupted: {}", s.error())?;
let verify = s.ssl().verify_result();
if verify != X509VerifyResult::OK {
write!(f, ": {}", verify)?;
}
}
}
Ok(())
}
sourcepub fn error(&self) -> &Error
pub fn error(&self) -> &Error
Returns the underlying error which interrupted this handshake.
Examples found in repository?
src/ssl/error.rs (line 153)
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
fn source(&self) -> Option<&(dyn StdError + 'static)> {
match *self {
HandshakeError::SetupFailure(ref e) => Some(e),
HandshakeError::Failure(ref s) | HandshakeError::WouldBlock(ref s) => Some(s.error()),
}
}
}
impl<S: fmt::Debug> fmt::Display for HandshakeError<S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
HandshakeError::SetupFailure(ref e) => write!(f, "stream setup failed: {}", e)?,
HandshakeError::Failure(ref s) => {
write!(f, "the handshake failed: {}", s.error())?;
let verify = s.ssl().verify_result();
if verify != X509VerifyResult::OK {
write!(f, ": {}", verify)?;
}
}
HandshakeError::WouldBlock(ref s) => {
write!(f, "the handshake was interrupted: {}", s.error())?;
let verify = s.ssl().verify_result();
if verify != X509VerifyResult::OK {
write!(f, ": {}", verify)?;
}
}
}
Ok(())
}
sourcepub fn into_error(self) -> Error
pub fn into_error(self) -> Error
Consumes self
, returning its error.
source§impl<S> MidHandshakeSslStream<S>where
S: Read + Write,
impl<S> MidHandshakeSslStream<S>where
S: Read + Write,
sourcepub fn handshake(self) -> Result<SslStream<S>, HandshakeError<S>>
pub fn handshake(self) -> Result<SslStream<S>, HandshakeError<S>>
Restarts the handshake process.
This corresponds to SSL_do_handshake
.