Repository navigation
Conversation
resetius
force-pushed
the
http-write-body-full-headers
branch
3 times, most recently
from
November 4, 2026 01:38
dac4061 to
e5b8226
Compare
resetius
force-pushed
the
http-write-body-full-headers
branch
from
November 4, 2026 02:24
50f6fbc to
6513a4d
Compare
Owner
Author
|
Independent review of head Checked:
P3:
|
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
TResponse::WriteBodyFullcalled without a priorSendHeaders()wrote only the body: the client gothellowith no status line and no headers. The docs contradicted each other (some saidWriteBodyFullimpliesSendHeaders, the examples calledSendHeadersfirst).Fix
If the headers were not sent yet,
WriteBodyFullsetsContent-Lengthto the body size (unlessContent-LengthorTransfer-Encodingis already set) and sends the headers, then the body. If they were already sent, behaviour is unchanged (body only), so code that sets its ownContent-Lengthand callsSendHeaders()first produces the same bytes. Doxygen and the examples now state this one rule.Tests
Two end-to-end tests through
TWebServerover a real socket intests/test_http.cpp:WriteBodyFullwithoutSendHeadersgives a status line,Content-Length: 5and the body (fails on master, passes now).SetHeader("Content-Length")+SendHeaders+WriteBodyFullgives the same output with no duplicate headers.