Skip to content

cargo search doesn't follow redirects #15592

Open
@gtirloni

Description

@gtirloni

Problem

If a registry is redirecting the request to a different location, cargo search will fail with the following error (trimmed):

error: failed to retrieve search results from the registry at https://example.com/my_repo

Caused by:
  failed to get a 200 OK response, got 302
  headers:
  	HTTP/2 302
  	location: https://example.org/some_path/api/v1/crates?q=log&per_page=10
  	
  body:
  <html>
  <head><title>302 Found</title></head>
  <body>
  <center><h1>302 Found</h1></center>
  </body>
  </html>

Steps

  1. setup a registry that redirects
  2. cargo search --index 'sparse+https://example.com/my_repo' some_package

Possible Solution(s)

Follow redirects

Notes

No response

Version

cargo 1.87.0 (Homebrew)
release: 1.87.0
host: aarch64-apple-darwin
libgit2: 1.9.0 (sys:0.20.0 system)
libcurl: 8.7.1 (sys:0.4.80+curl-8.12.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 15.5.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions