| 4729 | } |
| 4730 | |
| 4731 | static 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, |
no test coverage detected