Skip to content

Commit

Permalink
Auto merge of #11286 - ehuss:410-gone, r=Eh2406
Browse files Browse the repository at this point in the history
Fix 410 gone response handling

This changes the sparse-registry support for the 410 "Gone" HTTP response code. This is out of sync with the [load function](https://github.com/rust-lang/cargo/blob/8adf1df292c20bd21f91effc6fbff1c19a514c89/src/cargo/sources/registry/http_remote.rs#L375) mentioned in the comment. I assume it is supposed to be 410 and not 401 since 401 is "Unauthorized", and that doesn't signify that the resource is "not found".

r? `@arlosi`
  • Loading branch information
bors committed Oct 25, 2022
2 parents 8adf1df + c8c6a96 commit 9210810
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cargo/sources/registry/http_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl<'cfg> HttpRegistry<'cfg> {
result.with_context(|| format!("failed to download from `{}`", url))?;
let code = handle.response_code()?;
// Keep this list of expected status codes in sync with the codes handled in `load`
if !matches!(code, 200 | 304 | 401 | 404 | 451) {
if !matches!(code, 200 | 304 | 410 | 404 | 451) {
let url = handle.effective_url()?.unwrap_or(&url);
return Err(HttpNotSuccessful {
code,
Expand Down

0 comments on commit 9210810

Please sign in to comment.