cargo fmt
This commit is contained in:
@@ -284,5 +284,4 @@ mod tests {
|
|||||||
request.set("Foo", "Bar");
|
request.set("Foo", "Bar");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ impl Payload {
|
|||||||
let len = bytes.len();
|
let len = bytes.len();
|
||||||
let cursor = Cursor::new(bytes);
|
let cursor = Cursor::new(bytes);
|
||||||
SizedReader::new(Some(len), Box::new(cursor))
|
SizedReader::new(Some(len), Box::new(cursor))
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use std::io::Error as IoError;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use std::io::Error as IoError;
|
||||||
|
|
||||||
/// Errors that are translated to ["synthetic" responses](struct.Response.html#method.synthetic).
|
/// Errors that are translated to ["synthetic" responses](struct.Response.html#method.synthetic).
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ use std::net::TcpStream;
|
|||||||
use std::net::ToSocketAddrs;
|
use std::net::ToSocketAddrs;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[cfg(feature = "tls")]
|
|
||||||
use rustls::StreamOwned;
|
|
||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
use rustls::ClientSession;
|
use rustls::ClientSession;
|
||||||
|
#[cfg(feature = "tls")]
|
||||||
|
use rustls::StreamOwned;
|
||||||
|
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::unit::Unit;
|
use crate::unit::Unit;
|
||||||
@@ -72,7 +72,10 @@ impl Read for Stream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
fn read_https(stream: &mut StreamOwned<ClientSession, TcpStream>, buf: &mut [u8]) -> IoResult<usize> {
|
fn read_https(
|
||||||
|
stream: &mut StreamOwned<ClientSession, TcpStream>,
|
||||||
|
buf: &mut [u8],
|
||||||
|
) -> IoResult<usize> {
|
||||||
match stream.read(buf) {
|
match stream.read(buf) {
|
||||||
Ok(size) => Ok(size),
|
Ok(size) => Ok(size),
|
||||||
Err(ref e) if is_close_notify(e) => Ok(0),
|
Err(ref e) if is_close_notify(e) => Ok(0),
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ use std::io::Read;
|
|||||||
#[test]
|
#[test]
|
||||||
fn tls_connection_close() {
|
fn tls_connection_close() {
|
||||||
let agent = ureq::Agent::default().build();
|
let agent = ureq::Agent::default().build();
|
||||||
let resp = agent.get("https://example.com/404")
|
let resp = agent
|
||||||
|
.get("https://example.com/404")
|
||||||
.set("Connection", "close")
|
.set("Connection", "close")
|
||||||
.call();
|
.call();
|
||||||
assert_eq!(resp.status(), 404);
|
assert_eq!(resp.status(), 404);
|
||||||
|
|||||||
Reference in New Issue
Block a user