Repository navigation
fix(httpcache): keep a comma inside a quoted entity-tag in If-None-Match - #475
Merged
Merged
Conversation
ETagMatches split the header on every comma, so a tag such as "release,1" never matched itself and the request got the full response instead of a 304. Commas now separate list members only outside quotes (an entity-tag has no escapes, so quotes pair up). Co-Authored-By: Claude Fable 5.2 <[email protected]>
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.
httpcache.ETagMatchessplitIf-None-Matchon every comma, including commas inside a quoted entity-tag."release,1"therefore didn't match itself, and such a request got the full response instead of a304.Impact is low. OpenArtifact's own validators are hex digests (
ContentETag,OriginTag), which never contain a comma. I didn't find a route that emits a tag with one. This fixes the helper so a future or passed-through tag behaves correctly; RFC 9110 allows commas in entity-tags.Change
Commas separate list members only outside double quotes. An entity-tag has no escape syntax, so quotes simply pair up. Everything else is unchanged: the weak comparison (
W/ignored),*, and whitespace handling.Tests
New table cases:
W/;"a,b"against"a");The existing cases pass unchanged.
FuzzETagMatches(infuzz_test.go): any quote-free tag matches itself, alone and inside a list, and no input panics. It ran 20 s locally without a failure.Checks
golangci-lint run ./...passes.go test -shortpasses forinternal/httpcacheand its callers (internal/format/base,internal/proxy,web).make deadcodepasses.🤖 Generated with Claude Code