Skip to content

Commit 464b886

Browse files
committed
Load root certificates for rustls
1 parent 0b48f7f commit 464b886

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ default = ["tokio_io"]
1818
_tls = [] # meta feature for the clickhouse-rs generic TLS code
1919
tls = ["tls-native-tls"] # backward compatibility
2020
tls-native-tls = ["tokio-native-tls", "native-tls", "_tls"]
21-
tls-rustls = ["tokio-rustls", "rustls", "rustls-pemfile", "_tls"]
21+
tls-rustls = ["tokio-rustls", "rustls", "rustls-pemfile", "webpki-roots", "_tls"]
2222
async_std = ["async-std"]
2323
tokio_io = ["tokio"]
2424

@@ -82,6 +82,10 @@ optional = true
8282
version = "0.25.0"
8383
optional = true
8484

85+
[dependencies.webpki-roots]
86+
version = "*"
87+
optional = true
88+
8589
[dependencies.chrono]
8690
version = "^0.4"
8791
default-features = false

src/connecting_stream.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,11 @@ impl ConnectingStream {
268268
.with_no_client_auth()
269269
} else {
270270
let mut cert_store = RootCertStore::empty();
271-
// TODO: add webpki_roots::TLS_SERVER_ROOTS
271+
cert_store.extend(
272+
webpki_roots::TLS_SERVER_ROOTS
273+
.iter()
274+
.cloned()
275+
);
272276
if let Some(certificates) = options.certificate.clone() {
273277
for certificate in
274278
Into::<Vec<rustls::pki_types::CertificateDer<'static>>>::into(

0 commit comments

Comments
 (0)