Skip to content

Commit

Permalink
tools/unitctl: use hyper-rustls instead of hyper-tls
Browse files Browse the repository at this point in the history
Signed-off-by: Ava Hahn <[email protected]>
  • Loading branch information
avahahn committed Sep 23, 2024
1 parent ba234b4 commit 4f050af
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 6 deletions.
69 changes: 67 additions & 2 deletions tools/unitctl/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/unitctl/unit-client-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default = ["serde_json/preserve_order"]
[dependencies]
custom_error = "1.9"
hyper = { version = "0.14", features = ["stream"] }
hyper-tls = "0.5"
hyper-rustls = { version = "0.25.0", features = ["rustls-native-certs", "webpki-roots"] }
hyperlocal = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
1 change: 0 additions & 1 deletion tools/unitctl/unit-client-rs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
extern crate custom_error;
extern crate futures;
extern crate hyper;
extern crate hyper_tls;
extern crate hyperlocal;
extern crate serde;
extern crate serde_json;
Expand Down
11 changes: 9 additions & 2 deletions tools/unitctl/unit-client-rs/src/unit_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use hyper::body::{Buf, HttpBody};
use hyper::client::{HttpConnector, ResponseFuture};
use hyper::Error as HyperError;
use hyper::{http, Body, Client, Request};
use hyper_tls::HttpsConnector;
use hyper_rustls::{HttpsConnectorBuilder, HttpsConnector};
use hyperlocal::{UnixClientExt, UnixConnector};
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -185,7 +185,14 @@ impl UnitClient {
}

pub fn new_http(control_socket: ControlSocket) -> Self {
let remote_client = Client::builder().build(HttpsConnector::new());
let remote_client = Client::builder()
.build(HttpsConnectorBuilder::default()
.with_native_roots()
.unwrap_or_else(|_| HttpsConnectorBuilder::default()
.with_webpki_roots())
.https_or_http()
.enable_http1()
.wrap_connector(HttpConnector::new()));
Self {
control_socket,
client: Box::from(RemoteClient::Tcp { client: remote_client }),
Expand Down

0 comments on commit 4f050af

Please sign in to comment.