← 输入框|github.com|刷新
Skip to content

Answer 502 when a Composer download's metadata lookup fails upstream - #655

Merged
andrew merged 1 commit into
git-pkgs:mainfrom
simonchrz:fix/composer-download-lookup-status
Nov 4, 2026
Merged

andrew merged 1 commit into
git-pkgs:mainfrom
simonchrz:fix/composer-download-lookup-status

Conversation

@simonchrz

Copy link
Copy Markdown
Contributor

When a Composer archive isn't cached, the proxy looks up its dist URL in the p2 metadata. findDownloadURLFromMetadata treated every non-200 response as "version not listed", so a Packagist 5xx or 429 answered the archive request with 404 version not found. Composer takes 404 as the version being gone and fails the install instead of retrying.

Now only 404 and 410 mean the document is missing, so the ~dev fallback and the 404 for an unlisted version work as before. A 429 is answered with 503 and Retry-After while the upstream is held, like the Maven .pom time lookup, and any other status answers 502.

A 403 also answers 502 now. #650 may want to forward a firewall's 403 here too, but that's left to it.

TestComposerDownloadLookupUpstreamError covers 500 and 503 (502), 429 (503 with Retry-After) and a version that isn't listed (still 404).

The lookup took any non-200 metadata response for a version that isn't
listed, so a Packagist outage or rate limit answered the archive request
with 404. Composer treats that as the version being gone.

Only 404 and 410 now mean the document is missing. A 429 is passed on as
503 with Retry-After while the upstream is held, and any other status
answers 502.
@simonchrz simonchrz added the bug Something isn't working label Nov 3, 2026
@andrew
andrew merged commit ee6cac7 into git-pkgs:main Nov 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants