From ce260076105d54ad626ef59bf3771de5e678e146 Mon Sep 17 00:00:00 2001 From: Guus Waals <_@guusw.nl> Date: Sun, 19 Mar 2023 21:14:53 +0800 Subject: [PATCH] Make failure adding certificates from rustls_native_certs non-fatal --- src/tls.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tls.rs b/src/tls.rs index ad54de3..2849fdf 100644 --- a/src/tls.rs +++ b/src/tls.rs @@ -70,6 +70,7 @@ mod encryption { #[cfg(feature = "__rustls-tls")] pub mod rustls { + use log::warn; use rustls::{ClientConfig, ClientConnection, RootCertStore, ServerName, StreamOwned}; use std::{ @@ -105,9 +106,10 @@ mod encryption { #[cfg(feature = "rustls-tls-native-roots")] { for cert in rustls_native_certs::load_native_certs()? { - root_store - .add(&rustls::Certificate(cert.0)) - .map_err(TlsError::Webpki)?; + match root_store.add(&rustls::Certificate(cert.0)) { + Ok(_) => {} + Err(x) => warn!("Failed to add certificate {}", x), + }; } } #[cfg(feature = "rustls-tls-webpki-roots")]