docs(ch21-01): clarify HTTP request-header end-of-headers signaling (#4574)#4786
Open
Dodothereal wants to merge 1 commit into
Open
docs(ch21-01): clarify HTTP request-header end-of-headers signaling (#4574)#4786Dodothereal wants to merge 1 commit into
Dodothereal wants to merge 1 commit into
Conversation
…ust-lang#4574) The original text reads: The browser signals the end of an HTTP request by sending two newline characters in a row, so to get one request from the stream, we take lines until we get a line that is the empty string. That's not precise: \\r\\n\\r\\n marks the end of the request headers — not the end of the entire request, which has a body that isn't delimited by a blank line. Replace with the issue's suggested phrasing: The browser signals the end of an HTTP request header by sending a carriage return and newline character twice in a row, so to get the headers of one request from the stream, we take lines until we get a line that is the empty string. Also tighten 'so to get one request ...' to 'so to get the headers of one request ...' since the code below only consumes the header lines; it does not handle the body. Closes rust-lang#4574
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.
Closes #4574
Summary
Replace
with
\\r\\n\\r\\nmarks the end of the request headers, not the end of theentire request — the request body (if any) follows the blank line and
is not delimited by another blank line. The original wording overstates
what the snippet parses.
Also tighten "so to get one request from the stream" to "so to get the
headers of one request", since the snippet below only reads header
lines.
Test plan
mdbook buildcompiles the chapter cleanly.dprint fmtreports no changes; the diff is whitespace-stable.AI assistance
Drafted with assistance from Claude; reviewed line by line before
submission. rust-lang/book has no formal AI policy, so this
disclosure is offered as good practice.