Make http.proxy-cainfo fallback to http.cainfo, like curl.

This commit is contained in:
Andrzej Broński 2025-05-08 11:36:57 +02:00
parent ca4a3b1f8b
commit 5af783129a
2 changed files with 3 additions and 2 deletions

View File

@ -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()))?;
}

View File

@ -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