Limit cacerts usage for MacOS
@@ -250,6 +250,12 @@ fn user_agent(product: &str, version: &str) -> Result<HeaderValue> {
/// extensions should be '.pem' or '.der' respectively)
fn certificates(fs_root_path: Option<&Path>) -> Result<Vec<Certificate>> {
let mut certificates = Vec::new();
+
+ // MacOS is not yet fully consistent with other platforms,
+ // as it cannot handle PEM files with multiple certs.
+ // We can enable this when the following issue is resolved:
+ // https://github.com/sfackler/rust-native-tls/issues/132
+ if cfg!(not(target_os = "macos")) {
let cacerts_ident = PackageIdent::from_str(CACERTS_PKG_IDENT)?;
if let Ok(pkg_install) = PackageInstall::load(&cacerts_ident, fs_root_path) {
@@ -268,6 +274,7 @@ fn certificates(fs_root_path: Option<&Path>) -> Result<Vec<Certificate>> {
file.write_all(CACERT_PEM.as_bytes())?;
}
}
+ }
if let Ok(entries) = fs::read_dir(cache_ssl_path(fs_root_path)) {
for entry in entries {
