Open
Labels
Milestone
Description
Problem
The current HTTP header parsing implementation in the codebase uses naive string splitting methods that fail when quoted values contain delimiter characters. This affects the ForwardedHeader implementation and potentially other header parsers.
Example Issue
A header value like:
for="[2001:db8:cafe::17]:4711";desc="semi;colon"
Will be incorrectly parsed because the simple split(';') and split('=') methods don't respect quoted strings and escapes.
Current Implementation
The parsing uses:
final pairStrings = elementStr.split(';');
final parts = pairStr.split('=');Suggested Solutions
Reuse<-- no such thingHeaderValue.parsefrompackage:http_parser- Implement a custom state machine that properly handles quoted strings and escapes
- Use a proper HTTP header parser that respects RFC standards
Impact
This is a broader architectural issue that could affect multiple header types beyond just the Forwarded header.
References
- Original discussion: feat: Typed forwarded header #101 (comment)
- Related PR: feat: Typed forwarded header #101
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog 🗂️
- StatusShow more project fieldsBacklog
Activity
nielsenko commentedon Jun 17, 2025
There is no such thing as
HeaderValue.parseexported from thehttp_parser(@coderabbitai is hallucinating), but we may steal the privatescan.dartfile and build on that.SandPod commentedon Aug 14, 2025
Relates to #113