diff --git a/Cargo.toml b/Cargo.toml index 19b1ffa..be83bec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,8 +51,8 @@ bytes = "0.5" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] base64 = "0.11" encoding_rs = "0.8" -futures-core = { version = "0.3.0" } -futures-util = { version = "0.3.0" } +futures-core = { version = "0.3.0", default-features = false } +futures-util = { version = "0.3.0", default-features = false } http-body = "0.3.0" hyper = { version = "0.13", default-features = false, features = ["tcp"] } lazy_static = "1.4" diff --git a/src/connect.rs b/src/connect.rs index b9bdb72..81ba84d 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -1,4 +1,3 @@ -use futures_util::FutureExt; use hyper::service::Service; use http::uri::{Scheme, Authority}; use http::Uri; @@ -413,48 +412,20 @@ impl Service for Connector let timeout = self.timeout; for prox in self.proxies.iter() { if let Some(proxy_scheme) = prox.intercept(&dst) { - return with_timeout( + return Box::pin(with_timeout( self.clone().connect_via_proxy(dst, proxy_scheme), timeout, - ) - .boxed(); + )); } } - with_timeout( + Box::pin(with_timeout( self.clone().connect_with_maybe_proxy(dst, false), timeout, - ) - .boxed() + )) } } -//impl Connect for Connector { -// type Transport = Conn; -// type Error = BoxError; -// type Future = Connecting; -// -// fn connect(&self, dst: Uri) -> Self::Future { -// let timeout = self.timeout; -// for prox in self.proxies.iter() { -// if let Some(proxy_scheme) = prox.intercept(&dst) { -// return with_timeout( -// self.clone().connect_via_proxy(dst, proxy_scheme), -// timeout, -// ) -// .boxed(); -// } -// } -// -// with_timeout( -// self.clone().connect_with_maybe_proxy(dst, false), -// timeout, -// ) -// .boxed() -// } -//} - - pub(crate) trait AsyncConn: AsyncRead + AsyncWrite + Connection {} impl AsyncConn for T {}