Add rustup doc --serve to serve docs over local HTTP - #4986
Open
Aneesh-382005 wants to merge 2 commits into
Open
Add rustup doc --serve to serve docs over local HTTP#4986Aneesh-382005 wants to merge 2 commits into
rustup doc --serve to serve docs over local HTTP#4986Aneesh-382005 wants to merge 2 commits into
Conversation
djc
reviewed
Jul 30, 2026
Aneesh-382005
force-pushed
the
doc-serve-http
branch
from
July 30, 2026 09:26
44aea2e to
226afb2
Compare
djc
reviewed
Jul 30, 2026
djc
approved these changes
Jul 30, 2026
Aneesh-382005
force-pushed
the
doc-serve-http
branch
from
July 30, 2026 13:31
a49b9ff to
6d84ea3
Compare
Author
|
Thanks for the review rounds, appreciate the feedback. Nits addressed, and changes have been squashed into two commits. |
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.
The Problem
rustup doccurrently opens the local Rust documentation asfile://URLs using the system's default browser, but sandbox browsers are unable to access the documentation. The browser opens, just to display an "Access denied" errorThis PR
Adds an opt-in
--serveflag. So instead of building afile://URL,rustup doc --serveopens anhttp://127.0.0.1:<port>/...URL instead, which can be accessed by a sandboxed browser. Default
rustup docbehavior is completely unchanged.Design decisions
127.0.0.1on an ephemeral port...or absolute paths) to keep requests confined to the doc root.Ctrl+C. Did not go with any idle timeouts because a timeout would be arbitrary and could interrupt reading.hyper(server+http1) from a dev-dependency to a dependency. Althoughreqwestalready depends onhyper, that only exposes its client-side functionality internally, so a direct dependency is required to use the server APIs.Cargo.lockadds no new packages, and the release binary grows from 14,001,792 to 14,204,752 bytes (+198.2 KiB, +1.45%).rustupcan tell whether the browser was launched, but not whether it successfully rendered the documentation.Testing
cargo buildandcargo clippy --all-targets --features testpass cleanly.cargo test --features test download::tests: 5/5 tests pass.rustup doc --serveandrustup doc --serve std::vec. Docs, assets, and relative links load correctly, invalid paths return 404, and Ctrl-C stops the server and releases the port.Fixes #4975