Repository navigation
Reduce algorithmic complexity for parsing If-Match and If-None-Match. - #66796
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces worst-case parsing complexity for malformed If-Match / If-None-Match entity tag lists by propagating consumed malformed spans and advancing recovery by that span instead of retrying one character at a time.
Changes:
- Extends internal parser contracts to return
parsedLengthon success and failure. - Propagates consumed lengths from malformed quoted entity tags through range/entity tag parsing.
- Adds a regression test ensuring pathological unterminated quoted strings are parsed in one attempt.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/Shared/HttpRuleParser.cs |
Reports consumed length for invalid unterminated expressions. |
src/Http/Headers/src/HttpHeaderParser.cs |
Updates parser contract and recovery loops to advance by consumed length. |
src/Http/Headers/src/BaseHeaderParser.cs |
Implements consumed-length propagation for generic header parsers. |
src/Http/Headers/src/EntityTagHeaderValue.cs |
Propagates malformed quoted-string length for entity tags. |
src/Http/Headers/src/RangeConditionHeaderValue.cs |
Handles malformed consumed entity tags without producing a value. |
src/Http/Headers/src/CookieHeaderParser.cs |
Adapts cookie parsing to the new consumed-length contract. |
src/Http/Headers/src/CacheControlHeaderValue.cs |
Updates parser call sites and internal list parsing advancement. |
src/Http/Headers/src/ContentDispositionHeaderValue.cs |
Updates TryParse call site. |
src/Http/Headers/src/ContentRangeHeaderValue.cs |
Updates TryParse call site. |
src/Http/Headers/src/CookieHeaderValue.cs |
Updates TryParse call site. |
src/Http/Headers/src/MediaTypeHeaderValue.cs |
Updates TryParse call site. |
src/Http/Headers/src/NameValueHeaderValue.cs |
Updates TryParse call site. |
src/Http/Headers/src/RangeHeaderValue.cs |
Updates TryParse call site. |
src/Http/Headers/src/SetCookieHeaderValue.cs |
Updates TryParse call site. |
src/Http/Headers/src/StringWithQualityHeaderValue.cs |
Updates TryParse call site. |
src/Http/Headers/test/EntityTagHeaderValueTest.cs |
Adds regression coverage for the pathological entity tag input. |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
3 tasks
halter73
approved these changes
Jun 1, 2026
BrennanConroy
approved these changes
Jun 1, 2026
Contributor
Author
|
/ba-g Failures are unrelated. |
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.
Fixes #66668