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

Function dav_method_propfind

modules/dav/main/mod_dav.c:2144–2289  ·  view source on GitHub ↗

handle the PROPFIND method */

Source from the content-addressed store, hash-verified

2142
2143/* handle the PROPFIND method */
2144static int dav_method_propfind(request_rec *r)
2145{
2146 dav_resource *resource;
2147 int depth;
2148 dav_error *err;
2149 int result;
2150 apr_xml_doc *doc;
2151 dav_walker_ctx ctx = { { 0 } };
2152 dav_response *multi_status;
2153
2154 /* Ask repository module to resolve the resource */
2155 err = dav_get_resource(r, 1 /* label_allowed */, 0 /* use_checked_in */,
2156 &resource);
2157 if (err != NULL)
2158 return dav_handle_err(r, err, NULL);
2159
2160 if ((result = ap_xml_parse_input(r, &doc)) != OK) {
2161 return result;
2162 }
2163 /* note: doc == NULL if no request body */
2164
2165 /* check for any method preconditions */
2166 if (dav_run_method_precondition(r, resource, NULL, doc, &err) != DECLINED
2167 && err) {
2168 return dav_handle_err(r, err, NULL);
2169 }
2170
2171 if (dav_get_resource_state(r, resource) == DAV_RESOURCE_NULL) {
2172 /* Apache will supply a default error for this. */
2173 return HTTP_NOT_FOUND;
2174 }
2175
2176 if ((depth = dav_get_depth(r, DAV_INFINITY)) < 0) {
2177 /* dav_get_depth() supplies additional information for the
2178 * default message. */
2179 return HTTP_BAD_REQUEST;
2180 }
2181
2182 if (depth == DAV_INFINITY && resource->collection) {
2183 dav_dir_conf *conf;
2184 conf = (dav_dir_conf *)ap_get_module_config(r->per_dir_config,
2185 &dav_module);
2186 /* default is to DISALLOW these requests */
2187 if (conf->allow_depthinfinity != DAV_ENABLED_ON) {
2188 return dav_error_response(r, HTTP_FORBIDDEN,
2189 apr_psprintf(r->pool,
2190 "PROPFIND requests with a "
2191 "Depth of \"infinity\" are "
2192 "not allowed for %s.",
2193 ap_escape_html(r->pool,
2194 r->uri)));
2195 }
2196 }
2197
2198 if (doc && !dav_validate_root(doc, "propfind")) {
2199 /* This supplies additional information for the default message. */
2200 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00585)
2201 "The \"propfind\" element was not found.");

Callers 1

dav_handlerFunction · 0.85

Calls 14

dav_get_resourceFunction · 0.85
dav_handle_errFunction · 0.85
ap_xml_parse_inputFunction · 0.85
dav_get_resource_stateFunction · 0.85
dav_get_depthFunction · 0.85
ap_get_module_configFunction · 0.85
dav_error_responseFunction · 0.85
dav_validate_rootFunction · 0.85
dav_find_childFunction · 0.85
dav_open_lockdbFunction · 0.85
dav_push_errorFunction · 0.85
dav_begin_multistatusFunction · 0.85

Tested by

no test coverage detected