rust-lang / rust-lang/cargo

Custom registry - incorrect download url

Open
#7,617 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-registries C-bug S-needs-mentor
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Hi folks,

I am trying to implement a dockerized custom crate registry and seem to have a problem with the download URL that cargo uses.

I will jump over the Docker/NGINX/git server setup. The end result is that I have a docker container that is serving a git repo that contains the config.json file and package files.

/registry.git
    |_config.json
    |_te
         |_st
              |_test_lib

config.json:

{
    "dl": "http://127.0.0.1:8080/some_location/{crate}/{version}/download"
}

~/.cargo/config:

[registries]
test-registry = { index="http://127.0.0.1:8080/registry.git" }

Running cargo build in a package that depends on test_lib gives me an error that indicates the wrong URL:

warning: spurious network error (2 tries remaining): [7] Couldn't connect to server (Failed to connect to 127.0.0.1 port 80: Connection refused)
warning: spurious network error (1 tries remaining): [7] Couldn't connect to server (Failed to connect to 127.0.0.1 port 80: Connection refused)
error: failed to download from `http://127.0.0.1/some_location/test_lib/0.1.0/download`

Caused by:
  [7] Couldn't connect to server (Failed to connect to 127.0.0.1 port 80: Connection refused)

It's using port 80 instead of the 8080 specified in the dl field in config.json. This also seems to be inconsistent with the "fetch" part which correctly uses 127.0.0.1:8080 to retrieve the package info from the repository.

Do I need to configure anything extra?

Edit:
cargo 1.37.0 (9edd08916 2019-08-02)

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the custom registry setup with cargo 1.37.0, the provided config.json, and the dl URL containing port 8080. Investigate Cargo's custom registry download handling and verify that the download request preserves the configured port instead of falling back to port 80.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.