Repository navigation
Conversation
Validate Content-Length as 1*DIGIT in one shared helper and use it on both sides. An empty value, a sign, embedded whitespace, trailing junk or an overflow is now a framing error instead of being silently reinterpreted, which previously let peers disagree about where a body ends. Request side (RFC 9110 section 8.6, RFC 9112 sections 5.1 and 6.3): - reject a Content-Length that is not 1*DIGIT - reject a repeated value that differs from the first one - reject whitespace between a field name and its colon - reject a malformed header line instead of treating it as end-of-headers Response side (RFC 9112 sections 6.3 and 7.1): - reject a malformed or repeated Content-Length - reject Content-Length together with Transfer-Encoding - recognize the final transfer coding case-insensitively and allow parameters on it - consume the whole chunked trailer section - treat 204, 304 and informational responses as bodyless - never read a body for a response to HEAD - skip 1xx responses in the HTTP client and keep waiting for the final one Adds response parser unit tests and raw-socket integration tests that exercise the request framing rules end to end. Fixes drogonframework#2648
This was referenced Nov 4, 2026
This branch has not been deployed
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.
Summary
This combines and supersedes #2652 and #2653, rebased onto current
master.Content-Length parsing is validated in one shared helper (
parseContentLength). A value that is not1*DIGIT— empty, signed, containing whitespace, with trailing junk, or overflowing — is now a framing error instead of being silently reinterpreted. Repeated values must agree, andContent-LengthwithTransfer-Encodingis rejected. All of these let two peers disagree about where a body ends, which desynchronizes keep-alive and pipelined connections.Request side (RFC 9110 §8.6, RFC 9112 §5.1, §6.3)
Content-Lengththat is not1*DIGIT.Content-Lengthwhose value differs from the first.Response side (RFC 9112 §6.3, §7.1)
Content-Length.Content-Lengthtogether withTransfer-Encoding.Tests
Content-Length,CL+TE, case-insensitive chunked coding with parameters, trailers, bodyless statuses, informational responses and HEAD.ContentLengthFramingTest.cc).unittest: 1986 assertions in 112 test cases, all passing.integration_test_server.Fixes #2648