Skip to content

Commit 57148ec

Browse files
committed
Explicitly configure noproxy support in Curl
Apparently if we don't do it then our configuration otherwise means it won't automatically get picked up! Closes #6114
1 parent ad6e5c0 commit 57148ec

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bytesize = "1.0"
2222
crates-io = { path = "src/crates-io", version = "0.20" }
2323
crossbeam-utils = "0.5"
2424
crypto-hash = "0.3.1"
25-
curl = { version = "0.4.17", features = ['http2'] }
25+
curl = { version = "0.4.18", features = ['http2'] }
2626
env_logger = "0.5.11"
2727
failure = "0.1.2"
2828
filetime = "0.2"

src/cargo/ops/registry.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,14 @@ pub fn configure_http_handle(config: &Config, handle: &mut Easy) -> CargoResult<
388388
} else {
389389
handle.useragent(&version().to_string())?;
390390
}
391+
392+
let noproxy = env::var("NO_PROXY").ok()
393+
.or_else(|| env::var("no_proxy").ok())
394+
.or(config.get::<Option<Vec<String>>>("http.noproxy")?.map(|s| s.join(",")));
395+
if let Some(noproxy) = noproxy {
396+
handle.noproxy(&noproxy)
397+
.chain_err(|| "malformed `noproxy` configuration")?;
398+
}
391399
Ok(())
392400
}
393401

src/doc/src/reference/config.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ check-revoke = true # Indicates whether SSL certs are checked for revocation
103103
low-speed-limit = 5 # Lower threshold for bytes/sec (10 = default, 0 = disabled)
104104
multiplexing = false # whether or not to use HTTP/2 multiplexing where possible
105105

106+
# A list of hosts which do not use the proxy configuration, if any.
107+
noproxy = ['github.com']
108+
106109
[build]
107110
jobs = 1 # number of parallel jobs, defaults to # of CPUs
108111
rustc = "rustc" # the rust compiler tool

src/doc/src/reference/environment-variables.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ system:
3434
will otherwise be used.
3535
* `CARGO_CACHE_RUSTC_INFO` — If this is set to 0 then Cargo will not try to cache
3636
compiler version information.
37+
* `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY` - these variables are all ready by
38+
Cargo and correspond to proxy configuration for HTTP trafic.
3739

3840
Note that Cargo will also read environment variables for `.cargo/config`
3941
configuration values, as described in [that documentation][config-env]

0 commit comments

Comments
 (0)