Harden HTTP/1.1 request framing parsing - #186
Merged
VolkerChristian merged 3 commits intoJul 11, 2026
Merged
Conversation
VolkerChristian
deleted the
codex/harden-http/1.1-request-framing-and-parsing
branch
July 24, 2026 09:33
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.
Motivation
Description
httputils(splitCommaSeparatedTokens,tokenEquals,headerHasToken,parseContentLength) and expose them viasrc/web/http/http_utils.{h,cpp}.Parser(useChunkedBodyDecoder,useIdentityBodyDecoder,configureTrailerDecoder) and useparseContentLengthand token helpers inParser::analyzeHeaderto decide decoders instead of substring heuristics (src/web/http/Parser.{h,cpp}).RequestParserto: require HTTP/1.1Host, rejectTransfer-Encoding+Content-Length, parseTransfer-Encodingas exact comma-separated tokens and accept only a finalchunkedcoding for requests, and use exactConnectiontoken parsing (src/web/http/server/RequestParser.{cpp,h}).Connectionin the client response parser (src/web/http/client/ResponseParser.cpp).Fieldsdecoder level while keeping name/whitespace checks; move semantic empty-value checks to specific headers (Host, CL, TE) (src/web/http/decoder/Fields.cpp).;or CRLF, validate it is non-empty hex, detect overflow, ignore (but not accept) extensions safely, reject trailing garbage like5xyz, and always transition to trailer parsing after the zero chunk while preventing trailers from overriding framing headers (src/web/http/decoder/Chunked.cpp,src/web/http/Parser.cpp).tests/unit/http/HttpMessageParserTest.cppwith focused cases for Transfer-Encoding token rules, TE+CL rejection, Content-Length duplicates/list/invalid handling, Host enforcement, pipelined request behavior for bodiless requests, Connection token parsing, and several chunked edge cases.Parser.{h,cpp},server/RequestParser.{h,cpp},client/ResponseParser.cpp,decoder/Fields.cpp,decoder/Chunked.cpp,http_utils.{h,cpp},tests/unit/http/HttpMessageParserTest.cpp.Testing
cmake -S . -B build -DSNODEC_BUILD_TESTS=ONthencmake --build build --target HttpMessageParserTest -j2andctest --test-dir build -R HttpMessageParserTest --output-on-failure(additional HTTP unit targets were built and exercised as noted below).HttpRequestFormatterRawWireTest,HttpResponseFormatterRawWireTest,HttpMessageHeaderCasingTest, andHttpMessageTargetQueryEdgeTestand verified they pass.Codex Task