MCPcopy Index your code
hub / github.com/apache/httpd / dav_method_update

Function dav_method_update

modules/dav/main/mod_dav.c:3953–4107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3951}
3952
3953static int dav_method_update(request_rec *r)
3954{
3955 dav_resource *resource;
3956 dav_resource *version = NULL;
3957 const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r);
3958 apr_xml_doc *doc;
3959 apr_xml_elem *child;
3960 int is_label = 0;
3961 int depth;
3962 int result;
3963 apr_size_t tsize;
3964 const char *target;
3965 dav_response *multi_response;
3966 dav_error *err;
3967 dav_lookup_result lookup;
3968
3969 /* If no versioning provider, or UPDATE not supported,
3970 * decline the request */
3971 if (vsn_hooks == NULL || vsn_hooks->update == NULL)
3972 return DECLINED;
3973
3974 if ((depth = dav_get_depth(r, 0)) < 0) {
3975 /* dav_get_depth() supplies additional information for the
3976 * default message. */
3977 return HTTP_BAD_REQUEST;
3978 }
3979
3980 /* parse the request body */
3981 if ((result = ap_xml_parse_input(r, &doc)) != OK) {
3982 return result;
3983 }
3984
3985 if (doc == NULL || !dav_validate_root(doc, "update")) {
3986 /* This supplies additional information for the default message. */
3987 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00604)
3988 "The request body does not contain "
3989 "an \"update\" element.");
3990 return HTTP_BAD_REQUEST;
3991 }
3992
3993 /* check for label-name or version element, but not both */
3994 if ((child = dav_find_child(doc->root, "label-name")) != NULL)
3995 is_label = 1;
3996 else if ((child = dav_find_child(doc->root, "version")) != NULL) {
3997 /* get the href element */
3998 if ((child = dav_find_child(child, "href")) == NULL) {
3999 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00605)
4000 "The version element does not contain "
4001 "an \"href\" element.");
4002 return HTTP_BAD_REQUEST;
4003 }
4004 }
4005 else {
4006 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00606)
4007 "The \"update\" element does not contain "
4008 "a \"label-name\" or \"version\" element.");
4009 return HTTP_BAD_REQUEST;
4010 }

Callers 1

dav_handlerFunction · 0.85

Calls 10

dav_get_depthFunction · 0.85
ap_xml_parse_inputFunction · 0.85
dav_validate_rootFunction · 0.85
dav_find_childFunction · 0.85
dav_get_resourceFunction · 0.85
dav_handle_errFunction · 0.85
dav_error_responseFunction · 0.85
dav_lookup_uriFunction · 0.85
dav_push_errorFunction · 0.85
ap_set_content_lengthFunction · 0.85

Tested by

no test coverage detected