update to openssl 0.8 and unspecify micro versions (#22)
This commit is contained in:
parent
0eaf3709e6
commit
dc3b4f92e6
4 changed files with 18 additions and 25 deletions
|
|
@ -16,8 +16,8 @@ name = "imap"
|
|||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
openssl = "0.7.13"
|
||||
regex = "0.1.71"
|
||||
openssl = "0.8"
|
||||
regex = "0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
base64 = "0.2.0"
|
||||
base64 = "0.2"
|
||||
|
|
|
|||
|
|
@ -314,6 +314,7 @@ mod tests {
|
|||
use super::*;
|
||||
use super::super::mock_stream::MockStream;
|
||||
use super::super::mailbox::Mailbox;
|
||||
use super::super::error::Result;
|
||||
|
||||
#[test]
|
||||
fn read_response() {
|
||||
|
|
@ -549,8 +550,8 @@ mod tests {
|
|||
generic_store(" UID ", |mut c, set, query| c.uid_store(set, query));
|
||||
}
|
||||
|
||||
fn generic_store<F, T, E>(prefix: &str, op: F)
|
||||
where F: FnOnce(&mut Client<MockStream>, &str, &str) -> Result<T, E> {
|
||||
fn generic_store<F, T>(prefix: &str, op: F)
|
||||
where F: FnOnce(&mut Client<MockStream>, &str, &str) -> Result<T> {
|
||||
|
||||
let res = "* 2 FETCH (FLAGS (\\Deleted \\Seen))\r\n\
|
||||
* 3 FETCH (FLAGS (\\Deleted))\r\n\
|
||||
|
|
@ -577,8 +578,8 @@ mod tests {
|
|||
generic_copy(" UID ", |mut c, set, query| c.uid_copy(set, query))
|
||||
}
|
||||
|
||||
fn generic_copy<F, T, E>(prefix: &str, op: F)
|
||||
where F: FnOnce(&mut Client<MockStream>, &str, &str) -> Result<T, E> {
|
||||
fn generic_copy<F, T>(prefix: &str, op: F)
|
||||
where F: FnOnce(&mut Client<MockStream>, &str, &str) -> Result<T> {
|
||||
|
||||
generic_with_uid(
|
||||
"OK COPY completed\r\n",
|
||||
|
|
@ -600,8 +601,8 @@ mod tests {
|
|||
generic_fetch(" UID ", |mut c, seq, query| c.uid_fetch(seq, query))
|
||||
}
|
||||
|
||||
fn generic_fetch<F, T, E>(prefix: &str, op: F)
|
||||
where F: FnOnce(&mut Client<MockStream>, &str, &str) -> Result<T, E> {
|
||||
fn generic_fetch<F, T>(prefix: &str, op: F)
|
||||
where F: FnOnce(&mut Client<MockStream>, &str, &str) -> Result<T> {
|
||||
|
||||
generic_with_uid(
|
||||
"OK FETCH completed\r\n",
|
||||
|
|
@ -613,13 +614,13 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
fn generic_with_uid<F, T, E>(
|
||||
fn generic_with_uid<F, T>(
|
||||
res: &str,
|
||||
cmd: &str,
|
||||
seq: &str,
|
||||
query: &str,
|
||||
prefix: &str,
|
||||
op: F) where F: FnOnce(&mut Client<MockStream>, &str, &str) -> Result<T, E>,
|
||||
op: F) where F: FnOnce(&mut Client<MockStream>, &str, &str) -> Result<T>,
|
||||
{
|
||||
|
||||
let resp = format!("a1 {}\r\n", res).as_bytes().to_vec();
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@ use std::io::Error as IoError;
|
|||
use std::result;
|
||||
use std::fmt;
|
||||
use std::error::Error as StdError;
|
||||
use std::net::TcpStream;
|
||||
|
||||
use openssl::ssl::error::SslError;
|
||||
use openssl::ssl::HandshakeError as SslError;
|
||||
|
||||
pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
|
|
@ -13,7 +14,7 @@ pub enum Error {
|
|||
/// An `io::Error` that occurred while trying to read or write to a network stream.
|
||||
Io(IoError),
|
||||
/// An error from the `openssl` library.
|
||||
Ssl(SslError),
|
||||
Ssl(SslError<TcpStream>),
|
||||
/// A BAD response from the IMAP server.
|
||||
BadResponse(Vec<String>),
|
||||
/// A NO response from the IMAP server.
|
||||
|
|
@ -28,8 +29,8 @@ impl From<IoError> for Error {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<SslError> for Error {
|
||||
fn from(err: SslError) -> Error {
|
||||
impl From<SslError<TcpStream>> for Error {
|
||||
fn from(err: SslError<TcpStream>) -> Error {
|
||||
Error::Ssl(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use std::io::{Read, Result, Write, Error, ErrorKind};
|
||||
use std::cmp::min;
|
||||
|
||||
pub struct MockStream {
|
||||
read_buf: Vec<u8>,
|
||||
|
|
@ -55,13 +56,3 @@ impl Write for MockStream {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn min(a: usize, b: usize) -> usize {
|
||||
if a < b {
|
||||
a
|
||||
} else if b < a {
|
||||
b
|
||||
} else {
|
||||
a
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue