]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* Correctly handle errors returned by dav providers on REPORT requests.
authorRuediger Pluem <rpluem@apache.org>
Fri, 24 Sep 2021 06:42:04 +0000 (06:42 +0000)
committerRuediger Pluem <rpluem@apache.org>
Fri, 24 Sep 2021 06:42:04 +0000 (06:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893589 13f79535-47bb-0310-9956-ffa450edef68

changes-entries/mod_dav_report_err.txt [new file with mode: 0644]
modules/dav/main/mod_dav.c

diff --git a/changes-entries/mod_dav_report_err.txt b/changes-entries/mod_dav_report_err.txt
new file mode 100644 (file)
index 0000000..c709e00
--- /dev/null
@@ -0,0 +1,2 @@
+  *) mod_dav: Correctly handle errors returned by dav providers on REPORT
+     requests. [Ruediger Pluem]
index 9b73867a72f4264c2fffd965c14f7c2da74ac25f..1a4b0663f072636be65c1df97986ceb6fb3de124 100644 (file)
@@ -4403,10 +4403,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;
@@ -4414,27 +4436,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;