Skip to content

nasty cargo fetch #12386

@ardenwick

Description

@ardenwick

Problem

I 'm in isolated network. I want to make cargo fetch to use alternative crates source, so I configured in PROJECT_DIR/.cargo/config.toml:

[registries]
sf= { index = "http://mirrors.sf.com/nexus/repository/rust-crates" }

[registry]
default = "sf"

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = "sf-crates-proxy"

[source.sf-crates-proxy]
registry = "http://mirrors.sf.com/nexus/repository/rust-crates/"

[net]
git-fetch-with-cli = true

Steps

$ cargo update
    Updating `sf` index

$ cargo fetch -vv
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 1254 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 1277 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 222 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 1257 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 225 ms: Couldn't connect to server)
warning: spurious network error (2 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 216 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 1284 ms: Couldn't connect to server)
warning: spurious network error (2 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 1265 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 225 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 218 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 1234 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 8391 ms: Couldn't connect to server)
warning: spurious network error (2 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 1261 ms: Couldn't connect to server)
warning: spurious network error (2 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 2313 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 221 ms: Couldn't connect to server)
warning: spurious network error (1 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 235 ms: Couldn't connect to server)
warning: spurious network error (1 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 2295 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 4352 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 2311 ms: Couldn't connect to server)
warning: spurious network error (2 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 234 ms: Couldn't connect to server)
warning: spurious network error (2 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 3285 ms: Couldn't connect to server)
warning: spurious network error (3 tries remaining): [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 3324 ms: Couldn't connect to server)
error: failed to download from `https://crates.io/api/v1/crates/libc/0.2.147/download`

Caused by:
  [7] Couldn't connect to server (Failed to connect to crates.io port 443 after 1283 ms: Couldn't connect to server)

So why is cargo fetch still attempting to connect to crates.io ?

What more configuration am I missing?

Version

$ cargo version
cargo 1.72.0-nightly (5b377cece 2023-06-30)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions