From: Graham Leggett Date: Sun, 26 Sep 2021 14:18:55 +0000 (+0000) Subject: Backport: X-Git-Tag: candidate-2.4.50-rc1~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43e01b59a5db015eb4274041f784cfdb3e804eba;p=thirdparty%2Fapache%2Fhttpd.git Backport: *) mod_dav: Correctly handle errors returned by dav providers on REPORT requests. Trunk version of patch: https://svn.apache.org/r1893589 Backport version for 2.4.x of patch: Trunk version of patch works svn merge -c 1893589 ^/httpd/httpd/trunk . +1: rpluem, minfrin, ylavic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893656 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 2bcf3895016..5c295410326 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.50 + *) mod_dav: Correctly handle errors returned by dav providers on REPORT + requests. [Ruediger Pluem] + *) core: do not install core input/output filters on secondary connections. [Stefan Eissing] diff --git a/STATUS b/STATUS index 0afaf501bf0..5d2353eba5e 100644 --- a/STATUS +++ b/STATUS @@ -142,14 +142,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) mod_dav: Correctly handle errors returned by dav providers on REPORT - requests. - Trunk version of patch: - https://svn.apache.org/r1893589 - Backport version for 2.4.x of patch: - Trunk version of patch works - svn merge -c 1893589 ^/httpd/httpd/trunk . - +1: rpluem, minfrin, ylavic PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 3ba1f8cad70..2cbfc06111a 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -4329,10 +4329,32 @@ static int dav_method_report(request_rec *r) /* set up defaults for the report response */ r->status = HTTP_OK; ap_set_content_type(r, DAV_XML_CONTENT_TYPE); + err = NULL; /* run report hook */ result = dav_run_deliver_report(r, resource, doc, r->output_filters, &err); + if (err != NULL) { + + if (! r->sent_bodyct) { + /* No data has been sent to client yet; throw normal error. */ + return dav_handle_err(r, err, NULL); + } + + /* If an error occurred during the report delivery, there's + basically nothing we can do but abort the connection and + log an error. This is one of the limitations of HTTP; it + needs to "know" the entire status of the response before + generating it, which is just impossible in these streamy + response situations. */ + err = dav_push_error(r->pool, err->status, 0, + "Provider encountered an error while streaming" + " a REPORT response.", err); + dav_log_err(r, err, APLOG_ERR); + r->connection->aborted = 1; + + return DONE; + } switch (result) { case OK: return DONE; @@ -4340,27 +4362,7 @@ static int dav_method_report(request_rec *r) /* No one handled the report */ return HTTP_NOT_IMPLEMENTED; default: - if ((err) != NULL) { - - if (! r->sent_bodyct) { - /* No data has been sent to client yet; throw normal error. */ - return dav_handle_err(r, err, NULL); - } - - /* If an error occurred during the report delivery, there's - basically nothing we can do but abort the connection and - log an error. This is one of the limitations of HTTP; it - needs to "know" the entire status of the response before - generating it, which is just impossible in these streamy - response situations. */ - err = dav_push_error(r->pool, err->status, 0, - "Provider encountered an error while streaming" - " a REPORT response.", err); - dav_log_err(r, err, APLOG_ERR); - r->connection->aborted = 1; - - return DONE; - } + return DONE; } return DONE;