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

Function dav_failed_proppatch

modules/dav/main/mod_dav.c:2291–2350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2289}
2290
2291DAV_DECLARE(apr_text *) dav_failed_proppatch(apr_pool_t *p,
2292 apr_array_header_t *prop_ctx)
2293{
2294 apr_text_header hdr = { 0 };
2295 int i = prop_ctx->nelts;
2296 dav_prop_ctx *ctx = (dav_prop_ctx *)prop_ctx->elts;
2297 dav_error *err424_set = NULL;
2298 dav_error *err424_delete = NULL;
2299 const char *s;
2300
2301 /* ### might be nice to sort by status code and description */
2302
2303 for ( ; i-- > 0; ++ctx ) {
2304 apr_text_append(p, &hdr,
2305 "<D:propstat>" DEBUG_CR
2306 "<D:prop>");
2307 apr_text_append(p, &hdr, apr_xml_empty_elem(p, ctx->prop));
2308 apr_text_append(p, &hdr, "</D:prop>" DEBUG_CR);
2309
2310 if (ctx->err == NULL) {
2311 /* nothing was assigned here yet, so make it a 424 */
2312
2313 if (ctx->operation == DAV_PROP_OP_SET) {
2314 if (err424_set == NULL)
2315 err424_set = dav_new_error(p, HTTP_FAILED_DEPENDENCY, 0, 0,
2316 "Attempted DAV:set operation "
2317 "could not be completed due "
2318 "to other errors.");
2319 ctx->err = err424_set;
2320 }
2321 else if (ctx->operation == DAV_PROP_OP_DELETE) {
2322 if (err424_delete == NULL)
2323 err424_delete = dav_new_error(p, HTTP_FAILED_DEPENDENCY, 0, 0,
2324 "Attempted DAV:remove "
2325 "operation could not be "
2326 "completed due to other "
2327 "errors.");
2328 ctx->err = err424_delete;
2329 }
2330 }
2331
2332 s = apr_psprintf(p,
2333 "<D:status>"
2334 "HTTP/1.1 %d (status)"
2335 "</D:status>" DEBUG_CR,
2336 ctx->err->status);
2337 apr_text_append(p, &hdr, s);
2338
2339 /* ### we should use compute_desc if necessary... */
2340 if (ctx->err->desc != NULL) {
2341 apr_text_append(p, &hdr, "<D:responsedescription>" DEBUG_CR);
2342 apr_text_append(p, &hdr, ctx->err->desc);
2343 apr_text_append(p, &hdr, "</D:responsedescription>" DEBUG_CR);
2344 }
2345
2346 apr_text_append(p, &hdr, "</D:propstat>" DEBUG_CR);
2347 }
2348

Callers 2

dav_method_proppatchFunction · 0.85
mod_dav.hFile · 0.85

Calls 1

dav_new_errorFunction · 0.85

Tested by

no test coverage detected