aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2015-01-23 10:21:08 -0800
committerSteven Fackler <[email protected]>2015-01-23 10:21:08 -0800
commit0a258a0a2128749be84448bdd6819eaff38d4c70 (patch)
tree2b7327e35b5b90195431f36527ee77572be48066 /src
parentMerge pull request #145 from gkoz/ffi_fixes (diff)
downloadrust-openssl-0a258a0a2128749be84448bdd6819eaff38d4c70.tar.xz
rust-openssl-0a258a0a2128749be84448bdd6819eaff38d4c70.zip
Fix for upstream changes
Diffstat (limited to 'src')
-rw-r--r--src/bn/mod.rs2
-rw-r--r--src/ssl/error.rs7
-rw-r--r--src/ssl/mod.rs18
3 files changed, 17 insertions, 10 deletions
diff --git a/src/bn/mod.rs b/src/bn/mod.rs
index 84a57c4a..3a5f231e 100644
--- a/src/bn/mod.rs
+++ b/src/bn/mod.rs
@@ -438,7 +438,7 @@ impl BigNum {
}
}
-impl fmt::Show for BigNum {
+impl fmt::Debug for BigNum {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.to_dec_str())
}
diff --git a/src/ssl/error.rs b/src/ssl/error.rs
index c52879a0..4f05e449 100644
--- a/src/ssl/error.rs
+++ b/src/ssl/error.rs
@@ -3,6 +3,7 @@ pub use self::OpensslError::*;
use libc::c_ulong;
use std::error;
+use std::fmt;
use std::ffi::c_str_to_bytes;
use std::io::IoError;
@@ -19,6 +20,12 @@ pub enum SslError {
OpenSslErrors(Vec<OpensslError>)
}
+impl fmt::Display for SslError {
+ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fmt.write_str(error::Error::description(self))
+ }
+}
+
impl error::Error for SslError {
fn description(&self) -> &str {
match *self {
diff --git a/src/ssl/mod.rs b/src/ssl/mod.rs
index c4e41055..3e7cd182 100644
--- a/src/ssl/mod.rs
+++ b/src/ssl/mod.rs
@@ -35,7 +35,7 @@ fn init() {
/// Determines the SSL method supported
#[allow(non_camel_case_types)]
-#[derive(Copy, Clone, Show, Hash, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub enum SslMethod {
#[cfg(feature = "sslv2")]
/// Only support the SSLv2 protocol, requires `feature="sslv2"`
@@ -71,7 +71,7 @@ impl SslMethod {
}
/// Determines the type of certificate verification used
-#[derive(Copy, Clone, Show)]
+#[derive(Copy, Clone, Debug)]
#[repr(i32)]
pub enum SslVerifyMode {
/// Verify that the server's certificate is trusted
@@ -178,7 +178,7 @@ pub struct SslContext {
}
// TODO: add useful info here
-impl fmt::Show for SslContext {
+impl fmt::Debug for SslContext {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "SslContext")
}
@@ -301,7 +301,7 @@ pub struct Ssl {
}
// TODO: put useful information here
-impl fmt::Show for Ssl {
+impl fmt::Debug for Ssl {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "Ssl")
}
@@ -404,7 +404,7 @@ impl Ssl {
}
-#[derive(FromPrimitive, Show)]
+#[derive(FromPrimitive, Debug)]
#[repr(i32)]
enum LibSslError {
ErrorNone = ffi::SSL_ERROR_NONE,
@@ -426,7 +426,7 @@ pub struct SslStream<S> {
buf: Vec<u8>
}
-impl<S> fmt::Show for SslStream<S> where S: fmt::Show {
+impl<S> fmt::Debug for SslStream<S> where S: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "SslStream {{ stream: {:?}, ssl: {:?} }}", self.stream, self.ssl)
}
@@ -510,7 +510,7 @@ impl<S: Stream> SslStream<S> {
LibSslError::ErrorWantRead => {
try_ssl_stream!(self.flush());
let len = try_ssl_stream!(self.stream.read(self.buf.as_mut_slice()));
- self.ssl.get_rbio().write(self.buf.slice_to(len));
+ self.ssl.get_rbio().write(&self.buf[..len]);
}
LibSslError::ErrorWantWrite => { try_ssl_stream!(self.flush()) }
LibSslError::ErrorZeroReturn => return Err(SslSessionClosed),
@@ -523,7 +523,7 @@ impl<S: Stream> SslStream<S> {
fn write_through(&mut self) -> IoResult<()> {
loop {
match self.ssl.get_wbio().read(self.buf.as_mut_slice()) {
- Some(len) => try!(self.stream.write(self.buf.slice_to(len))),
+ Some(len) => try!(self.stream.write(&self.buf[..len])),
None => break
};
}
@@ -587,7 +587,7 @@ impl<S: Stream> Writer for SslStream<S> {
}
/// A utility type to help in cases where the use of SSL is decided at runtime.
-#[derive(Show)]
+#[derive(Debug)]
pub enum MaybeSslStream<S> where S: Stream {
/// A connection using SSL
Ssl(SslStream<S>),