fix: do not split If-None-Match entity-tags on commas inside quotes - #80
Open
official-burak wants to merge 1 commit into
Open
official-burak wants to merge 1 commit into
official-burak wants to merge 1 commit into
Conversation
RFC 9110 opaque-tags may contain commas. parseTokenList treated every comma as a list separator, so W/"foo,bar" never matched itself.
kilisamemarisaaa
left a comment
There was a problem hiding this comment.
Verified at fbbde9c on Windows with Node 24.12.0: npm test passes all 27 tests and npm run lint is clean. I also exercised seven additional cases covering strong and weak validators, multiple comma-bearing tags, an empty/comma-only opaque tag, fragment non-matches, and commas outside quotes; all produced the expected freshness result. The quote-state scan matches RFC 9110 opaque-tag grammar, where DQUOTE is excluded from etagc, so commas inside a valid quoted tag remain data while list commas still split. I found no correctness issues in this change.
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.
parseTokenListtreated every comma as a list separator. RFC 9110opaque-tagallows commas inside the quoted entity-tag, so a validator sendingW/"foo,bar"never matched that same ETag andfresh()returned stale.Repro (2.0.0)
The list was parsed as
W/"fooandbar", neither of which equalsW/"foo,bar".Change
Track double quotes while scanning so commas inside an opaque-tag stay in that token. Commas outside quotes still separate the list. Existing spacing and weak/strong matching tests are unchanged.
Tests
W/"foo,bar"W/"foo,bar", "baz"W/"foo) does not match