Author: jorton
Date: Mon Jun 1 13:03:36 2026
New Revision: 1934836
Log:
Merge r1926172 from trunk:
* modules/dav/fs/repos.c (dav_fs_remove_resource):
Return a 404 if apr_file_remove() fails with an ENOENT error,
likely due to a race with another DELETE.
PR: 60746
Submitted by: jorton
Reviewed by: jorton, rpluem, covener
Github: closes #583
Added:
httpd/httpd/branches/2.4.x/changes-entries/pr60746.txt (contents, props changed)
Modified:
httpd/httpd/branches/2.4.x/ (props changed)
httpd/httpd/branches/2.4.x/modules/dav/fs/repos.c
Added: httpd/httpd/branches/2.4.x/changes-entries/pr60746.txt
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ httpd/httpd/branches/2.4.x/changes-entries/pr60746.txt Mon Jun 1 13:03:36 2026 (r1934836)
@@ -0,0 +1,2 @@
+ *) mod_dav_fs: Return a 404 for DELETE if deletion fails because the
+ resource no longer exists. PR 60746. [Joe Orton]
Modified: httpd/httpd/branches/2.4.x/modules/dav/fs/repos.c
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/dav/fs/repos.c Mon Jun 1 13:02:06 2026 (r1934835)
+++ httpd/httpd/branches/2.4.x/modules/dav/fs/repos.c Mon Jun 1 13:03:36 2026 (r1934836)
@@ -1486,8 +1486,16 @@ static dav_error * dav_fs_remove_resourc
/* not a collection; remove the file and its properties */
if ((status = apr_file_remove(info->pathname, info->pool)) != APR_SUCCESS) {
- /* ### put a description in here */
- return dav_new_error(info->pool, HTTP_FORBIDDEN, 0, status, NULL);
+ if (APR_STATUS_IS_ENOENT(status)) {
+ /* Return a 404 if there is a race with another DELETE,
+ * per RFC 4918§9.6. */
+ return dav_new_error(info->pool, HTTP_NOT_FOUND, 0, status,
+ "Cannot remove already-removed resource.");
+ }
+ else {
+ return dav_new_error(info->pool, HTTP_FORBIDDEN, 0, status,
+ "Cannot remove resource");
+ }
}
/* update resource state */
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.