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

Function dav_method_bind

modules/dav/main/mod_dav.c:4731–4934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4729}
4730
4731static int dav_method_bind(request_rec *r)
4732{
4733 dav_resource *resource;
4734 dav_resource *binding;
4735 dav_auto_version_info av_info;
4736 const dav_hooks_binding *binding_hooks = DAV_GET_HOOKS_BINDING(r);
4737 const char *dest;
4738 dav_error *err;
4739 dav_error *err2;
4740 dav_response *multi_response = NULL;
4741 dav_lookup_result lookup;
4742 int overwrite;
4743
4744 /* If no bindings provider, decline the request */
4745 if (binding_hooks == NULL)
4746 return DECLINED;
4747
4748 /* Ask repository module to resolve the resource */
4749 err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */,
4750 &resource);
4751 if (err != NULL)
4752 return dav_handle_err(r, err, NULL);
4753
4754 /* check for any method preconditions */
4755 if (dav_run_method_precondition(r, resource, NULL, NULL, &err) != DECLINED
4756 && err) {
4757 return dav_handle_err(r, err, NULL);
4758 }
4759
4760 if (!resource->exists) {
4761 /* Apache will supply a default error for this. */
4762 return HTTP_NOT_FOUND;
4763 }
4764
4765 /* get the destination URI */
4766 dest = apr_table_get(r->headers_in, "Destination");
4767 if (dest == NULL) {
4768 /* This supplies additional information for the default message. */
4769 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00620)
4770 "The request is missing a Destination header.");
4771 return HTTP_BAD_REQUEST;
4772 }
4773
4774 lookup = dav_lookup_uri(dest, r, 0 /* must_be_absolute */);
4775 if (lookup.rnew == NULL) {
4776 if (lookup.err.status == HTTP_BAD_REQUEST) {
4777 /* This supplies additional information for the default message. */
4778 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00621)
4779 "%s", lookup.err.desc);
4780 return HTTP_BAD_REQUEST;
4781 }
4782 else if (lookup.err.status == HTTP_BAD_GATEWAY) {
4783 /* ### Bindings protocol draft 02 says to return 507
4784 * ### (Cross Server Binding Forbidden); Apache already defines 507
4785 * ### as HTTP_INSUFFICIENT_STORAGE. So, for now, we'll return
4786 * ### HTTP_FORBIDDEN
4787 */
4788 return dav_error_response(r, HTTP_FORBIDDEN,

Callers 1

dav_handlerFunction · 0.85

Calls 11

dav_get_resourceFunction · 0.85
dav_handle_errFunction · 0.85
dav_lookup_uriFunction · 0.85
dav_error_responseFunction · 0.85
dav_get_overwriteFunction · 0.85
dav_validate_requestFunction · 0.85
dav_push_errorFunction · 0.85
dav_auto_checkoutFunction · 0.85
dav_auto_checkinFunction · 0.85
dav_log_errFunction · 0.85
dav_createdFunction · 0.85

Tested by

no test coverage detected