Skip to content

Commit 9a77461

Browse files
committed
Make http.proxy-cainfo fallback to http.cainfo, like curl.
1 parent ca4a3b1 commit 9a77461

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/cargo/util/network/http.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ pub fn configure_http_handle(gctx: &GlobalContext, handle: &mut Easy) -> CargoRe
6161
let cainfo = cainfo.resolve_path(gctx);
6262
handle.cainfo(&cainfo)?;
6363
}
64-
if let Some(proxy_cainfo) = &http.proxy_cainfo {
64+
// Use `proxy_cainfo` if explicitly set; otherwise, fall back to `cainfo` as curl does #15376.
65+
let effective_proxy_cainfo = match (&http.proxy_cainfo, &http.cainfo) {
66+
(Some(p), _) => Some(p),
67+
(None, Some(ca)) => Some(ca),
68+
_ => None,
69+
};
70+
if let Some(proxy_cainfo) = effective_proxy_cainfo {
6571
let proxy_cainfo = proxy_cainfo.resolve_path(gctx);
6672
handle.proxy_cainfo(&format!("{}", proxy_cainfo.display()))?;
6773
}

src/doc/src/reference/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ certificates. If not specified, Cargo attempts to use the system certificates.
711711

712712
#### `http.proxy-cainfo`
713713
* Type: string (path)
714-
* Default: none
714+
* Default: falls back to [`http.cainfo`] if not set
715715
* Environment: `CARGO_HTTP_PROXY_CAINFO`
716716

717717
Path to a Certificate Authority (CA) bundle file, used to verify proxy TLS

0 commit comments

Comments
 (0)