From 5fc1cd93631da53ccb8af50662080ac8402c882b Mon Sep 17 00:00:00 2001 From: Greg Stein Date: Mon, 18 Mar 2002 22:25:01 +0000 Subject: [PATCH] Change the REPORT handling APIs to deliver the content directly into 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 | 23 ++++++++--------------- modules/dav/main/mod_dav.h | 24 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 4c26c04391..ccdc361965 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -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; } diff --git a/modules/dav/main/mod_dav.h b/modules/dav/main/mod_dav.h index 466e909e04..9abe3c7179 100644 --- a/modules/dav/main/mod_dav.h +++ b/modules/dav/main/mod_dav.h @@ -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 -- 2.40.0