fix: gracefully handle bad native certs (#520)
Instead of failing and bailing when a bad cert is found, ignore one-off errors for bad certs and continue to load the rest of the store. These one-off errors mostly affect MacOS users, as found in this rustls-native-certs issue: https://github.com/ctz/rustls-native-certs/issues/4 Fixes: #519
This commit is contained in:
@@ -58,7 +58,10 @@ impl TlsConnector {
|
||||
|
||||
#[cfg(feature = "tls-roots")]
|
||||
{
|
||||
config.root_store = rustls_native_certs::load_native_certs().map_err(|(_, e)| e)?;
|
||||
config.root_store = match rustls_native_certs::load_native_certs() {
|
||||
Ok(store) | Err((Some(store), _)) => store,
|
||||
Err((None, error)) => Err(error)?,
|
||||
};
|
||||
}
|
||||
|
||||
if let Some(cert) = ca_cert {
|
||||
|
||||
Reference in New Issue
Block a user