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

Function dav_method_uncheckout

modules/dav/main/mod_dav.c:3804–3870  ·  view source on GitHub ↗

handle the UNCHECKOUT method */

Source from the content-addressed store, hash-verified

3802
3803/* handle the UNCHECKOUT method */
3804static int dav_method_uncheckout(request_rec *r)
3805{
3806 dav_resource *resource;
3807 const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r);
3808 dav_error *err;
3809 int result;
3810
3811 /* If no versioning provider, decline the request */
3812 if (vsn_hooks == NULL)
3813 return DECLINED;
3814
3815 if ((result = ap_discard_request_body(r)) != OK) {
3816 return result;
3817 }
3818
3819 /* Ask repository module to resolve the resource */
3820 err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */,
3821 &resource);
3822 if (err != NULL)
3823 return dav_handle_err(r, err, NULL);
3824
3825 /* check for any method preconditions */
3826 if (dav_run_method_precondition(r, resource, NULL, NULL, &err) != DECLINED
3827 && err) {
3828 return dav_handle_err(r, err, NULL);
3829 }
3830
3831 if (!resource->exists) {
3832 /* Apache will supply a default error for this. */
3833 return HTTP_NOT_FOUND;
3834 }
3835
3836 /* Check the state of the resource: must be a file or collection,
3837 * must be versioned, and must be checked out.
3838 */
3839 if (resource->type != DAV_RESOURCE_TYPE_REGULAR) {
3840 return dav_error_response(r, HTTP_CONFLICT,
3841 "Cannot uncheckout this type of resource.");
3842 }
3843
3844 if (!resource->versioned) {
3845 return dav_error_response(r, HTTP_CONFLICT,
3846 "Cannot uncheckout unversioned resource.");
3847 }
3848
3849 if (!resource->working) {
3850 return dav_error_response(r, HTTP_CONFLICT,
3851 "The resource is not checked out to the workspace.");
3852 }
3853
3854 /* ### do lock checks, once behavior is defined */
3855
3856 /* Do the uncheckout */
3857 if ((err = (*vsn_hooks->uncheckout)(resource)) != NULL) {
3858 err = dav_push_error(r->pool, HTTP_CONFLICT, 0,
3859 apr_psprintf(r->pool,
3860 "Could not UNCHECKOUT resource %s.",
3861 ap_escape_html(r->pool, r->uri)),

Callers 1

dav_handlerFunction · 0.85

Calls 6

ap_discard_request_bodyFunction · 0.85
dav_get_resourceFunction · 0.85
dav_handle_errFunction · 0.85
dav_error_responseFunction · 0.85
dav_push_errorFunction · 0.85
ap_set_content_lengthFunction · 0.85

Tested by

no test coverage detected