我无法获得货物在经过验证的代理服务器后面的窗口下开始任何下载。
以下是我的代理设置: -
C:\Users\ukb99427\Downloads
λ set | grep http
https_proxy=http://user:pass@corporate.proxy:8080
http_proxy=http://user:pass@corporate.proxy:8080
注意http s _proxy有一个 http 地址。这允许像git和偶然的rustup-init和rustup这样的东西工作正常。这些的输出是
λ rustup update
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2017-11-10, rust version 1.23.0-nightly (d6b06c63a 2017-11-09)
info: downloading component 'rustc'
33.4 MiB / 33.4 MiB (100 %) 2.7 MiB/s ETA: 0 s
但是当运行等效的cargo install
命令时,我得到以下内容
λ cargo install libc
Updating registry `https://github.com/rust-lang/crates.io-index`
warning: spurious network error (2 tries remaining): [12/-2] [56] Failure when receiving data from the peer
warning: spurious network error (1 tries remaining): [12/-2] [56] Failure when receiving data from the peer
作为测试我可以运行 curl
λ curl --insecure https://github.com/rust-lang/crates.io-index -o registry.html
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 785k 0 785k 0 0 389k 0 --:--:-- 0:00:02 --:--:-- 393k
或者,我尝试将https_proxy设置为 https :// user:pass@corporate.proxy:8080
并获得以下
λ cargo install libc
Updating registry `https://github.com/rust-lang/crates.io-index`
warning: spurious network error (2 tries remaining): [12/-2] [4] A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision. (Unsupported proxy 'https://user:pass@corporate.proxy:8080', libcurl is built without the HTTPS-proxy support.)
warning: spurious network error (1 tries remaining): [12/-2] [4] A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision. (Unsupported proxy 'https://user:pass@corporate.proxy:8080', libcurl is built without the HTTPS-proxy support.)
error: failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
[12/-2] [4] A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision. (Unsupported proxy 'https://user:pass@corporate.proxy:8080', libcurl is built without the HTTPS-proxy support.)
参考curl --version输出
λ curl --version
curl 7.53.0 (x86_64-w64-mingw32) libcurl/7.53.0 OpenSSL/1.0.2k zlib/1.2.11 libssh2/1.8.0 nghttp2/1.19.0 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: IPv6 Largefile SSPI Kerberos SPNEGO NTLM **SSL** libz TLS-SRP HTTP2 HTTPS-proxy Metalink
货物版
λ cargo version
cargo 0.24.0-nightly (b83550edc 2017-11-04)
有没有办法让货物使用与rustup,git或curl相同的设置?其他应用程序工作正常,使用sslverify = false(例如git),这最好是一种解决方法,但是会让我到处而不是无处可去。
这一切都在Windows10上,在经过身份验证的代理之后。在没有给出用户/传递的情况下,它(和任何应用程序)以http错误407退出,这是有道理的。对于Windows应用程序,他们使用工作正常的IE设置(对于像Visual Studio Code或任何类似的应用程序)
我能想到的唯一选择是强制一切只使用http,但我不知道有任何设置可以解决货物问题。
关于我还能尝试什么的任何想法?
答案 0 :(得分:4)
我挣扎了一段时间,但终于想出了一个解决方案。我在此发布此作为企业防火墙背后的可能解决方案。遗憾的是,如果人们不能在工作中轻易安装,就会减少生锈。
从github下载crates-io
git clone --bare https://github.com/rust-lang/crates.io-index.git
在$ HOME / .cargo / config文件中设置注册表
[registry]
index = "file:///C:/Users/someuser/crates.io-index.git"
这会通过libgit-curl停止注册表下载,这显然不支持https_proxy。
我认为(但我还没有对此进行过测试)的长期解决方案是使用支持https的libgit-curl重建货物。
答案 1 :(得分:1)
现在(不确定当时是否可能),您可以通过以下方式更新~/.cargo/config
来解决此问题:
[http]
proxy = "http://<user>:<password>@<proxy_url>"
check-revoke = false