Skip to content

Ensure the server honors range requests to prevent download corruption#4718

Merged
rami3l merged 3 commits intorust-lang:mainfrom
FranciscoTGouveia:range-header
Feb 16, 2026
Merged

Ensure the server honors range requests to prevent download corruption#4718
rami3l merged 3 commits intorust-lang:mainfrom
FranciscoTGouveia:range-header

Conversation

@FranciscoTGouveia
Copy link
Contributor

@FranciscoTGouveia FranciscoTGouveia commented Feb 13, 2026

Fixes #4710.

As discussed in the issue, I am still unsure what position rustup should take: should we simply throw an error, or should we go a step further and restart the download from scratch?

I am more inclined toward the former, since correctly handling the range header should be the server's responsibility.
This would only become an issue if RUSTUP_DIST_SERVER is overridden; of course, this is the case for all forks of rustup (e.g., elan, or juliaup).

On another note, I would appreciate feedback on the added test.
I introduced a small workaround by adding a variable to serve_contents to allow the mock server to ignore the range request. Is there a cleaner way to achieve this?

Copy link
Member

@rami3l rami3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo some tiny nits, nice work :)

I do think that we should throw an error directly since that might urge the server side to rectify the protocol conformance issue.

As for the test code changes, it's completely okay this way so don't worry :D

PS: The CI failure for Android is a separate problem (#4720), I'm on it already.

@rami3l rami3l requested a review from djc February 14, 2026 23:50
@FranciscoTGouveia FranciscoTGouveia marked this pull request as ready for review February 15, 2026 18:36
@rami3l rami3l added this pull request to the merge queue Feb 16, 2026
Merged via the queue into rust-lang:main with commit 840a8dd Feb 16, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Download resume can silently corrupt files if server ignores Range header

3 participants