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

Function dav_created

modules/dav/main/mod_dav.c:680–708  ·  view source on GitHub ↗

handy function for return values of methods that (may) create things. * locn if provided is assumed to be escaped. */

Source from the content-addressed store, hash-verified

678/* handy function for return values of methods that (may) create things.
679 * locn if provided is assumed to be escaped. */
680static int dav_created(request_rec *r, const char *locn, const char *what,
681 int replaced)
682{
683 const char *body;
684
685 if (locn == NULL) {
686 locn = ap_escape_uri(r->pool, r->uri);
687 }
688
689 /* did the target resource already exist? */
690 if (replaced) {
691 /* Apache will supply a default message */
692 return HTTP_NO_CONTENT;
693 }
694
695 /* Per HTTP/1.1, S10.2.2: add a Location header to contain the
696 * URI that was created. */
697
698 /* Convert locn to an absolute URI, and return in Location header */
699 apr_table_setn(r->headers_out, "Location", ap_construct_url(r->pool, locn, r));
700
701 /* ### insert an ETag header? see HTTP/1.1 S10.2.2 */
702
703 /* Apache doesn't allow us to set a variable body for HTTP_CREATED, so
704 * we must manufacture the entire response. */
705 body = apr_pstrcat(r->pool, what, " ", ap_escape_html(r->pool, locn),
706 " has been created.", NULL);
707 return dav_error_response(r, HTTP_CREATED, body);
708}
709
710/* ### move to dav_util? */
711DAV_DECLARE(int) dav_get_depth(request_rec *r, int def_depth)

Callers 9

dav_method_putFunction · 0.85
dav_method_mkcolFunction · 0.85
dav_method_copymoveFunction · 0.85
dav_method_vsn_controlFunction · 0.85
dav_method_checkoutFunction · 0.85
dav_method_checkinFunction · 0.85
dav_method_make_activityFunction · 0.85
dav_method_bindFunction · 0.85

Calls 2

ap_construct_urlFunction · 0.85
dav_error_responseFunction · 0.85

Tested by

no test coverage detected