货件生成中的SSL错误“从我们的同伴收到致命警报消息”

问题描述

我想在使用rand库的Debian上构建一个Rust项目,但在cargo build上遇到SSL错误

→ cargo build
    Updating crates.io index
error: Failed to load source for a dependency on `rand`

Caused by:
  Unable to update registry `https://github.com/rust-lang/crates.io-index`

Caused by:
  Failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  SSL error: 0xffff8880 - SSL - A fatal alert message was received from our peer; class=Ssl (16)

尝试卷曲URL可以正常工作:

→ curl https://github.com/rust-lang/crates.io-index
<html output>

解决方法

设置环境变量CARGO_HTTP_CHECK_REVOKE=false已为我解决了此问题,例如

export CARGO_HTTP_CHECK_REVOKE=false
cargo build