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

Function dav_method_vsn_control

modules/dav/main/mod_dav.c:3462–3652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3460}
3461
3462static int dav_method_vsn_control(request_rec *r)
3463{
3464 dav_resource *resource;
3465 int resource_state;
3466 dav_auto_version_info av_info;
3467 const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r);
3468 const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r);
3469 dav_error *err;
3470 apr_xml_doc *doc;
3471 const char *target = NULL;
3472 int result;
3473
3474 /* if no versioning provider, decline the request */
3475 if (vsn_hooks == NULL)
3476 return DECLINED;
3477
3478 /* ask repository module to resolve the resource */
3479 err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */,
3480 &resource);
3481 if (err != NULL)
3482 return dav_handle_err(r, err, NULL);
3483
3484 /* parse the request body (may be a version-control element) */
3485 if ((result = ap_xml_parse_input(r, &doc)) != OK) {
3486 return result;
3487 }
3488 /* note: doc == NULL if no request body */
3489
3490 /* check for any method preconditions */
3491 if (dav_run_method_precondition(r, resource, NULL, doc, &err) != DECLINED
3492 && err) {
3493 return dav_handle_err(r, err, NULL);
3494 }
3495
3496 /* remember the pre-creation resource state */
3497 resource_state = dav_get_resource_state(r, resource);
3498
3499 if (doc != NULL) {
3500 const apr_xml_elem *child;
3501 apr_size_t tsize;
3502
3503 if (!dav_validate_root(doc, "version-control")) {
3504 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00597)
3505 "The request body does not contain "
3506 "a \"version-control\" element.");
3507 return HTTP_BAD_REQUEST;
3508 }
3509
3510 /* get the version URI */
3511 if ((child = dav_find_child(doc->root, "version")) == NULL) {
3512 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00598)
3513 "The \"version-control\" element does not contain "
3514 "a \"version\" element.");
3515 return HTTP_BAD_REQUEST;
3516 }
3517
3518 if ((child = dav_find_child(child, "href")) == NULL) {
3519 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00599)

Callers 1

dav_handlerFunction · 0.85

Calls 15

dav_get_resourceFunction · 0.85
dav_handle_errFunction · 0.85
ap_xml_parse_inputFunction · 0.85
dav_get_resource_stateFunction · 0.85
dav_validate_rootFunction · 0.85
dav_find_childFunction · 0.85
dav_new_errorFunction · 0.85
ap_set_content_lengthFunction · 0.85
dav_validate_requestFunction · 0.85
dav_auto_checkoutFunction · 0.85
dav_auto_checkinFunction · 0.85
dav_push_errorFunction · 0.85

Tested by

no test coverage detected