Repository navigation
Evaluate WebDAV If conditions against all the lock tokens of a resource - #1259
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
Each condition of an If header list was evaluated once per lock token of the resource. A resource without locks has no tokens, so every condition, including "Not" conditions and entity tags, evaluated to false and the request failed with 412. With several lock tokens, "Not <token>" was true as soon as one of the other tokens differed. RFC 4918, section 10.4.3: "Not" reverses the result of the evaluation of a condition, and section 10.4.8 gives "(Not <DAV:no-lock>)" as a condition that always evaluates to true. A state token condition now matches if the token is one of the lock tokens of the resource.
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.
Each condition of an If header list is evaluated once per lock token of the resource. A resource without locks has no tokens, so every condition, including
Notconditions, evaluates to false and the request fails with 412. With several lock tokens,Not <token>is true as soon as one of the other tokens differs, even though the resource is locked with that token.RFC 4918, section 10.4.3: prefixing a condition with "Not" reverses the result of the evaluation, and if the header evaluates to true "execution of the request can proceed as if the header wasn't present". Section 10.4.8 gives
(Not <DAV:no-lock>)as a condition that always evaluates to true.A state token condition now matches if the token is one of the lock tokens of the resource, and a list is evaluated once against all the tokens.
Tested on a local Tomcat with PUT on an existing file:
(Not <urn:x>), file not locked(Not <DAV:no-lock>), file not locked(<urn:x>), file not locked(Not <token>), file locked with token(<token>), file locked with tokenhttpd mod_dav returns 204 for the first two. The new tests in TestWebdavIfHeader fail without the change.