From 923f21c32e8e5bad8461e239afd4683702c44a72 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 14 Feb 2017 07:44:21 -0800 Subject: [PATCH] Add an option to ignore SSL revocation checking This is apparently required in some Windows setups to get past SSL context creation in schannel. --- Cargo.lock | 18 +++++++++--------- Cargo.toml | 2 +- src/cargo/ops/registry.rs | 5 ++++- src/doc/config.md | 1 + 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e51ec1605f0..89782fa18d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7,7 +7,7 @@ dependencies = [ "cargotest 0.1.0", "crates-io 0.7.0", "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -116,7 +116,7 @@ dependencies = [ name = "crates-io" version = "0.7.0" dependencies = [ - "curl 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -130,10 +130,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "curl" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl-sys 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -142,7 +142,7 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -242,7 +242,7 @@ name = "git2-curl" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -315,7 +315,7 @@ version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cmake 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", - "curl-sys 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "libssh2-sys 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -826,8 +826,8 @@ dependencies = [ "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" "checksum cmake 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a3a6805df695087e7c1bcd9a82e03ad6fb864c8e67ac41b1348229ce5b7f0407" "checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97" -"checksum curl 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "654c5b772f9e62a46a99cc9ee7442e80a139027889a6305cdd59bc1e5eb3e3e8" -"checksum curl-sys 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "a89415561199ca2ac6de2519674739159c1583bc0a9b46ec30fd3814999d5ef5" +"checksum curl 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c90e1240ef340dd4027ade439e5c7c2064dd9dc652682117bd50d1486a3add7b" +"checksum curl-sys 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d909dc402ae80b6f7b0118c039203436061b9d9a3ca5d2c2546d93e0a61aaa" "checksum docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab32ea6e284d87987066f21a9e809a73c14720571ef34516f0890b3d355ccfd8" "checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90" "checksum env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "99971fb1b635fe7a0ee3c4d065845bb93cca80a23b5613b5613391ece5de4144" diff --git a/Cargo.toml b/Cargo.toml index d7120460b50..1bc2acda0eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ path = "src/cargo/lib.rs" [dependencies] crates-io = { path = "src/crates-io", version = "0.7" } crossbeam = "0.2" -curl = "0.4" +curl = "0.4.6" docopt = "0.7" env_logger = "0.4" filetime = "0.1" diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index 00cc2fb9c17..c2915afcf55 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -5,7 +5,7 @@ use std::iter::repeat; use std::path::PathBuf; use std::time::Duration; -use curl::easy::Easy; +use curl::easy::{Easy, SslOpt}; use git2; use registry::{Registry, NewCrate, NewCrateDependency}; use term::color::BLACK; @@ -231,6 +231,9 @@ pub fn http_handle(config: &Config) -> CargoResult { if let Some(cainfo) = config.get_path("http.cainfo")? { handle.cainfo(&cainfo.val)?; } + if let Some(check) = config.get_bool("http.check-revoke")? { + handle.ssl_options(SslOpt::new().no_revoke(!check.val))?; + } if let Some(timeout) = http_timeout(config)? { handle.connect_timeout(Duration::new(timeout as u64, 0))?; handle.low_speed_time(Duration::new(timeout as u64, 0))?; diff --git a/src/doc/config.md b/src/doc/config.md index 798a25da68e..c67463ffb8b 100644 --- a/src/doc/config.md +++ b/src/doc/config.md @@ -83,6 +83,7 @@ proxy = "host:port" # HTTP proxy to use for HTTP requests (defaults to none) # in libcurl format, e.g. "socks5h://host:port" timeout = 60000 # Timeout for each HTTP request, in milliseconds cainfo = "cert.pem" # Path to Certificate Authority (CA) bundle (optional) +check-revoke = true # Indicates whether SSL certs are checked for revocation [build] jobs = 1 # number of parallel jobs, defaults to # of CPUs