cargo fmt
This commit is contained in:
@@ -20,8 +20,7 @@ use crate::Response;
|
|||||||
use super::SerdeValue;
|
use super::SerdeValue;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref URL_BASE: Url =
|
static ref URL_BASE: Url = Url::parse("http://localhost/").expect("Failed to parse URL_BASE");
|
||||||
Url::parse("http://localhost/").expect("Failed to parse URL_BASE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Request instances are builders that creates a request.
|
/// Request instances are builders that creates a request.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use rustls::StreamOwned;
|
|||||||
use socks::{TargetAddr, ToTargetAddr};
|
use socks::{TargetAddr, ToTargetAddr};
|
||||||
|
|
||||||
#[cfg(feature = "native-tls")]
|
#[cfg(feature = "native-tls")]
|
||||||
use native_tls::{TlsConnector, TlsStream, HandshakeError};
|
use native_tls::{HandshakeError, TlsConnector, TlsStream};
|
||||||
|
|
||||||
use crate::proxy::Proto;
|
use crate::proxy::Proto;
|
||||||
use crate::proxy::Proxy;
|
use crate::proxy::Proxy;
|
||||||
@@ -192,7 +192,6 @@ pub(crate) fn connect_http(unit: &Unit) -> Result<Stream, Error> {
|
|||||||
connect_host(unit, hostname, port).map(Stream::Http)
|
connect_host(unit, hostname, port).map(Stream::Http)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(all(feature = "tls", feature = "native-certs"))]
|
#[cfg(all(feature = "tls", feature = "native-certs"))]
|
||||||
fn configure_certs(config: &mut rustls::ClientConfig) {
|
fn configure_certs(config: &mut rustls::ClientConfig) {
|
||||||
config.root_store =
|
config.root_store =
|
||||||
@@ -242,11 +241,9 @@ pub(crate) fn connect_https(unit: &Unit) -> Result<Stream, Error> {
|
|||||||
let sock = connect_host(unit, hostname, port)?;
|
let sock = connect_host(unit, hostname, port)?;
|
||||||
|
|
||||||
let tls_connector = TlsConnector::new().map_err(|e| Error::TlsError(e))?;
|
let tls_connector = TlsConnector::new().map_err(|e| Error::TlsError(e))?;
|
||||||
let stream = tls_connector.connect(hostname, sock).map_err(|e| {
|
let stream = tls_connector.connect(hostname, sock).map_err(|e| match e {
|
||||||
match e {
|
HandshakeError::Failure(err) => Error::TlsError(err),
|
||||||
HandshakeError::Failure(err) => Error::TlsError(err),
|
_ => Error::BadStatusRead,
|
||||||
_ => Error::BadStatusRead,
|
|
||||||
}
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(Stream::Https(stream))
|
Ok(Stream::Https(stream))
|
||||||
@@ -522,4 +519,3 @@ pub(crate) fn connect_test(unit: &Unit) -> Result<Stream, Error> {
|
|||||||
pub(crate) fn connect_https(unit: &Unit) -> Result<Stream, Error> {
|
pub(crate) fn connect_https(unit: &Unit) -> Result<Stream, Error> {
|
||||||
Err(Error::UnknownScheme(unit.url.scheme().to_string()))
|
Err(Error::UnknownScheme(unit.url.scheme().to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user