Ensure the server honors range requests to prevent download corruption#4718
Merged
rami3l merged 3 commits intorust-lang:mainfrom Feb 16, 2026
Merged
Ensure the server honors range requests to prevent download corruption#4718rami3l merged 3 commits intorust-lang:mainfrom
rami3l merged 3 commits intorust-lang:mainfrom
Conversation
rami3l
approved these changes
Feb 14, 2026
Member
rami3l
left a comment
There was a problem hiding this comment.
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.
8a716e1 to
e9e8d9e
Compare
djc
approved these changes
Feb 16, 2026
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.
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_SERVERis overridden; of course, this is the case for all forks of rustup (e.g.,elan, orjuliaup).On another note, I would appreciate feedback on the added test.
I introduced a small workaround by adding a variable to
serve_contentsto allow the mock server to ignore the range request. Is there a cleaner way to achieve this?