MCPcopy Create free account
hub / github.com/apache/httpd / dav_method_report

Function dav_method_report

modules/dav/main/mod_dav.c:4352–4434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4350}
4351
4352static int dav_method_report(request_rec *r)
4353{
4354 dav_resource *resource;
4355 const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r);
4356 apr_xml_doc *doc;
4357 dav_error *err = NULL;
4358
4359 int result;
4360 int label_allowed;
4361
4362 if ((result = ap_xml_parse_input(r, &doc)) != OK) {
4363 return result;
4364 }
4365 if (doc == NULL) {
4366 /* This supplies additional information for the default msg. */
4367 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00614)
4368 "The request body must specify a report.");
4369 return HTTP_BAD_REQUEST;
4370 }
4371
4372 /* Ask repository module to resolve the resource.
4373 * First determine whether a Target-Selector header is allowed
4374 * for this report.
4375 */
4376 label_allowed = vsn_hooks ? (*vsn_hooks->report_label_header_allowed)(doc) : 0;
4377 err = dav_get_resource(r, label_allowed, 0 /* use_checked_in */,
4378 &resource);
4379 if (err != NULL) {
4380 return dav_handle_err(r, err, NULL);
4381 }
4382
4383 /* check for any method preconditions */
4384 if (dav_run_method_precondition(r, resource, NULL, doc, &err) != DECLINED
4385 && err) {
4386 return dav_handle_err(r, err, NULL);
4387 }
4388
4389 if (!resource->exists) {
4390 /* Apache will supply a default error for this. */
4391 return HTTP_NOT_FOUND;
4392 }
4393
4394 /* set up defaults for the report response */
4395 r->status = HTTP_OK;
4396 ap_set_content_type(r, DAV_XML_CONTENT_TYPE);
4397 err = NULL;
4398
4399 /* run report hook */
4400 result = dav_run_deliver_report(r, resource, doc,
4401 r->output_filters, &err);
4402 if (err != NULL) {
4403
4404 if (! r->sent_bodyct) {
4405 /* No data has been sent to client yet; throw normal error. */
4406 return dav_handle_err(r, err, NULL);
4407 }
4408
4409 /* If an error occurred during the report delivery, there's

Callers 1

dav_handlerFunction · 0.85

Calls 6

ap_xml_parse_inputFunction · 0.85
dav_get_resourceFunction · 0.85
dav_handle_errFunction · 0.85
ap_set_content_typeFunction · 0.85
dav_push_errorFunction · 0.85
dav_log_errFunction · 0.85

Tested by

no test coverage detected