On 6/28/20 3:28 PM, minf...@apache.org wrote:
> Author: minfrin
> Date: Sun Jun 28 13:28:19 2020
> New Revision: 1879307
> 
> URL: http://svn.apache.org/viewvc?rev=1879307&view=rev
> Log:
> Add implementation of deliver_report and gather_reports to mod_dav.c.
> 
> Modified:
>     httpd/httpd/trunk/modules/dav/main/mod_dav.c
> 
> 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=1879307&r1=1879306&r2=1879307&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/dav/main/mod_dav.c (original)
> +++ httpd/httpd/trunk/modules/dav/main/mod_dav.c Sun Jun 28 13:28:19 2020

> @@ -4228,24 +4271,36 @@ static int dav_method_report(request_rec
>      ap_set_content_type(r, DAV_XML_CONTENT_TYPE);
>  
>      /* run report hook */
> -    if ((err = (*vsn_hooks->deliver_report)(r, resource, doc,
> -                                            r->output_filters)) != 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;
> +    result = dav_run_deliver_report(r, resource, doc,
> +            r->output_filters, &err);
> +    switch (result) {
> +    case OK:
>          return DONE;

What happens if err != NULL. Should we handle that here like in the default 
case or
should the hook implementer ensure to not return OK if err != NULL?

> +    case DECLINED:
> +        /* No one handled the report */
> +        return HTTP_NOT_IMPLEMENTED;

Previously we were returning DECLINED in case there was no vsn_hooks and thus 
nothing to report. Now we return
HTTP_NOT_IMPLEMENTED. Why this change?

> +    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;

Regards

RĂ¼diger


Reply via email to