企业代理背后的 Windows 上的货物 [英] Cargo on Windows behind a corporate proxy
问题描述
我认为对于那些希望在工作中使用 Cargo 和 Windows 的人来说,这是一个非常普遍的问题;我已经看到多个 GitHub 问题和与之相关的论坛帖子,但没有一个答案解决了我的问题.
I think this is a very common issue among those who want to use Cargo with Windows at work; I have seen multiple GitHub issues and forum posts related to it, but none of the answers solved my problems.
每当我尝试构建一些指向 crates.io crate 的代码时,我都会收到以下错误:
Whenever I try to build some code pointing to a crates.io crate, I get the following error:
Downloading <package>
error: unable to get packages from source
Caused by:
failed to download package <package> from <package address>
Caused by:
SSL connect error
我该怎么做才能解决这个问题?我知道 Cargo 可以使用 .cargo/config
中的设置,并且代理详细信息可以包含在那里,但它对我不起作用,无论是否指定证书的路径(我使用了与 curl 一起分发的那个),如下所示:
What can I do to fix this? I know that Cargo can use the settings at .cargo/config
and that the proxy details can be included there, but it doesn't work for me, with or without specifying the path for the certificate (I used the one distributed with curl), like below:
[http]
proxy = "http://user:password@proxy-address.xyz:port"
cainfo = "cert.pem"
[https]
proxy = "https://user:password@proxy-address.xyz:port"
cainfo = "cert.pem"
配置文件中指定的代理可用于任何其他目的.
The proxy specified in the config file works for any other purpose.
我使用的是 Windows 7 64 位、Rust 1.11 GNU 和与之捆绑的 Cargo.我怎样才能让它工作?目前,我不得不从他们的存储库中手动下载 crate 源,并在 Cargo 配置文件中为每个源指定 paths = [...]
.
I'm using Windows 7 64bit, Rust 1.11 GNU and Cargo bundled with it. How can I get this working? Currently I have to resort to downloading crate sources manually from their repositories and specifying paths = [...]
for each of them in the Cargo config file.
推荐答案
从与 Rust 1.13 stable 捆绑的 Cargo 0.13 开始,这似乎不再是问题 - 我不再需要手动下载包并将它们放入 paths
在货物的配置文件中.
It appears that this is no longer an issue as of cargo 0.13 bundled with Rust 1.13 stable - I no longer need to manually download packages and put them in paths
in cargo's config file.
这篇关于企业代理背后的 Windows 上的货物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!