Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo install failed due to interfering with git proxy in Ubuntu Linux #14952

Open
calidion opened this issue Dec 18, 2024 · 5 comments
Open
Labels
A-git Area: anything dealing with git A-networking Area: networking issues, curl, etc. C-bug Category: bug S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@calidion
Copy link

calidion commented Dec 18, 2024

Problem

when a global git https/http proxy config is set.

cargo install will fail with the following errors:

    Updating crates.io index
warning: spurious network error (3 tries remaining): [35] SSL connect error (OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to index.crates.io:443 )
warning: spurious network error (2 tries remaining): [35] SSL connect error (OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to index.crates.io:443 )
warning: spurious network error (1 tries remaining): [35] SSL connect error (OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to index.crates.io:443 )
error: download of config.json failed

Caused by:
  failed to download from `https://index.crates.io/config.json`

Caused by:
  [35] SSL connect error (OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to index.crates.io:443 )

after removing git config, cargo install will be normal again.

Steps

  1. create a git config file in ~/.gitconfig
  2. add the following config
[https]
	proxy = socks5://127.0.0.1:1080
[http]
	proxy = socks5://127.0.0.1:1080
  1. execute cargo install

Possible Solution(s)

remove git proxy config for http/https.

Notes

No response

Version

cargo 1.85.0-nightly (769f622e1 2024-12-14)
@calidion calidion added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Dec 18, 2024
@weihanglo
Copy link
Member

Thank you for the issue report.

The config doc of http.proxy doesn't mention it respects git proxy settings. As far as I can tell, this is an undocumented behavior, which was implemented in 618137b in #541, way earlier than Rust 1.0 release.

I am not seeing any reason of this design in #541. Maybe it was because crates.io registry index was mainly downloaded via Git from rust-lang/crates.io-index, or it was just a handy default to help people use Git dependencies out-of-the-box.

Cargo has sparse registry support since 1.68. If people are not using any git dependencies, it is surprising that git proxy settings affect HTTP requests for normal cargo operations.

Having some possible approaches here:

  • Completely remove the support of respecting HTTP proxy settings from git config. While this is an undocumented behavior, it might break someone's existing settings.
  • Only respect git config if an http handle is going to talk to git (like git dependencies or crates.io-index from git repo).
  • Keep the behavior as is and document it. It might still cause confusion like Should cargo config get print warning if proxy config found in git/libcurl ? #12572.

@weihanglo weihanglo added A-git Area: anything dealing with git A-networking Area: networking issues, curl, etc. S-needs-team-input Status: Needs input from team on whether/how to proceed. and removed S-triage Status: This issue is waiting on initial triage. labels Dec 18, 2024
@weihanglo
Copy link
Member

To me, since we want to rely less on a specific external, I am a bit inclined to remove the support, though the middle ground solution is not bad at all, and is consistent when net.git-fetch-with-cli enabled.

@calidion
Copy link
Author

should keep it only for git, not for crates.io.

@calidion
Copy link
Author

it seems not all cargo install will cause this problem.

@weihanglo
Copy link
Member

See also #8327.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git A-networking Area: networking issues, curl, etc. C-bug Category: bug S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

No branches or pull requests

2 participants