Skip to content

Unsupported protocol with sparse registry #11726

@bebecue

Description

@bebecue

Problem

When using sparse registry, cargo reports Unsupported protocol error.

HTTP multiplexing defaults to true at

// We've enabled the `http2` feature of `curl` in Cargo, so treat
// failures here as fatal as it would indicate a build-time problem.
self.multiplexing = self.config.http_config()?.multiplexing.unwrap_or(true);
and this error is produced at
if self.multiplexing {
handle.http_version(HttpVersion::V2)?;

cargo is dynamic linked to libcurl, however libcurl from Apple in macOS 10.12.6 has no HTTP2😳

Steps

$ env CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse rustup run nightly cargo install oris
    Updating crates.io index
error: failed to query replaced source registry `crates-io`

Caused by:
  [1] Unsupported protocol

Possible Solution(s)

  • fallback to HTTP/1.1
  • replace the ambiguous error message
    • maybe add suggestion: set CARGO_HTTP_MULTIPLEXING to false if libcurl doesn't support HTTP/2
  • static link to libcurl

Notes

No response

Version

$ rustup run nightly cargo version --verbose
cargo 1.69.0-nightly (39c13e67a 2023-02-12)
release: 1.69.0-nightly
commit-hash: 39c13e67a5962466cc7253d41bc1099bbcb224c3
commit-date: 2023-02-12
host: x86_64-apple-darwin
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.54.0 (sys:0.4.59+curl-7.86.0 system ssl:SecureTransport)
os: Mac OS 10.12.6 [64-bit]

$ otool -L (rustup which --toolchain nightly cargo)
/.rustup/toolchains/nightly-x86_64-apple-darwin/bin/cargo:
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60158.100.133)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1858.112.0)
    /usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)

$ /usr/bin/curl-config --version
libcurl 7.54.0

$ /usr/bin/curl-config --feature 
SSL
IPv6
UnixSockets
libz
AsynchDNS
GSS-API
SPNEGO
Kerberos
NTLM
NTLM_WB

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-networkingArea: networking issues, curl, etc.A-sparse-registryArea: http sparse registriesC-bugCategory: bugP-highPriority: Highbeta-nominatedNominated to backport to the beta branch.regression-from-stable-to-betaRegression in beta that previously worked in stable.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions