Repository navigation
fix(registry): handle HTTP 410/451 for missing crates - #17665
Merged
Merged
Conversation
Collaborator
|
r? @Muscraft rustbot has assigned @Muscraft. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 2, 2026
In rust-lang#16745 we accidentally dropped the handling for HTTP status code 410 and 451. While how Cargo handles it is not really documented, our doc <https://doc.rust-lang.org/nightly/cargo/reference/registry-index.html#nonexistent-crates> does make it sounds like they are treated the same as 404 non-existent crates. The regression instead treats those responses are fatal errors, which affects * dependency resolutions, which cannot backtrack a old version whose dependency is unavailable, like for legal reason we need to take down but it still have dependent in the registry. * `[patch]`, which seeing a non-existent crate should still continue patching. This is rare but if some crates take down for some reason with 451, users should be able to patch them. * `cargo add`, which may stops when queruying a normalized crate name doesn't exist, and it won't continue querying the alternative form. We should restore the old behavior in 1.95 to be a bit resilient. I didn't add tests covering all above. The two new tests should be sufficient showing that they went to the same code path. Can add those if needed. Resolves rust-lang#17661
Collaborator
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Muscraft
enabled auto-merge
November 4, 2026 02:23
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Nov 6, 2026
Update cargo submodule 6 commits in 3c747ea3ead23951c1b43a5edfcbdb449135ddeb..111443f3dc4d82a65e2306a93028f122406401c1 2026-11-03 21:25:31 +0000 to 2026-11-05 22:22:33 +0000 - chore: Update libssh2-sys to 0.3.4 (rust-lang/cargo#17692) - fix(profile): preserve inherited strip (rust-lang/cargo#17678) - feat(cargo-platform): implement Serialize/Deserialize for Cfg & CfgExpr (rust-lang/cargo#17598) - fix: proc-macro typo in &String -> CrateType impl (rust-lang/cargo#17687) - book faq.md: remove misplaced `)` in offline section (rust-lang/cargo#17682) - fix(registry): handle HTTP 410/451 for missing crates (rust-lang/cargo#17665)
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Nov 6, 2026
Update cargo submodule 6 commits in 3c747ea3ead23951c1b43a5edfcbdb449135ddeb..111443f3dc4d82a65e2306a93028f122406401c1 2026-11-03 21:25:31 +0000 to 2026-11-05 22:22:33 +0000 - chore: Update libssh2-sys to 0.3.4 (rust-lang/cargo#17692) - fix(profile): preserve inherited strip (rust-lang/cargo#17678) - feat(cargo-platform): implement Serialize/Deserialize for Cfg & CfgExpr (rust-lang/cargo#17598) - fix: proc-macro typo in &String -> CrateType impl (rust-lang/cargo#17687) - book faq.md: remove misplaced `)` in offline section (rust-lang/cargo#17682) - fix(registry): handle HTTP 410/451 for missing crates (rust-lang/cargo#17665)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
In #16745 we accidentally dropped the handling
for HTTP status code 410 and 451.
While how Cargo handles it is not really documented,
our doc
https://doc.rust-lang.org/nightly/cargo/reference/registry-index.html#nonexistent-crates
does make it sounds like
they are treated the same as 404 non-existent crates.
The regression instead treats those responses are fatal errors,
which affects
which cannot backtrack a old version whose dependency is unavailable,
like for legal reason we need to take down but it still have
dependent in the registry.
[patch],which seeing a non-existent crate should still continue patching.
This is rare but if some crates take down for some reason with 451,
users should be able to patch them.
cargo add,which may stops when queruying a normalized crate name doesn't exist,
and it won't continue querying the alternative form.
We should restore the old behavior in 1.95 to be a bit resilient.
Resolves #17661
Notes to reviewers
I didn't add tests covering all above.
The two new tests should be sufficient showing that
they went to the same code path.
Can add those if needed.
🤖 LLM involvement: LLM to find if any other stable behavior are affected, and generated two tests