Skip to content

Remove curl dependency from crates-io crate#16936

Open
arlosi wants to merge 5 commits intorust-lang:masterfrom
arlosi:async/easy
Open

Remove curl dependency from crates-io crate#16936
arlosi wants to merge 5 commits intorust-lang:masterfrom
arlosi:async/easy

Conversation

@arlosi
Copy link
Copy Markdown
Contributor

@arlosi arlosi commented Apr 23, 2026

What does this PR try to resolve?

Converts the crates-io crate to be HTTP Client agnostic. It now uses a trait to execute HTTP requests. This enables users of the library to use any HTTP library they like, rather than only supporting curl.

Within cargo, an HttpClient using http_async is added (which uses curl internally).

cc #16845

How to test and review this PR?

Commit by commit. Could be tested on on live crates.io, but I have not done this.

arlosi added 3 commits April 21, 2026 15:42
The request_blocking method does not use the `Client`-level
timeout management, since it blocks, running the request
on the current thread. This leaves the request_blocking
method with no timeout configured.

The change adds the timeout for consistency with the `http::http_handle`
method.
This is needed since in our testing framework we use
file:// URLs. With upload(true), the test files are overwritten as empty
before they are read. This leads to the yank tests failing.

In a real (non-file://) registry api, this would have no impact.
@rustbot rustbot added A-interacts-with-crates.io Area: interaction with registries A-networking Area: networking issues, curl, etc. Command-publish S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 23, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 23, 2026

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage, weihanglo

@arlosi arlosi changed the title Async/easy Remove curl dependency from crates-io crate Apr 23, 2026
@arlosi arlosi mentioned this pull request Apr 23, 2026
6 tasks
Comment thread crates/crates-io/lib.rs
arlosi added 2 commits April 23, 2026 14:51
This is a breaking change in the crates-io crate.

It removes the dependency on curl. Users using this crate will need
to provide their own implementation of the HttpClient trait using
curl or another http request library.
@arlosi
Copy link
Copy Markdown
Contributor Author

arlosi commented Apr 23, 2026

This is a breaking change for the crates-io crate which removes curl and requires users to provide their own HTTP client implementation using curl or another http request library.

@rfcbot fcp merge cargo

@arlosi

This comment was marked as outdated.

1 similar comment
@weihanglo

This comment was marked as outdated.

@weihanglo weihanglo added the T-cargo Team: Cargo label Apr 24, 2026
@weihanglo
Copy link
Copy Markdown
Member

weihanglo commented Apr 24, 2026

See #16936 (comment).

@rfcbot fcp merge cargo

@rust-rfcbot
Copy link
Copy Markdown
Collaborator

rust-rfcbot commented Apr 24, 2026

Team member @weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Apr 24, 2026

[dependencies]
curl.workspace = true
http.workspace = true
Copy link
Copy Markdown
Member

@weihanglo weihanglo Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we enhance docs talking about how to restore the curl backend behavior?

If it is not worthy, leave it :)

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm kinda split about that. I have a branch that adds a curl feature to provide a CurlClient that implements the trait and gives users a way back to the old behavior. However, since Cargo wouldn't be enabling the feature, it would have less coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-interacts-with-crates.io Area: interaction with registries A-networking Area: networking issues, curl, etc. Command-publish disposition-merge FCP with intent to merge proposed-final-comment-period An FCP proposal has started, but not yet signed off. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-cargo Team: Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants