feat: replace hyper-tls with hyper-rustls for HttpsConnector (#280)
This commit is contained in:
parent
0e4bcbe046
commit
cfb41b0862
|
|
@ -627,7 +627,6 @@ dependencies = [
|
|||
"humantime-serde",
|
||||
"hyper 1.1.0",
|
||||
"hyper-rustls",
|
||||
"hyper-tls 0.6.0",
|
||||
"hyper-util",
|
||||
"indicatif",
|
||||
"lazy_static",
|
||||
|
|
@ -1241,22 +1240,6 @@ dependencies = [
|
|||
"tokio-native-tls",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-tls"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http-body-util",
|
||||
"hyper 1.1.0",
|
||||
"hyper-util",
|
||||
"native-tls",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.2"
|
||||
|
|
@ -2357,7 +2340,7 @@ dependencies = [
|
|||
"http 0.2.11",
|
||||
"http-body 0.4.6",
|
||||
"hyper 0.14.28",
|
||||
"hyper-tls 0.5.0",
|
||||
"hyper-tls",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
"log",
|
||||
|
|
|
|||
|
|
@ -79,10 +79,9 @@ openssl = { version = "0.10", features = ["vendored"] }
|
|||
humantime-serde = "1.1.1"
|
||||
leaky-bucket = "1.0.1"
|
||||
hyper = { version = "1.1", features = ["full"] }
|
||||
hyper-util = { version = "0.1.2", features = ["client-legacy", "tokio", "server-auto", "http1"] }
|
||||
hyper-tls = "0.6.0"
|
||||
hyper-util = { version = "0.1.2", features = ["client", "client-legacy", "tokio", "server-auto", "http1", "http2"] }
|
||||
tokio-rustls = "0.25"
|
||||
hyper-rustls = "0.26"
|
||||
hyper-rustls = { version = "0.26", features = [ "http1", "http2", "logging" ] }
|
||||
http-body-util = "0.1.0"
|
||||
regex = "1.10.2"
|
||||
http-range-header = "0.4.0"
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ use hyper::server::conn::http1;
|
|||
use hyper::service::service_fn;
|
||||
use hyper::upgrade::Upgraded;
|
||||
use hyper::{Method, Request};
|
||||
use hyper_tls::HttpsConnector;
|
||||
use hyper_util::{
|
||||
client::legacy::Client,
|
||||
rt::{tokio::TokioIo, TokioExecutor},
|
||||
|
|
@ -620,8 +619,16 @@ async fn proxy_http(request: Request<hyper::body::Incoming>) -> ClientResult<Res
|
|||
// proxy_https proxies the HTTPS request directly to the remote server.
|
||||
#[instrument(skip_all)]
|
||||
async fn proxy_https(request: Request<hyper::body::Incoming>) -> ClientResult<Response> {
|
||||
let https = HttpsConnector::new();
|
||||
let client = Client::builder(TokioExecutor::new()).build::<_, hyper::body::Incoming>(https);
|
||||
let https = hyper_rustls::HttpsConnectorBuilder::new()
|
||||
.with_native_roots()?
|
||||
.https_or_http()
|
||||
.enable_http1()
|
||||
.enable_http2()
|
||||
.build();
|
||||
|
||||
let client = Client::builder(TokioExecutor::new())
|
||||
.http2_only(true)
|
||||
.build::<_, hyper::body::Incoming>(https);
|
||||
let response = client.request(request).await?;
|
||||
Ok(response.map(|b| b.map_err(ClientError::from).boxed()))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue