aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2015-01-28 08:47:16 -0800
committerSteven Fackler <[email protected]>2015-01-28 08:47:16 -0800
commit030cf5fe88f292a48b71789f5d0e9a9b133c5c09 (patch)
treee105f6e7ddf28efbc6f58f8424f87b1b1bc46da6 /src
parentRelease v0.2.17 (diff)
downloadrust-openssl-030cf5fe88f292a48b71789f5d0e9a9b133c5c09.tar.xz
rust-openssl-030cf5fe88f292a48b71789f5d0e9a9b133c5c09.zip
Fix for IO changes
Diffstat (limited to 'src')
-rw-r--r--src/bio/mod.rs6
-rw-r--r--src/crypto/hash.rs8
-rw-r--r--src/crypto/pkey.rs2
-rw-r--r--src/ssl/error.rs2
-rw-r--r--src/ssl/mod.rs22
-rw-r--r--src/ssl/tests.rs12
-rw-r--r--src/x509/mod.rs8
-rw-r--r--src/x509/tests.rs4
8 files changed, 32 insertions, 32 deletions
diff --git a/src/bio/mod.rs b/src/bio/mod.rs
index a354ed86..2f12f906 100644
--- a/src/bio/mod.rs
+++ b/src/bio/mod.rs
@@ -1,6 +1,6 @@
use libc::{c_void, c_int};
-use std::io::{EndOfFile, IoResult, IoError, OtherIoError};
-use std::io::{Reader, Writer};
+use std::old_io::{EndOfFile, IoResult, IoError, OtherIoError};
+use std::old_io::{Reader, Writer};
use std::ptr;
use ffi;
@@ -87,7 +87,7 @@ impl Reader for MemBio {
}
impl Writer for MemBio {
- fn write(&mut self, buf: &[u8]) -> IoResult<()> {
+ fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
let ret = unsafe {
ffi::BIO_write(self.bio, buf.as_ptr() as *const c_void,
buf.len() as c_int)
diff --git a/src/crypto/hash.rs b/src/crypto/hash.rs
index 638a2254..6d751ade 100644
--- a/src/crypto/hash.rs
+++ b/src/crypto/hash.rs
@@ -1,6 +1,6 @@
use libc::c_uint;
use std::ptr;
-use std::io;
+use std::old_io;
use std::iter::repeat;
use ffi;
@@ -59,8 +59,8 @@ pub struct Hasher {
len: u32,
}
-impl io::Writer for Hasher {
- fn write(&mut self, buf: &[u8]) -> io::IoResult<()> {
+impl old_io::Writer for Hasher {
+ fn write_all(&mut self, buf: &[u8]) -> old_io::IoResult<()> {
self.update(buf);
Ok(())
}
@@ -163,7 +163,7 @@ mod tests {
pub fn hash_writer(t: super::HashType, data: &[u8]) -> Vec<u8> {
let mut h = super::Hasher::new(t);
- h.write(data).unwrap();
+ h.write_all(data).unwrap();
h.finalize()
}
diff --git a/src/crypto/pkey.rs b/src/crypto/pkey.rs
index f2ba89dc..1aa5cc0e 100644
--- a/src/crypto/pkey.rs
+++ b/src/crypto/pkey.rs
@@ -149,7 +149,7 @@ impl PKey {
}
let buf = try!(mem_bio.read_to_end().map_err(StreamError));
- writer.write(buf.as_slice()).map_err(StreamError)
+ writer.write_all(buf.as_slice()).map_err(StreamError)
}
/**
diff --git a/src/ssl/error.rs b/src/ssl/error.rs
index 4f05e449..2aa77fb0 100644
--- a/src/ssl/error.rs
+++ b/src/ssl/error.rs
@@ -5,7 +5,7 @@ use libc::c_ulong;
use std::error;
use std::fmt;
use std::ffi::c_str_to_bytes;
-use std::io::IoError;
+use std::old_io::IoError;
use ffi;
diff --git a/src/ssl/mod.rs b/src/ssl/mod.rs
index 3e7cd182..35649e24 100644
--- a/src/ssl/mod.rs
+++ b/src/ssl/mod.rs
@@ -1,6 +1,6 @@
use libc::{c_int, c_void, c_long};
use std::ffi::{CString, c_str_to_bytes};
-use std::io::{IoResult, IoError, EndOfFile, Stream, Reader, Writer};
+use std::old_io::{IoResult, IoError, EndOfFile, Stream, Reader, Writer};
use std::mem;
use std::fmt;
use std::num::FromPrimitive;
@@ -291,8 +291,8 @@ impl<'ssl> MemBioRef<'ssl> {
(&mut self.bio as &mut Reader).read(buf).ok()
}
- fn write(&mut self, buf: &[u8]) {
- let _ = (&mut self.bio as &mut Writer).write(buf);
+ fn write_all(&mut self, buf: &[u8]) {
+ let _ = (&mut self.bio as &mut Writer).write_all(buf);
}
}
@@ -357,7 +357,7 @@ impl Ssl {
buf.len() as c_int) }
}
- fn write(&self, buf: &[u8]) -> c_int {
+ fn write_all(&self, buf: &[u8]) -> c_int {
unsafe { ffi::SSL_write(self.ssl.0, buf.as_ptr() as *const c_void,
buf.len() as c_int) }
}
@@ -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[..len]);
+ self.ssl.get_rbio().write_all(&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[..len])),
+ Some(len) => try!(self.stream.write_all(&self.buf[..len])),
None => break
};
}
@@ -565,11 +565,11 @@ impl<S: Stream> Reader for SslStream<S> {
}
impl<S: Stream> Writer for SslStream<S> {
- fn write(&mut self, buf: &[u8]) -> IoResult<()> {
+ fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
let mut start = 0;
while start < buf.len() {
let ret = self.in_retry_wrapper(|ssl| {
- ssl.write(buf.split_at(start).1)
+ ssl.write_all(buf.split_at(start).1)
});
match ret {
Ok(len) => start += len as usize,
@@ -605,10 +605,10 @@ impl<S> Reader for MaybeSslStream<S> where S: Stream {
}
impl<S> Writer for MaybeSslStream<S> where S: Stream{
- fn write(&mut self, buf: &[u8]) -> IoResult<()> {
+ fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
match *self {
- MaybeSslStream::Ssl(ref mut s) => s.write(buf),
- MaybeSslStream::Normal(ref mut s) => s.write(buf),
+ MaybeSslStream::Ssl(ref mut s) => s.write_all(buf),
+ MaybeSslStream::Normal(ref mut s) => s.write_all(buf),
}
}
diff --git a/src/ssl/tests.rs b/src/ssl/tests.rs
index d78e21c5..77a3118d 100644
--- a/src/ssl/tests.rs
+++ b/src/ssl/tests.rs
@@ -1,6 +1,6 @@
use serialize::hex::FromHex;
-use std::io::net::tcp::TcpStream;
-use std::io::{Writer};
+use std::old_io::net::tcp::TcpStream;
+use std::old_io::{Writer};
use std::thread::Thread;
use crypto::hash::HashType::{SHA256};
@@ -179,9 +179,9 @@ fn test_verify_callback_data() {
fn test_write() {
let stream = TcpStream::connect("127.0.0.1:15418").unwrap();
let mut stream = SslStream::new(&SslContext::new(Sslv23).unwrap(), stream).unwrap();
- stream.write("hello".as_bytes()).unwrap();
+ stream.write_all("hello".as_bytes()).unwrap();
stream.flush().unwrap();
- stream.write(" there".as_bytes()).unwrap();
+ stream.write_all(" there".as_bytes()).unwrap();
stream.flush().unwrap();
}
@@ -189,7 +189,7 @@ fn test_write() {
fn test_read() {
let stream = TcpStream::connect("127.0.0.1:15418").unwrap();
let mut stream = SslStream::new(&SslContext::new(Sslv23).unwrap(), stream).unwrap();
- stream.write("GET /\r\n\r\n".as_bytes()).unwrap();
+ stream.write_all("GET /\r\n\r\n".as_bytes()).unwrap();
stream.flush().unwrap();
stream.read_to_end().ok().expect("read error");
}
@@ -200,7 +200,7 @@ fn test_clone() {
let mut stream = SslStream::new(&SslContext::new(Sslv23).unwrap(), stream).unwrap();
let mut stream2 = stream.clone();
let _t = Thread::spawn(move || {
- stream2.write("GET /\r\n\r\n".as_bytes()).unwrap();
+ stream2.write_all("GET /\r\n\r\n".as_bytes()).unwrap();
stream2.flush().unwrap();
});
stream.read_to_end().ok().expect("read error");
diff --git a/src/x509/mod.rs b/src/x509/mod.rs
index 70cbe453..d4fdc34a 100644
--- a/src/x509/mod.rs
+++ b/src/x509/mod.rs
@@ -149,8 +149,8 @@ impl<'a, T: AsStr<'a>> ToStr for Vec<T> {
/// ```
/// # #[allow(unstable)]
/// # fn main() {
-/// use std::io::{File, Open, Write};
-/// # use std::io::fs;
+/// use std::old_io::{File, Open, Write};
+/// # use std::old_io::fs;
///
/// use openssl::crypto::hash::HashType;
/// use openssl::x509::{KeyUsage, X509Generator};
@@ -371,7 +371,7 @@ impl<'ctx> X509<'ctx> {
pub fn from_pem<R>(reader: &mut R) -> Result<X509<'ctx>, SslError> where R: Reader {
let mut mem_bio = try!(MemBio::new());
let buf = try!(reader.read_to_end().map_err(StreamError));
- try!(mem_bio.write(buf.as_slice()).map_err(StreamError));
+ try!(mem_bio.write_all(buf.as_slice()).map_err(StreamError));
unsafe {
let handle = try_ssl_null!(ffi::PEM_read_bio_X509(mem_bio.get_handle(),
@@ -417,7 +417,7 @@ impl<'ctx> X509<'ctx> {
self.handle));
}
let buf = try!(mem_bio.read_to_end().map_err(StreamError));
- writer.write(buf.as_slice()).map_err(StreamError)
+ writer.write_all(buf.as_slice()).map_err(StreamError)
}
}
diff --git a/src/x509/tests.rs b/src/x509/tests.rs
index 4e7fc925..c9a655f2 100644
--- a/src/x509/tests.rs
+++ b/src/x509/tests.rs
@@ -1,6 +1,6 @@
use serialize::hex::FromHex;
-use std::io::{File, Open, Read};
-use std::io::util::NullWriter;
+use std::old_io::{File, Open, Read};
+use std::old_io::util::NullWriter;
use crypto::hash::HashType::{SHA256};
use x509::{X509, X509Generator};