Mercurial > hg > nginx
comparison src/http/modules/ngx_http_dav_module.c @ 1822:935427c55e04
test URI/Destination collection/non-collection and Depth
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 03 Jan 2008 20:09:51 +0000 |
parents | 252110065e0a |
children | 5ae4cace0727 |
comparison
equal
deleted
inserted
replaced
1821:252110065e0a | 1822:935427c55e04 |
---|---|
629 | 629 |
630 len = r->headers_in.host_name_len; | 630 len = r->headers_in.host_name_len; |
631 | 631 |
632 if (ngx_strncmp(desthost, host->value.data, len) != 0) { | 632 if (ngx_strncmp(desthost, host->value.data, len) != 0) { |
633 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 633 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
634 "Destination URI \"%V\" is handled by " | 634 "\"Destination\" URI \"%V\" is handled by " |
635 "different repository than the source URI", | 635 "different repository than the source URI", |
636 &dest->value); | 636 &dest->value); |
637 return NGX_HTTP_BAD_REQUEST; | 637 return NGX_HTTP_BAD_REQUEST; |
638 } | 638 } |
639 | 639 |
652 &dest->value); | 652 &dest->value); |
653 return NGX_HTTP_BAD_REQUEST; | 653 return NGX_HTTP_BAD_REQUEST; |
654 | 654 |
655 destination_done: | 655 destination_done: |
656 | 656 |
657 depth = ngx_http_dav_depth(r, 0); | 657 if ((r->uri.data[r->uri.len - 1] == '/' && *(last - 1) != '/') |
658 | 658 || (r->uri.data[r->uri.len - 1] != '/' && *(last - 1) == '/')) |
659 if (depth != 0 && depth != NGX_HTTP_DAV_INFINITY_DEPTH) { | 659 { |
660 return NGX_HTTP_BAD_REQUEST; | 660 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
661 "both URI \"%V\" and \"Destination\" URI \"%V\" " | |
662 "should be either collections or non-collections", | |
663 &r->uri, &dest->value); | |
664 return NGX_HTTP_CONFLICT; | |
665 } | |
666 | |
667 depth = ngx_http_dav_depth(r, NGX_HTTP_DAV_INFINITY_DEPTH); | |
668 | |
669 if (depth != NGX_HTTP_DAV_INFINITY_DEPTH) { | |
670 | |
671 if (r->method == NGX_HTTP_COPY) { | |
672 if (depth != 0) { | |
673 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
674 "\"Depth\" header must be 0 or infinity"); | |
675 return NGX_HTTP_BAD_REQUEST; | |
676 } | |
677 | |
678 } else { | |
679 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
680 "\"Depth\" header must be infinity"); | |
681 return NGX_HTTP_BAD_REQUEST; | |
682 } | |
661 } | 683 } |
662 | 684 |
663 over = r->headers_in.overwrite; | 685 over = r->headers_in.overwrite; |
664 | 686 |
665 if (over) { | 687 if (over) { |