Unverified Commit f8581638 authored by Steven Fackler's avatar Steven Fackler Committed by GitHub
Browse files

Merge pull request #789 from sfackler/ssl-docs-2

Finish documentation for the ssl module
parents c4407896 3207e57a
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ use std::ops::{Deref, DerefMut};

use dh::Dh;
use error::ErrorStack;
use ssl::{self, HandshakeError, Ssl, SslContext, SslContextBuilder, SslMethod, SslStream,
use ssl::{self, HandshakeError, Ssl, SslRef, SslContext, SslContextBuilder, SslMethod, SslStream,
          SSL_VERIFY_PEER};
use pkey::PKeyRef;
use version;
@@ -91,7 +91,7 @@ impl SslConnectorBuilder {
        self
    }

    /// Consumes the builder, returning a `SslConnector`.
    /// Consumes the builder, returning an `SslConnector`.
    pub fn build(self) -> SslConnector {
        SslConnector(self.0.build())
    }
@@ -162,12 +162,14 @@ impl SslConnector {
pub struct ConnectConfiguration(Ssl);

impl ConnectConfiguration {
    /// Returns a shared reference to the inner `Ssl`.
    #[deprecated(since = "0.9.23",
                 note = "ConnectConfiguration now implements Deref<Target=SslRef>")]
    pub fn ssl(&self) -> &Ssl {
        &self.0
    }

    /// Returns a mutable reference to the inner `Ssl`.
    #[deprecated(since = "0.9.23",
                 note = "ConnectConfiguration now implements DerefMut<Target=SslRef>")]
    pub fn ssl_mut(&mut self) -> &mut Ssl {
        &mut self.0
    }
@@ -207,6 +209,20 @@ impl ConnectConfiguration {
    }
}

impl Deref for ConnectConfiguration {
    type Target = SslRef;

    fn deref(&self) -> &SslRef {
        &self.0
    }
}

impl DerefMut for ConnectConfiguration {
    fn deref_mut(&mut self) -> &mut SslRef {
        &mut self.0
    }
}

/// A builder for `SslAcceptor`s.
pub struct SslAcceptorBuilder(SslContextBuilder);

+4 −1
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ use error::ErrorStack;
use ssl::MidHandshakeSslStream;

/// An SSL error.
// FIXME this is missing variants
#[derive(Debug)]
pub enum Error {
    /// The SSL session has been closed by the other end
@@ -100,7 +101,9 @@ pub enum HandshakeError<S> {
    SetupFailure(ErrorStack),
    /// The handshake failed.
    Failure(MidHandshakeSslStream<S>),
    /// The handshake was interrupted midway through. This error will never be returned for blocking streams.
    /// The handshake was interrupted midway through.
    ///
    /// This error will never be returned for blocking streams.
    // FIXME change to WouldBlock
    Interrupted(MidHandshakeSslStream<S>),
}
+217 −45

File changed.

Preview size limit exceeded, changes collapsed.