Repository navigation
Evaluate the preconditions of a conditional write to a resource that cannot be read (#1753) - #1759
Merged
Merged
Conversation
…cannot be read (#1753) A resource that supports PUT but not GET (an annotated @put only) answered 405 to a conditional PUT: the validators are retrieved through the GET handling, whose 405 was kept, so the PUT supported by the resource was never attempted. When the resource declares that it does not support GET (the annotated methods, or ServerResource.updateAllowedMethods()), the 405 of the missing GET is now discarded and the preconditions are evaluated as for a resource with no known representation: If-Match fails with 412, If-None-Match passes. A resource that declares nothing, and an error set by the resource itself, are not changed. The resource can override getInfo() to provide its validators. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
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 #1753
A resource that supports
PUTbut notGET(an annotated@Putonly) answered 405 to a conditionalPUT. The validators are retrieved through the GET handling, whose 405 was kept, so thePUTthat the resource supports was never attempted. Without the conditional header the samePUTworked.updateAllowedMethods(), the annotated methods by default), the 405 of the missing GET is discarded (with itsAllowheader) and the preconditions are evaluated as for a resource with no known representation:If-Matchfails with 412,If-None-Matchpasses (so "create only" is not enforced on a resource that cannot be read, said in the Javadoc).put()without annotating it) is not changed: the framework does not guess at overridden methods. It can declare them withupdateAllowedMethods().get()/getInfo()is still kept (Precondition Checks should honor set status #129), and a resource that overridesgetInfo()to provide its validators gets real conditional writes (Javadoc ofdoConditionalHandle).ServerResourceWriteOnlyTestCase(unit, with guards) and three cases in the wire-levelMethodNotAllowedWireTestCase. Red before the fix on each tree.Same fix on the other maintained versions: PR #1757 (3.0) and #1758 (2.7)
🤖 Generated with Claude Code