Repository navigation
accept colon and double quote in header values - #130
Merged
Merged
Conversation
Both are valid field-content per RFC 7230, and the neighbouring character sets in the same block already allow the colon. Without them any request carrying a Referer, Origin, Sec-CH-UA or quoted ETag header was treated as invalid and the whole session was discarded.
pawsten
self-requested a review
August 10, 2026 12:53
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.
VALID_HEADER_VALUE_SPECIAL_CHARSinlibhttpparser/src/HttpRequestParser.cpp:33lists the punctuation allowed in a header value, and it is missing:and":both are ordinary field-content per RFC 7230, and the neighbouring sets in the same block allow the colon already (
VALID_URL_SPECIAL_CHARS,VALID_HOST_HEADER_VALUE_SPECIAL_CHARS,VALID_CLIENT_IP_HEADER_VALUE_SPECIAL_CHARS). the two missing characters are the shifted forms of;and', which are both present, so this reads like a slip while typing the setthe effect is not limited to exotic requests.
isValidHeaderValueCharreturning false puts the parser in the invalid state andDiscovery.cppdrops the whole session, so any request carrying one of these is lost:Referer: https://example.com/andOrigin: https://example.com- rejected at the colonSec-CH-UA: "Chromium";v="124"- sent by Chrome and Edge on every request in a secure contextIf-None-Match: "abc123"- quoted ETagthat is close to all browser traffic to a monitored service
changes
add
:and"next to the characters they belong with, and add two cases to the valid-request suite covering aRefererand aSec-CH-UAheaderI built the test suite against the change: 33 tests pass, and against the previous parser exactly those two new cases fail while the other 31 still pass