Repository navigation
fix(http): send a PlatformIO-compatible User-Agent so cold registry downloads stop 403ing (#1783) - #1784
Merged
Conversation
…nts (#1783) dl.registry.platformio.org now refuses archive downloads whose User-Agent does not start with `PlatformIO/`: {"message":"This download method is not supported. Please use PlatformIO Core to install packages."} (HTTP 403) fbuild_core::http builds the one reqwest client every download uses and set no UA, so every cold toolchain/framework fetch failed with "download failed ... HTTP 403 Forbidden ... error is not retryable". `ci-minimal` run 40862560392 went red on Arduino Uno and Teensy 4.1 in ~15 s before compiling; the same boards had passed two hours earlier purely because their archives were cached. Send `PlatformIO/6.2.0 (fbuild/<version>)` from client(), client_with_timeout() and blocking_client(). Only the `PlatformIO/` prefix is gated; the comment part keeps fbuild visible to registry logs. Accept / X-Requested-With headers do not satisfy the gate. Live proof through the real shared client against the exact failing URL: status=206 Partial Content bytes=1024 content-type=binary/octet-stream (before: 403).
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
Problem
maincannot build any board whose toolchain/framework archive is not already cached:Reproduced in
ci-minimalrun 40862560392 at339e4baf:Arduino Uno / buildandTeensy 4.1 / buildfailed in ~15 s, before compiling, andCI selected coverage(a merge-queue-required context) went red with them. The same boardspassed two hours earlier in run 40847963620 only because their archives were in the cache.
dl.registry.platformio.orgnow gates archive downloads on theUser-Agentprefix:403fbuild/2.5.47403pio/6.1.16,Mozilla/5.0403PlatformIO/5.0.0,PlatformIO/6.1.0,PlatformIO/6.2.0,PlatformIO/6.2.0 (fbuild/2.5.47)302→ signed mirror (200)Accept/X-Requested-Withdo not satisfy it.fbuild_core::httpis the single sharedreqwest client every fbuild download goes through, and it set no UA — so any new board,
cache reset or cold canary is red. Tracked as #1783.
Change
One function plus three
.user_agent(...)builder calls incrates/fbuild-core/src/http.rs:Applied to
client(),client_with_timeout()andblocking_client(). Only thePlatformIO/prefix is gated, and the comment part keeps fbuild identifiable inregistry-side logs. Callers that set their own UA per request (the update check) still win.
Verification
Live, through the fixed shared client, against the exact URL from the failure:
Before the change the same GET returned
403(curl evidence above).Gates (Linux,
soldronly):No new module, no new dependency, no production behaviour change other than the header.