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

Function dav_get_allprops

modules/dav/main/props.c:595–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

593}
594
595DAV_DECLARE(dav_get_props_result) dav_get_allprops(dav_propdb *propdb,
596 dav_prop_insert what)
597{
598 const dav_hooks_db *db_hooks = propdb->db_hooks;
599 apr_text_header hdr = { 0 };
600 apr_text_header hdr_ns = { 0 };
601 dav_get_props_result result = { 0 };
602 int found_contenttype = 0;
603 int found_contentlang = 0;
604 dav_prop_insert unused_inserted;
605
606 /* if not just getting supported live properties,
607 * scan all properties in the dead prop database
608 */
609 if (what != DAV_PROP_INSERT_SUPPORTED) {
610 if (propdb->deferred) {
611 /* ### what to do with db open error? */
612 (void) dav_really_open_db(propdb, 1 /*ro*/);
613 }
614
615 /* initialize the result with some start tags... */
616 apr_text_append(propdb->p, &hdr,
617 "<D:propstat>" DEBUG_CR
618 "<D:prop>" DEBUG_CR);
619
620 /* if there ARE properties, then scan them */
621 if (propdb->db != NULL) {
622 dav_xmlns_info *xi = dav_xmlns_create(propdb->p);
623 dav_prop_name name;
624 dav_error *err;
625
626 /* define (up front) any namespaces the db might need */
627 (void) (*db_hooks->define_namespaces)(propdb->db, xi);
628
629 /* get the first property name, beginning the scan */
630 err = (*db_hooks->first_name)(propdb->db, &name);
631 while (!err && name.ns) {
632
633 /*
634 ** We also look for <DAV:getcontenttype> and
635 ** <DAV:getcontentlanguage>. If they are not stored as dead
636 ** properties, then we need to perform a subrequest to get
637 ** their values (if any).
638 */
639 if (*name.ns == 'D' && strcmp(name.ns, "DAV:") == 0
640 && *name.name == 'g') {
641 if (strcmp(name.name, "getcontenttype") == 0) {
642 found_contenttype = 1;
643 }
644 else if (strcmp(name.name, "getcontentlanguage") == 0) {
645 found_contentlang = 1;
646 }
647 }
648
649 if (what == DAV_PROP_INSERT_VALUE) {
650 int found;
651
652 if ((err = (*db_hooks->output_value)(propdb->db, &name,

Callers 2

dav_propfind_walkerFunction · 0.85

Calls 6

dav_really_open_dbFunction · 0.85
dav_xmlns_createFunction · 0.85
dav_output_prop_nameFunction · 0.85
dav_xmlns_generateFunction · 0.85
dav_insert_corepropFunction · 0.85

Tested by

no test coverage detected