Skip to content

Commit a5d19d6

Browse files
Merge pull request #36 from CleverCloud/devel/fdubois/feat/rustls-instead-openssl
Use rustls instead of openssl
2 parents 49a145b + b651f65 commit a5d19d6

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ crypto-common = { version = "^0.1.6", optional = true }
2727
headers = { version = "^0.3.8", optional = true }
2828
hmac = { version = "^0.12.1", features = ["std"], optional = true }
2929
hyper = { version = "^0.14.26", default-features = false, optional = true }
30-
hyper-tls = { version = "^0.5.0", optional = true }
31-
hyper-proxy = { version = "^0.9.1", default-features = false, features = ["tls"], optional = true }
30+
hyper-rustls = { version = "^0.24.0", default-features= false, features = ["webpki-tokio", "http1", "tls12"], optional = true }
31+
hyper-proxy = { version = "^0.9.1", default-features = false, features = ["rustls-webpki"], optional = true }
3232
once_cell = { version = "^1.17.1", optional = true }
3333
log = { version = "^0.4.17", optional = true }
3434
prometheus = { version = "^0.13.3", optional = true }
@@ -57,15 +57,15 @@ client = [
5757
"hyper/client",
5858
"hyper/tcp",
5959
"hyper/http1",
60-
"hyper-tls",
60+
"hyper-rustls",
6161
"serde",
6262
"serde_json",
6363
"sha2",
6464
"thiserror",
6565
"urlencoding",
6666
"uuid",
6767
]
68-
logging = ["log", "tracing/log-always"]
68+
logging = ["log", "tracing/log-always", "hyper-rustls/logging"]
6969
trace = ["tracing", "tracing-futures"]
7070
tokio = ["tracing-futures/tokio"]
7171
metrics = ["once_cell", "prometheus"]

src/client/connector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ pub use hyper::client::{
88
};
99
#[cfg(feature = "proxy")]
1010
pub use hyper_proxy::ProxyConnector;
11-
pub use hyper_tls::HttpsConnector;
11+
pub use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder};

src/client/mod.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use hyper::{
2626
},
2727
header, Body, Method, StatusCode,
2828
};
29-
use hyper_tls::HttpsConnector;
29+
use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder};
3030
#[cfg(feature = "logging")]
3131
use log::{error, log_enabled, trace, Level};
3232
#[cfg(feature = "metrics")]
@@ -662,14 +662,28 @@ where
662662
impl Default for Client<HttpsConnector<HttpConnector<GaiResolver>>> {
663663
#[cfg_attr(feature = "trace", tracing::instrument)]
664664
fn default() -> Self {
665-
Self::from(HttpsConnector::new())
665+
Self::new(
666+
HttpsConnectorBuilder::new()
667+
.with_webpki_roots()
668+
.https_or_http()
669+
.enable_http1()
670+
.build(),
671+
None,
672+
)
666673
}
667674
}
668675

669676
impl From<Credentials> for Client<HttpsConnector<HttpConnector<GaiResolver>>> {
670677
#[cfg_attr(feature = "trace", tracing::instrument)]
671678
fn from(credentials: Credentials) -> Self {
672-
Self::new(HttpsConnector::new(), Some(credentials))
679+
Self::new(
680+
HttpsConnectorBuilder::new()
681+
.with_webpki_roots()
682+
.https_or_http()
683+
.enable_http1()
684+
.build(),
685+
Some(credentials),
686+
)
673687
}
674688
}
675689

src/client/proxy.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use hyper::{
2020
Uri,
2121
};
2222
use hyper_proxy::{Custom, Intercept, Proxy, ProxyConnector};
23-
use hyper_tls::HttpsConnector;
23+
use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder};
2424
#[cfg(feature = "logging")]
2525
use log::{debug, info, log_enabled, trace, Level};
2626
use url::Url;
@@ -437,7 +437,13 @@ impl ProxyConnectorBuilder<HttpsConnector<HttpConnector<GaiResolver>>> {
437437
builder = builder.with_proxy(proxy);
438438
}
439439

440-
builder.build(HttpsConnector::new())
440+
builder.build(
441+
HttpsConnectorBuilder::new()
442+
.with_webpki_roots()
443+
.https_or_http()
444+
.enable_http1()
445+
.build(),
446+
)
441447
}
442448
}
443449

0 commit comments

Comments
 (0)