]> granicus.if.org Git - apache/commitdiff
Change the REPORT handling APIs to deliver the content directly into
authorGreg Stein <gstein@apache.org>
Mon, 18 Mar 2002 22:25:01 +0000 (22:25 +0000)
committerGreg Stein <gstein@apache.org>
Mon, 18 Mar 2002 22:25:01 +0000 (22:25 +0000)
the filter stack, rather than buffering everything into memory(!).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94003 13f79535-47bb-0310-9956-ffa450edef68

modules/dav/main/mod_dav.c
modules/dav/main/mod_dav.h

index 4c26c0439142616e1147a15be684efd9925842a2..ccdc361965faa4aa38af161941143b411cfc09d4 100644 (file)
@@ -3868,7 +3868,6 @@ static int dav_method_report(request_rec *r)
     int result;
     int label_allowed;
     ap_xml_doc *doc;
-    ap_text_header hdr = { 0 };
     ap_text *t;
     dav_error *err;
 
@@ -3900,23 +3899,17 @@ static int dav_method_report(request_rec *r)
         return HTTP_NOT_FOUND;
     }
 
-    /* run report hook */
-    /* ### writing large reports to memory could be bad...
-     * ### but if provider generated output directly, it would
-     * ### have to handle error responses as well.
-     */
-    if ((err = (*vsn_hooks->get_report)(r, resource, doc, &hdr)) != NULL)
-        return dav_handle_err(r, err, NULL);
-
-    /* send the report response */
+    /* set up defaults for the report response */
     r->status = HTTP_OK;
     r->content_type = DAV_XML_CONTENT_TYPE;
 
-    /* send the headers and response body */
-    ap_rputs(DAV_XML_HEADER DEBUG_CR, r);
-
-    for (t = hdr.first; t != NULL; t = t->next)
-        ap_rputs(t->text, r);
+    /* run report hook */
+    if ((err = (*vsn_hooks->deliver_report)(r, resource, doc,
+                                            r->output_filters)) != NULL) {
+        /* NOTE: we're assuming that the provider has not generated any
+           content yet! */
+        return dav_handle_err(r, err, NULL);
+    }
 
     return DONE;
 }
index 466e909e046740195329408d16e109791ce71999..9abe3c7179e879d939024680862af4f7b360f965 100644 (file)
@@ -2169,15 +2169,23 @@ struct dav_hooks_vsn
     ** must be passed to this routine.
     **
     ** The dav_xml_doc structure contains the parsed report request
-    ** body. The report response is generated into the ap_text_header
-    ** structure.
-    **
-    ** ### shouldn't generate large responses to memory ###
+    ** body. The report response should be generated into the specified
+    ** output filter.
+    **
+    ** If an error occurs, and a response has not yet been generated,
+    ** then an error can be returned from this function. mod_dav will
+    ** construct an appropriate error response. Once some output has
+    ** been placed into the filter, however, the provider should not
+    ** return an error -- there is no way that mod_dav can deliver it
+    ** properly.
+    **
+    ** ### maybe we need a way to signal an error anyways, and then
+    ** ### apache can abort the connection?
     */
-    dav_error * (*get_report)(request_rec *r,
-                              const dav_resource *resource,
-                              const ap_xml_doc *doc,
-                              ap_text_header *report);
+    dav_error * (*deliver_report)(request_rec *r,
+                                  const dav_resource *resource,
+                                  const ap_xml_doc *doc,
+                                  ap_filter_t *output);
 
     /*
     ** OPTIONAL HOOKS