| 2067 | } |
| 2068 | |
| 2069 | static dav_error * dav_propfind_walker(dav_walk_resource *wres, int calltype) |
| 2070 | { |
| 2071 | dav_walker_ctx *ctx = wres->walk_ctx; |
| 2072 | dav_dir_conf *conf; |
| 2073 | int flags = DAV_PROPDB_RO; |
| 2074 | dav_error *err; |
| 2075 | dav_propdb *propdb; |
| 2076 | dav_get_props_result propstats = { 0 }; |
| 2077 | |
| 2078 | /* check for any method preconditions */ |
| 2079 | if (dav_run_method_precondition(ctx->r, NULL, wres->resource, ctx->doc, &err) != DECLINED |
| 2080 | && err) { |
| 2081 | apr_pool_clear(ctx->scratchpool); |
| 2082 | return NULL; |
| 2083 | } |
| 2084 | |
| 2085 | conf = ap_get_module_config(ctx->r->per_dir_config, &dav_module); |
| 2086 | if (conf && conf->allow_lockdiscovery == DAV_ENABLED_OFF) |
| 2087 | flags |= DAV_PROPDB_DISABLE_LOCKDISCOVERY; |
| 2088 | |
| 2089 | /* |
| 2090 | ** Note: ctx->doc can only be NULL for DAV_PROPFIND_IS_ALLPROP. Since |
| 2091 | ** dav_get_allprops() does not need to do namespace translation, |
| 2092 | ** we're okay. |
| 2093 | ** |
| 2094 | ** Note: we cast to lose the "const". The propdb won't try to change |
| 2095 | ** the resource, however, since we are opening readonly. |
| 2096 | */ |
| 2097 | err = dav_popen_propdb(ctx->scratchpool, |
| 2098 | ctx->r, ctx->w.lockdb, wres->resource, flags, |
| 2099 | ctx->doc ? ctx->doc->namespaces : NULL, &propdb); |
| 2100 | if (err != NULL) { |
| 2101 | /* ### do something with err! */ |
| 2102 | |
| 2103 | if (ctx->propfind_type == DAV_PROPFIND_IS_PROP) { |
| 2104 | dav_get_props_result badprops = { 0 }; |
| 2105 | |
| 2106 | /* some props were expected on this collection/resource */ |
| 2107 | dav_cache_badprops(ctx); |
| 2108 | badprops.propstats = ctx->propstat_404; |
| 2109 | dav_stream_response(wres, 0, &badprops, ctx->scratchpool); |
| 2110 | } |
| 2111 | else { |
| 2112 | /* no props on this collection/resource */ |
| 2113 | dav_stream_response(wres, HTTP_OK, NULL, ctx->scratchpool); |
| 2114 | } |
| 2115 | |
| 2116 | apr_pool_clear(ctx->scratchpool); |
| 2117 | return NULL; |
| 2118 | } |
| 2119 | /* ### what to do about closing the propdb on server failure? */ |
| 2120 | |
| 2121 | if (ctx->propfind_type == DAV_PROPFIND_IS_PROP) { |
| 2122 | propstats = dav_get_props(propdb, ctx->doc); |
| 2123 | } |
| 2124 | else { |
| 2125 | dav_prop_insert what = ctx->propfind_type == DAV_PROPFIND_IS_ALLPROP |
| 2126 | ? DAV_PROP_INSERT_VALUE |
nothing calls this directly
no test coverage detected