https://issues.apache.org/bugzilla/show_bug.cgi?id=54610

            Bug ID: 54610
           Summary: COPY doesn't respect If/If-Modified/etc
           Product: Apache httpd-2
           Version: 2.4.3
          Hardware: PC
                OS: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_dav
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified

Sending a If or If-Match header with an invalid ETag doesn't result in a 412
Precondition Failed.

<http://www.webdav.org/specs/rfc4918.html#METHOD_COPY> has an example
specifically calling out preconditions on COPY (10.4.9), for example, but I'm
just doing a simple If-Match.

This patch (vs our local clone of 2.4.3) resolves the issue for me, but I'm
wondering if there is some case this would break.

Thanks!

-tim

Index: modules/dav/main/mod_dav.c
===================================================================
--- modules/dav/main/mod_dav.c    (revision 180376)
+++ modules/dav/main/mod_dav.c    (revision 180377)
@@ -2761,10 +2761,10 @@
    }

    /*
-     * Check If-Headers and existing locks for each resource in the source
-     * if we are performing a MOVE. We will return a 424 response with a
-     * DAV:multistatus body. The multistatus responses will contain the
-     * information about any resource that fails the validation.
+     * Check If-Headers and existing locks for each resource in the source.
+     * We will return a 424 response with a DAV:multistatus body.
+     * The multistatus responses will contain the information about any
+     * resource that fails the validation.
     *
     * We check the parent resource, too, since this is a MOVE. Moving the
     * resource effectively removes it from the parent collection, so we
@@ -2773,17 +2773,17 @@
     * If a problem occurs with the Request-URI itself, then a plain error
     * (rather than a multistatus) will be returned.
     */
-    if (is_move
-        && (err = dav_validate_request(r, resource, depth, NULL,
+    if ((err = dav_validate_request(r, resource, depth, NULL,
                                       &multi_response,
                                       DAV_VALIDATE_PARENT
                                       | DAV_VALIDATE_USE_424,
                                       NULL)) != NULL) {
        err = dav_push_error(r->pool, err->status, 0,
                             apr_psprintf(r->pool,
-                                          "Could not MOVE %s due to a failed "
+                                          "Could not %s %s due to a failed "
                                          "precondition on the source "
                                          "(e.g. locks).",
+                                          is_move ? "MOVE" : "COPY",
                                          ap_escape_html(r->pool, r->uri)),
                             err);
        return dav_handle_err(r, err, multi_response);

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to