You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Seth0x41 (via GitHub)" <gi...@apache.org> on 2026/04/06 20:34:49 UTC
[PR] Fix missing return in WebdavServlet doDelete after precondition failure [tomcat]
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: dev-unsubscribe@tomcat.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: [PR] Fix missing return in WebdavServlet doDelete after precondition failure [tomcat]
Posted by "rmaucher (via GitHub)" <gi...@apache.org>.
rmaucher merged PR #982:
URL: https://github.com/apache/tomcat/pull/982
--
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: dev-unsubscribe@tomcat.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org