You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2021/09/24 06:42:04 UTC

svn commit: r1893589 - in /httpd/httpd/trunk: changes-entries/mod_dav_report_err.txt modules/dav/main/mod_dav.c

Author: rpluem
Date: Fri Sep 24 06:42:04 2021
New Revision: 1893589

URL: http://svn.apache.org/viewvc?rev=1893589&view=rev
Log:
* Correctly handle errors returned by dav providers on REPORT requests.

Added:
    httpd/httpd/trunk/changes-entries/mod_dav_report_err.txt   (with props)
Modified:
    httpd/httpd/trunk/modules/dav/main/mod_dav.c

Added: httpd/httpd/trunk/changes-entries/mod_dav_report_err.txt
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/changes-entries/mod_dav_report_err.txt?rev=1893589&view=auto
==============================================================================
--- httpd/httpd/trunk/changes-entries/mod_dav_report_err.txt (added)
+++ httpd/httpd/trunk/changes-entries/mod_dav_report_err.txt Fri Sep 24 06:42:04 2021
@@ -0,0 +1,2 @@
+  *) mod_dav: Correctly handle errors returned by dav providers on REPORT
+     requests. [Ruediger Pluem]

Propchange: httpd/httpd/trunk/changes-entries/mod_dav_report_err.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: httpd/httpd/trunk/modules/dav/main/mod_dav.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/mod_dav.c?rev=1893589&r1=1893588&r2=1893589&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/main/mod_dav.c (original)
+++ httpd/httpd/trunk/modules/dav/main/mod_dav.c Fri Sep 24 06:42:04 2021
@@ -4403,10 +4403,32 @@ static int dav_method_report(request_rec
     /* 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
         /* 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;