diff options
| author | Chris Cole <[email protected]> | 2015-01-03 19:31:14 -0500 |
|---|---|---|
| committer | Chris Cole <[email protected]> | 2015-01-03 19:31:14 -0500 |
| commit | fde7fbd03b0a92c2bf515c8f1fd3609b8b8745e6 (patch) | |
| tree | d2d40563122545c4e24ac7ac387145e5e0886bf4 /src/ssl | |
| parent | Merge branch 'master' of https://github.com/cjcole/rust-openssl (diff) | |
| parent | Release v0.2.11 (diff) | |
| download | rust-openssl-fde7fbd03b0a92c2bf515c8f1fd3609b8b8745e6.tar.xz rust-openssl-fde7fbd03b0a92c2bf515c8f1fd3609b8b8745e6.zip | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/ssl')
| -rw-r--r-- | src/ssl/error.rs | 4 | ||||
| -rw-r--r-- | src/ssl/mod.rs | 16 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/ssl/error.rs b/src/ssl/error.rs index 7e8daef1..888a9cdc 100644 --- a/src/ssl/error.rs +++ b/src/ssl/error.rs @@ -9,7 +9,7 @@ use std::c_str::CString; use ffi; /// An SSL error -#[deriving(Show, Clone, PartialEq, Eq)] +#[derive(Show, Clone, PartialEq, Eq)] pub enum SslError { /// The underlying stream reported an error StreamError(IoError), @@ -37,7 +37,7 @@ impl error::Error for SslError { } /// An error from the OpenSSL library -#[deriving(Show, Clone, PartialEq, Eq)] +#[derive(Show, Clone, PartialEq, Eq)] pub enum OpensslError { /// An unknown error UnknownError { diff --git a/src/ssl/mod.rs b/src/ssl/mod.rs index 1bd36147..9b320c49 100644 --- a/src/ssl/mod.rs +++ b/src/ssl/mod.rs @@ -1,6 +1,8 @@ use libc::{c_int, c_void, c_long}; +use std::c_str::ToCStr; use std::io::{IoResult, IoError, EndOfFile, Stream, Reader, Writer}; use std::mem; +use std::num::FromPrimitive; use std::ptr; use std::sync::{Once, ONCE_INIT, Arc}; @@ -19,7 +21,7 @@ fn init() { static mut INIT: Once = ONCE_INIT; unsafe { - INIT.doit(|| { + INIT.call_once(|| { ffi::init(); let verify_idx = ffi::SSL_CTX_get_ex_new_index(0, ptr::null(), None, @@ -31,9 +33,9 @@ fn init() { } /// Determines the SSL method supported -#[deriving(Show, Hash, PartialEq, Eq)] +#[derive(Show, Hash, PartialEq, Eq)] #[allow(non_camel_case_types)] -#[deriving(Copy)] +#[derive(Copy)] pub enum SslMethod { #[cfg(feature = "sslv2")] /// Only support the SSLv2 protocol, requires `feature="sslv2"` @@ -69,7 +71,7 @@ impl SslMethod { } /// Determines the type of certificate verification used -#[deriving(Copy)] +#[derive(Copy)] #[repr(i32)] pub enum SslVerifyMode { /// Verify that the server's certificate is trusted @@ -92,7 +94,7 @@ fn get_verify_data_idx<T>() -> c_int { } unsafe { - INIT.doit(|| { + INIT.call_once(|| { let f: ffi::CRYPTO_EX_free = free_data_box::<T>; let idx = ffi::SSL_CTX_get_ex_new_index(0, ptr::null(), None, None, Some(f)); @@ -389,7 +391,7 @@ impl Ssl { } -#[deriving(FromPrimitive, Show)] +#[derive(FromPrimitive, Show)] #[repr(i32)] enum LibSslError { ErrorNone = ffi::SSL_ERROR_NONE, @@ -404,7 +406,7 @@ enum LibSslError { } /// A stream wrapper which handles SSL encryption for an underlying stream. -#[deriving(Clone)] +#[derive(Clone)] pub struct SslStream<S> { stream: S, ssl: Arc<Ssl>, |