Seth0x41 opened a new pull request, #982: URL: https://github.com/apache/tomcat/pull/982
When a WebDAV DELETE request includes a conditional header like `If-Unmodified-Since` or `If-Match`, and the condition fails, the server correctly responds with HTTP 412 Precondition Failed. However, it still proceeds to delete the resource because `doDelete()` is missing a `return` statement after setting the 412 status. The `doPut()` method handles this correctly by returning immediately. This means conditional headers are not enforced for DELETE operations. A file can be deleted by any client regardless of the precondition check result. ### POC ```bash # 1. Create a file curl -X PUT -d "protected content" http://localhost:8080/webdav/test.txt # 2. DELETE with a precondition that should fail (date in the past) curl -v -X DELETE -H "If-Unmodified-Since: Mon, 01 Jan 2001 00:00:00 GMT" http://localhost:8080/webdav/test.txt # Returns 412 Precondition Failed # 3. Check if file still exists curl -v http://localhost:8080/webdav/test.txt # Returns 404. File was deleted anyway despite the 412! ``` The fix adds the missing `return` after setting the 412 status, consistent with how `doPut()` already handles this case. -- 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]
