13 #define NGX_HTTP_DAV_COPY_BLOCK 65536
15 #define NGX_HTTP_DAV_OFF 2
18 #define NGX_HTTP_DAV_NO_DEPTH -3
19 #define NGX_HTTP_DAV_INVALID_DEPTH -2
20 #define NGX_HTTP_DAV_INFINITY_DEPTH -1
60 ngx_int_t not_found,
char *failed, u_char *path);
62 static void *ngx_http_dav_create_loc_conf(
ngx_conf_t *cf);
63 static char *ngx_http_dav_merge_loc_conf(
ngx_conf_t *cf,
64 void *parent,
void *child);
86 &ngx_http_dav_methods_mask },
123 ngx_http_dav_create_loc_conf,
124 ngx_http_dav_merge_loc_conf
130 &ngx_http_dav_module_ctx,
131 ngx_http_dav_commands,
162 "cannot PUT to a collection");
182 return ngx_http_dav_delete_handler(r);
186 return ngx_http_dav_mkcol_handler(r, dlcf);
190 return ngx_http_dav_copy_move_handler(r);
194 return ngx_http_dav_copy_move_handler(r);
222 "http put filename: \"%s\"", path.
data);
234 "\"%s\" could not be created", path.
data);
272 if (ngx_http_dav_location(r, path.
data) !=
NGX_OK) {
301 "DELETE with body is unsupported");
310 for (i = 0; i < r->
uri.
len; ) {
319 "insufficient URI depth:%i to DELETE", d);
328 "http delete filename: \"%s\"", path.
data);
343 "DELETE \"%s\" failed", path.
data);
351 "\"Depth\" header must be infinity");
366 depth = ngx_http_dav_depth(r, 0);
370 "\"Depth\" header must be 0 or infinity");
377 rc = ngx_http_dav_delete_path(r, &path, dir);
434 "http delete dir: \"%s\"", path->
data);
452 "http delete file: \"%s\"", path->
data);
482 "MKCOL with body is unsupported");
488 "MKCOL can create a collection only");
498 "http mkcol path: \"%s\"", path.
data);
503 if (ngx_http_dav_location(r, path.
data) !=
NGX_OK) {
518 u_char *p, *host, *last, ch;
540 "client sent no \"Destination\" header");
548 goto destination_done;
555 "client sent no \"Host\" header");
565 goto invalid_destination;
568 host = dest->
value.
data +
sizeof(
"https://") - 1;
576 goto invalid_destination;
579 host = dest->
value.
data +
sizeof(
"http://") - 1;
584 "\"Destination\" URI \"%V\" is handled by "
585 "different repository than the source URI",
592 for (p = host + len; p < last; p++) {
594 goto destination_done;
601 "client sent invalid \"Destination\" header: \"%V\"",
612 goto invalid_destination;
615 if ((r->
uri.
data[r->
uri.
len - 1] ==
'/' && *(last - 1) !=
'/')
616 || (r->
uri.
data[r->
uri.
len - 1] !=
'/' && *(last - 1) ==
'/'))
619 "both URI \"%V\" and \"Destination\" URI \"%V\" "
620 "should be either collections or non-collections",
632 "\"Depth\" header must be 0 or infinity");
638 "\"Depth\" header must be infinity");
649 if (ch ==
'T' || ch ==
't') {
654 if (ch ==
'F' || ch ==
'f') {
662 "client sent invalid \"Overwrite\" header: \"%V\"",
674 "http copy from: \"%s\"", path.
data);
695 "http copy to: \"%s\"", copy.
path.
data);
717 "\"%V\" could not be %Ved to collection \"%V\"",
724 "\"%s\" could not be created", copy.
path.
data);
741 "\"%V\" is collection", &r->
uri);
747 "http delete: \"%s\"", copy.
path.
data);
749 rc = ngx_http_dav_delete_path(r, ©.
path, dir);
789 rc = ngx_http_dav_delete_path(r, &path, 1);
844 "http copy dir: \"%s\"", path->
data);
859 "http copy dir to: \"%s\"", dir);
880 "http copy dir time: \"%s\"", path->
data);
895 "http copy dir time to: \"%s\"", dir);
945 "http copy file: \"%s\"", path->
data);
960 "http copy file to: \"%s\"", file);
999 if (depth->
value.
len ==
sizeof(
"infinity") - 1
1007 "client sent invalid \"Depth\" header: \"%V\"",
1016 char *failed, u_char *path)
1042 ngx_log_error(level, log, err,
"%s \"%s\" failed", failed, path);
1062 location = path + clcf->
root.
len;
1066 if (location == NULL) {
1110 ngx_http_dav_merge_loc_conf(
ngx_conf_t *cf,
void *parent,
void *child)
1143 *h = ngx_http_dav_handler;