Parse extension headers with HTTP whitespace and full boundaries - #9
Parse extension headers with HTTP whitespace and full boundaries#9OskarEichler wants to merge 4 commits into
Conversation
|
Just leaving a note for myself on this one that the full "implied *LWS" rule in RFC 2616 actually says that words may be separated by As a regex, this would be So, we would need a compelling reason to implement this which requires additional effort to find a non-ReDoS way of expressing the "implied *LWS" syntax. |
|
Further note: a non-ReDoS pattern for implied *LWS is: |
|
Understood. These PRs were generated through the dependency audit and the project does not accept agent-authored code without meaningful human authorship and a concrete motivating bug. I cannot honestly provide that context, so I am closing this PR. |
Summary
Accept space/tab HTTP whitespace around delimiters and require complete header/value matches. Avoid returning a partial parse from a matching line within a larger string.
Reproduction and verification
261 focused whitespace/boundary cases pass. RFC 6455 section 9.1 uses the implied HTTP whitespace rule: https://www.rfc-editor.org/rfc/rfc6455.html#section-9.1 . Transport-level folded header lines must be unfolded before parsing. Existing broader quoted-string acceptance is deliberately unchanged. Paired small-header measurements show about 0.12 microseconds additional parsing cost (1.804 to 1.926 microseconds); this is handshake parsing, not a message-throughput speedup claim.
Breaking changes and limitations
Intentional correction: invalid unquoted newline suffixes/prefixes now raise ParseError instead of producing partial/empty results; supported space/tab formatting is accepted. Numeric coercion checks the entire decoded value.
Only local Ruby 4.0.6/macOS execution is claimed; the repository's older Ruby/JRuby matrix needs upstream CI. No production access or unrelated release upgrades.