You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by gs...@apache.org on 2002/03/18 23:25:01 UTC

cvs commit: httpd-2.0/modules/dav/main mod_dav.c mod_dav.h

gstein      02/03/18 14:25:01

  Modified:    modules/dav/main mod_dav.c mod_dav.h
  Log:
  Change the REPORT handling APIs to deliver the content directly into
  the filter stack, rather than buffering everything into memory(!).
  
  Revision  Changes    Path
  1.74      +8 -15     httpd-2.0/modules/dav/main/mod_dav.c
  
  Index: mod_dav.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/dav/main/mod_dav.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- mod_dav.c	13 Mar 2002 20:47:45 -0000	1.73
  +++ mod_dav.c	18 Mar 2002 22:25:01 -0000	1.74
  @@ -3868,7 +3868,6 @@
       int result;
       int label_allowed;
       ap_xml_doc *doc;
  -    ap_text_header hdr = { 0 };
       ap_text *t;
       dav_error *err;
   
  @@ -3900,23 +3899,17 @@
           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;
   }
  
  
  
  1.59      +15 -7     httpd-2.0/modules/dav/main/mod_dav.h
  
  Index: mod_dav.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/dav/main/mod_dav.h,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- mod_dav.h	13 Mar 2002 20:47:45 -0000	1.58
  +++ mod_dav.h	18 Mar 2002 22:25:01 -0000	1.59
  @@ -2169,15 +2169,23 @@
       ** 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.
  +    ** body. The report response should be generated into the specified
  +    ** output filter.
       **
  -    ** ### shouldn't generate large responses to memory ###
  +    ** 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