Repository navigation
Create strong entity tags by default: new Tag() and new Tag(String) (#1694) - #1761
Merged
Merged
Conversation
…1694) RFC 9110 section 8.8.3: an entity tag is strong unless it carries the "W/" prefix. The constructors created a weak tag, so a server doing setTag(new Tag("v1")) sent ETag: W/"v1", which can never match an If-Match or If-Range condition (strong comparison): clients got a 412 for ever, or the lost-update protection was silently lost. Breaking in 3.0: the constructors create a strong tag. A weak tag is created with new Tag(value, true). Adds the factories Tag.strong(String) and Tag.weak(String) to state the intent. The Javadoc of Conditions no longer warns about a weak default. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 29, 2026
|
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 #1694
Breaking change in 3.0.
new Tag()andnew Tag(String)created a weak entity tag, whereas RFC 9110 section 8.8.3 says a tag is strong unless it carries theW/prefix. A server doingrepresentation.setTag(new Tag("v1"))sentETag: W/"v1", andIf-Match/If-Rangeuse the strong comparison (section 13.1), so such a tag never matches: clients got a 412 for ever, or the lost-update protection was silently lost, with nothing telling the developer why.Tag()andTag(String)now create a strong tag. A weak tag is created withnew Tag(value, true)or the newTag.weak(String);Tag.strong(String)is the explicit counterpart (additive).Tag.parseis unchanged (it was already right).ConditionsJavadoc no longer warns about a weak default.changes.md: Milestone 3, breaking changes.ETagheader loses itsW/prefix,If-Matchstarts to work, and caches may treat the validator as strong (byte-for-byte). A representation that varies between equivalent encodings should sayTag.weak(...)explicitly.TagTestCase(defaults, explicit weakness, factories, parse/format round trip),ConditionsTestCase(If-Matchwith the default tag) and the wire-levelStrongTagWireTestCase(ETagheader, conditionalPUT). Red before the change. The 25 existing usages ofnew Tag(String)in the tests needed no change.Same change on the other maintained versions (Javadoc only, behaviour unchanged there): PR #1762 (2.7) and #1763 (2.6)
🤖 Generated with Claude Code