Skip to content

Commit 1c75aab

Browse files
committed
tools/unitctl: use hyper-rustls instead of hyper-tls
Signed-off-by: Ava Hahn <a.hahn@f5.com>
1 parent a9d687e commit 1c75aab

File tree

4 files changed

+77
-6
lines changed

4 files changed

+77
-6
lines changed

tools/unitctl/Cargo.lock

Lines changed: 67 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/unitctl/unit-client-rs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ default = ["serde_json/preserve_order"]
1515
[dependencies]
1616
custom_error = "1.9"
1717
hyper = { version = "0.14", features = ["stream"] }
18-
hyper-tls = "0.5"
18+
hyper-rustls = { version = "0.25.0", features = ["rustls-native-certs", "webpki-roots"] }
1919
hyperlocal = "0.8"
2020
serde = { version = "1.0", features = ["derive"] }
2121
serde_json = "1.0"

tools/unitctl/unit-client-rs/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
extern crate custom_error;
22
extern crate futures;
33
extern crate hyper;
4-
extern crate hyper_tls;
54
extern crate hyperlocal;
65
extern crate serde;
76
extern crate serde_json;

tools/unitctl/unit-client-rs/src/unit_client.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use hyper::body::{Buf, HttpBody};
99
use hyper::client::{HttpConnector, ResponseFuture};
1010
use hyper::Error as HyperError;
1111
use hyper::{http, Body, Client, Request};
12-
use hyper_tls::HttpsConnector;
12+
use hyper_rustls::{HttpsConnectorBuilder, HttpsConnector};
1313
use hyperlocal::{UnixClientExt, UnixConnector};
1414
use serde::{Deserialize, Serialize};
1515

@@ -185,7 +185,14 @@ impl UnitClient {
185185
}
186186

187187
pub fn new_http(control_socket: ControlSocket) -> Self {
188-
let remote_client = Client::builder().build(HttpsConnector::new());
188+
let remote_client = Client::builder()
189+
.build(HttpsConnectorBuilder::default()
190+
.with_native_roots()
191+
.unwrap_or_else(|_| HttpsConnectorBuilder::default()
192+
.with_webpki_roots())
193+
.https_or_http()
194+
.enable_http1()
195+
.wrap_connector(HttpConnector::new()));
189196
Self {
190197
control_socket,
191198
client: Box::from(RemoteClient::Tcp { client: remote_client }),

0 commit comments

Comments
 (0)