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

Function dav_validate_request

modules/dav/main/util.c:1555–1796  ·  view source on GitHub ↗

** dav_validate_request: Validate if-headers (and check for locks) on: ** (1) r->filename @ depth; ** (2) Parent of r->filename if check_parent == 1 ** ** The check of parent should be done when it is necessary to verify that ** the parent collection will accept a new member (ie current resource ** state is null). ** ** Return OK on successful validation. ** On error, return appropriate HTT

Source from the content-addressed store, hash-verified

1553** error is necessary, response will point to it, else NULL.
1554*/
1555DAV_DECLARE(dav_error *) dav_validate_request(request_rec *r,
1556 dav_resource *resource,
1557 int depth,
1558 dav_locktoken *locktoken,
1559 dav_response **response,
1560 int flags,
1561 dav_lockdb *lockdb)
1562{
1563 dav_error *err;
1564 int result;
1565 dav_if_header *if_header;
1566 int lock_db_opened_locally = 0;
1567 const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r);
1568 const dav_hooks_repository *repos_hooks = resource->hooks;
1569 dav_buffer work_buf = { 0 };
1570 dav_response *new_response;
1571 int resource_state;
1572 const char *etag;
1573 int set_etag = 0;
1574
1575#if DAV_DEBUG
1576 if (depth && response == NULL) {
1577 /*
1578 ** ### bleck. we can't return errors for other URIs unless we have
1579 ** ### a "response" ptr.
1580 */
1581 return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
1582 "DESIGN ERROR: dav_validate_request called "
1583 "with depth>0, but no response ptr.");
1584 }
1585#endif
1586
1587 if (response != NULL)
1588 *response = NULL;
1589
1590 /* Set the ETag header required by dav_meets_conditions() */
1591 etag = apr_table_get(r->headers_out, "ETag");
1592 if (!etag) {
1593 etag = (*resource->hooks->getetag)(resource);
1594 if (etag && *etag) {
1595 apr_table_set(r->headers_out, "ETag", etag);
1596 set_etag = 1;
1597 }
1598 }
1599 /* Do the standard checks for conditional requests using
1600 * If-..-Since, If-Match etc */
1601 resource_state = dav_get_resource_state(r, resource);
1602 result = dav_meets_conditions(r, resource_state);
1603 if (set_etag) {
1604 /*
1605 * If we have set an ETag to headers out above for
1606 * dav_meets_conditions() revert this here as we do not want to set
1607 * the ETag in responses to requests with methods where this might not
1608 * be desired.
1609 */
1610 apr_table_unset(r->headers_out, "ETag");
1611 }
1612 if (result != OK) {

Callers 10

dav_method_postFunction · 0.85
dav_method_putFunction · 0.85
dav_method_deleteFunction · 0.85
dav_method_proppatchFunction · 0.85
dav_method_mkcolFunction · 0.85
dav_method_copymoveFunction · 0.85
dav_method_lockFunction · 0.85
dav_method_unlockFunction · 0.85
dav_method_vsn_controlFunction · 0.85
dav_method_bindFunction · 0.85

Calls 5

dav_new_errorFunction · 0.85
dav_get_resource_stateFunction · 0.85
dav_meets_conditionsFunction · 0.85
dav_process_if_headerFunction · 0.85

Tested by

no test coverage detected