Mercurial > hg > nginx
comparison src/http/modules/ngx_http_dav_module.c @ 3501:423ff11e3018
use lstat() for WebDAV DELETE, COPY, and MOVE to handle symlinks
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 22 Apr 2010 17:15:42 +0000 |
parents | 6ddaac3e0bf7 |
children | 84905c7b2aa7 |
comparison
equal
deleted
inserted
replaced
3500:0eb46e3c5c02 | 3501:423ff11e3018 |
---|---|
323 ngx_http_map_uri_to_path(r, &path, &root, 0); | 323 ngx_http_map_uri_to_path(r, &path, &root, 0); |
324 | 324 |
325 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 325 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
326 "http delete filename: \"%s\"", path.data); | 326 "http delete filename: \"%s\"", path.data); |
327 | 327 |
328 if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) { | 328 if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) { |
329 err = ngx_errno; | 329 err = ngx_errno; |
330 | 330 |
331 rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND; | 331 rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND; |
332 | 332 |
333 return ngx_http_dav_error(r->connection->log, err, | 333 return ngx_http_dav_error(r->connection->log, err, |
334 rc, ngx_file_info_n, path.data); | 334 rc, ngx_link_info_n, path.data); |
335 } | 335 } |
336 | 336 |
337 if (ngx_is_dir(&fi)) { | 337 if (ngx_is_dir(&fi)) { |
338 | 338 |
339 if (r->uri.data[r->uri.len - 1] != '/') { | 339 if (r->uri.data[r->uri.len - 1] != '/') { |
356 | 356 |
357 } else { | 357 } else { |
358 | 358 |
359 /* | 359 /* |
360 * we do not need to test (r->uri.data[r->uri.len - 1] == '/') | 360 * we do not need to test (r->uri.data[r->uri.len - 1] == '/') |
361 * because ngx_file_info("/file/") returned NGX_ENOTDIR above | 361 * because ngx_link_info("/file/") returned NGX_ENOTDIR above |
362 */ | 362 */ |
363 | 363 |
364 depth = ngx_http_dav_depth(r, 0); | 364 depth = ngx_http_dav_depth(r, 0); |
365 | 365 |
366 if (depth != 0 && depth != NGX_HTTP_DAV_INFINITY_DEPTH) { | 366 if (depth != 0 && depth != NGX_HTTP_DAV_INFINITY_DEPTH) { |
683 } | 683 } |
684 | 684 |
685 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 685 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
686 "http copy to: \"%s\"", copy.path.data); | 686 "http copy to: \"%s\"", copy.path.data); |
687 | 687 |
688 if (ngx_file_info(copy.path.data, &fi) == NGX_FILE_ERROR) { | 688 if (ngx_link_info(copy.path.data, &fi) == NGX_FILE_ERROR) { |
689 err = ngx_errno; | 689 err = ngx_errno; |
690 | 690 |
691 if (err != NGX_ENOENT) { | 691 if (err != NGX_ENOENT) { |
692 return ngx_http_dav_error(r->connection->log, err, | 692 return ngx_http_dav_error(r->connection->log, err, |
693 NGX_HTTP_NOT_FOUND, ngx_file_info_n, | 693 NGX_HTTP_NOT_FOUND, ngx_link_info_n, |
694 copy.path.data); | 694 copy.path.data); |
695 } | 695 } |
696 | 696 |
697 /* destination does not exist */ | 697 /* destination does not exist */ |
698 | 698 |
717 } | 717 } |
718 | 718 |
719 dir = ngx_is_dir(&fi); | 719 dir = ngx_is_dir(&fi); |
720 } | 720 } |
721 | 721 |
722 if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) { | 722 if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) { |
723 return ngx_http_dav_error(r->connection->log, ngx_errno, | 723 return ngx_http_dav_error(r->connection->log, ngx_errno, |
724 NGX_HTTP_NOT_FOUND, ngx_file_info_n, | 724 NGX_HTTP_NOT_FOUND, ngx_link_info_n, |
725 path.data); | 725 path.data); |
726 } | 726 } |
727 | 727 |
728 if (ngx_is_dir(&fi)) { | 728 if (ngx_is_dir(&fi)) { |
729 | 729 |