arturobernalg opened a new pull request, #1259:
URL: https://github.com/apache/tomcat/pull/1259

   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 
`Not` conditions, 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:
   
   | If | before | after |
   |---|---|---|
   | `(Not <urn:x>)`, file not locked | 412 | 204 |
   | `(Not <DAV:no-lock>)`, file not locked | 412 | 204 |
   | `(<urn:x>)`, file not locked | 412 | 412 |
   | `(Not <token>)`, file locked with token | 412 | 412 |
   | `(<token>)`, file locked with token | 204 | 204 |
   
   httpd mod_dav returns 204 for the first two. The new tests in 
TestWebdavIfHeader fail without the change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to