Write a complete RESPONSE object out as a xml element. Data is sent into brigade BB, which is auto-flushed into the output filter stack for request R. Use POOL for any temporary allocations. [Presumably the tag has already been written; this routine is shared by dav_send_multistatus and dav_stream_response.] */
| 484 | routine is shared by dav_send_multistatus and dav_stream_response.] |
| 485 | */ |
| 486 | DAV_DECLARE(void) dav_send_one_response(dav_response *response, |
| 487 | apr_bucket_brigade *bb, |
| 488 | request_rec *r, |
| 489 | apr_pool_t *pool) |
| 490 | { |
| 491 | apr_text *t = NULL; |
| 492 | |
| 493 | if (response->propresult.xmlns == NULL) { |
| 494 | ap_fputs(r->output_filters, bb, "<D:response>"); |
| 495 | } |
| 496 | else { |
| 497 | ap_fputs(r->output_filters, bb, "<D:response"); |
| 498 | for (t = response->propresult.xmlns; t; t = t->next) { |
| 499 | ap_fputs(r->output_filters, bb, t->text); |
| 500 | } |
| 501 | ap_fputc(r->output_filters, bb, '>'); |
| 502 | } |
| 503 | |
| 504 | ap_fputstrs(r->output_filters, bb, |
| 505 | DEBUG_CR "<D:href>", |
| 506 | dav_xml_escape_uri(pool, response->href), |
| 507 | "</D:href>" DEBUG_CR, |
| 508 | NULL); |
| 509 | |
| 510 | if (response->propresult.propstats == NULL) { |
| 511 | /* use the Status-Line text from Apache. Note, this will |
| 512 | * default to 500 Internal Server Error if first->status |
| 513 | * is not a known (or valid) status code. |
| 514 | */ |
| 515 | ap_fputstrs(r->output_filters, bb, |
| 516 | "<D:status>HTTP/1.1 ", |
| 517 | ap_get_status_line(response->status), |
| 518 | "</D:status>" DEBUG_CR, |
| 519 | NULL); |
| 520 | } |
| 521 | else { |
| 522 | /* assume this includes <propstat> and is quoted properly */ |
| 523 | for (t = response->propresult.propstats; t; t = t->next) { |
| 524 | ap_fputs(r->output_filters, bb, t->text); |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | if (response->desc != NULL) { |
| 529 | /* |
| 530 | * We supply the description, so we know it doesn't have to |
| 531 | * have any escaping/encoding applied to it. |
| 532 | */ |
| 533 | ap_fputstrs(r->output_filters, bb, |
| 534 | "<D:responsedescription>", |
| 535 | response->desc, |
| 536 | "</D:responsedescription>" DEBUG_CR, |
| 537 | NULL); |
| 538 | } |
| 539 | |
| 540 | ap_fputs(r->output_filters, bb, "</D:response>" DEBUG_CR); |
| 541 | } |
| 542 | |
| 543 |
no test coverage detected