handle the CHECKOUT method */
| 3653 | |
| 3654 | /* handle the CHECKOUT method */ |
| 3655 | static int dav_method_checkout(request_rec *r) |
| 3656 | { |
| 3657 | dav_resource *resource; |
| 3658 | dav_resource *working_resource; |
| 3659 | const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); |
| 3660 | dav_error *err; |
| 3661 | int result; |
| 3662 | apr_xml_doc *doc; |
| 3663 | int apply_to_vsn = 0; |
| 3664 | int is_unreserved = 0; |
| 3665 | int is_fork_ok = 0; |
| 3666 | int create_activity = 0; |
| 3667 | apr_array_header_t *activities = NULL; |
| 3668 | |
| 3669 | /* If no versioning provider, decline the request */ |
| 3670 | if (vsn_hooks == NULL) |
| 3671 | return DECLINED; |
| 3672 | |
| 3673 | if ((result = ap_xml_parse_input(r, &doc)) != OK) |
| 3674 | return result; |
| 3675 | |
| 3676 | if (doc != NULL) { |
| 3677 | const apr_xml_elem *aset; |
| 3678 | |
| 3679 | if (!dav_validate_root(doc, "checkout")) { |
| 3680 | /* This supplies additional information for the default msg. */ |
| 3681 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00601) |
| 3682 | "The request body, if present, must be a " |
| 3683 | "DAV:checkout element."); |
| 3684 | return HTTP_BAD_REQUEST; |
| 3685 | } |
| 3686 | |
| 3687 | if (dav_find_child(doc->root, "apply-to-version") != NULL) { |
| 3688 | if (apr_table_get(r->headers_in, "label") != NULL) { |
| 3689 | /* ### we want generic 403/409 XML reporting here */ |
| 3690 | /* ### DAV:must-not-have-label-and-apply-to-version */ |
| 3691 | return dav_error_response(r, HTTP_CONFLICT, |
| 3692 | "DAV:apply-to-version cannot be " |
| 3693 | "used in conjunction with a " |
| 3694 | "Label header."); |
| 3695 | } |
| 3696 | apply_to_vsn = 1; |
| 3697 | } |
| 3698 | |
| 3699 | is_unreserved = dav_find_child(doc->root, "unreserved") != NULL; |
| 3700 | is_fork_ok = dav_find_child(doc->root, "fork-ok") != NULL; |
| 3701 | |
| 3702 | if ((aset = dav_find_child(doc->root, "activity-set")) != NULL) { |
| 3703 | if (dav_find_child(aset, "new") != NULL) { |
| 3704 | create_activity = 1; |
| 3705 | } |
| 3706 | else { |
| 3707 | const apr_xml_elem *child = aset->first_child; |
| 3708 | |
| 3709 | activities = apr_array_make(r->pool, 1, sizeof(const char *)); |
| 3710 | |
| 3711 | for (; child != NULL; child = child->next) { |
| 3712 | if (child->ns == APR_XML_NS_DAV_ID |
no test coverage detected