From b953a0a42499d8523d4ec97bd80e4f92da472440 Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Sat, 27 Apr 2013 15:40:18 +0000 Subject: [PATCH] mod_dav: Sending an If or If-Match header with an invalid ETag doesn't result in a 412 Precondition Failed for a COPY operation. PR: 54610 Submitted by: Timothy Wood git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1476604 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ modules/dav/main/mod_dav.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index c22aa325ab..95b2296925 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_dav: Sending a If or If-Match header with an invalid ETag doesn't + result in a 412 Precondition Failed. PR54610 [Timothy Wood + ] + *) mod_dav: Make sure that when we prepare an If URL for Etag comparison, we compare unencoded paths. PR 53910 [Timothy Wood ] diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index f1882a97e7..0fc0810ac6 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -2748,10 +2748,10 @@ static int dav_method_copymove(request_rec *r, int is_move) } /* - * 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 @@ -2760,17 +2760,17 @@ static int dav_method_copymove(request_rec *r, int is_move) * 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, - &multi_response, - DAV_VALIDATE_PARENT - | DAV_VALIDATE_USE_424, - NULL)) != 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); -- 2.40.0