From 5af783129a688c730a018507f59cb2f06c3fc150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Bro=C5=84ski?= Date: Thu, 8 May 2025 11:36:57 +0200 Subject: [PATCH] Make `http.proxy-cainfo` fallback to `http.cainfo`, like curl. --- src/cargo/util/network/http.rs | 3 ++- src/doc/src/reference/config.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cargo/util/network/http.rs b/src/cargo/util/network/http.rs index bdd427458..c0d6d5f20 100644 --- a/src/cargo/util/network/http.rs +++ b/src/cargo/util/network/http.rs @@ -61,7 +61,8 @@ pub fn configure_http_handle(gctx: &GlobalContext, handle: &mut Easy) -> CargoRe let cainfo = cainfo.resolve_path(gctx); handle.cainfo(&cainfo)?; } - if let Some(proxy_cainfo) = &http.proxy_cainfo { + // Use `proxy_cainfo` if explicitly set; otherwise, fall back to `cainfo` as curl does #15376. + if let Some(proxy_cainfo) = http.proxy_cainfo.as_ref().or(http.cainfo.as_ref()) { let proxy_cainfo = proxy_cainfo.resolve_path(gctx); handle.proxy_cainfo(&format!("{}", proxy_cainfo.display()))?; } diff --git a/src/doc/src/reference/config.md b/src/doc/src/reference/config.md index b9b643032..59afb85cd 100644 --- a/src/doc/src/reference/config.md +++ b/src/doc/src/reference/config.md @@ -711,7 +711,7 @@ certificates. If not specified, Cargo attempts to use the system certificates. #### `http.proxy-cainfo` * Type: string (path) -* Default: none +* Default: falls back to `http.cainfo` if not set * Environment: `CARGO_HTTP_PROXY_CAINFO` Path to a Certificate Authority (CA) bundle file, used to verify proxy TLS