comparison src/http/modules/ngx_http_dav_module.c @ 2782:4bd7825fab80

uniform ngx_file_info() interface with ngx_fd_info()
author Igor Sysoev <igor@sysoev.ru>
date Wed, 29 Apr 2009 19:28:52 +0000
parents 8e720b7fe6d2
children c7d57b539248
comparison
equal deleted inserted replaced
2781:f545c81e5ddb 2782:4bd7825fab80
219 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 219 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
220 "http put filename: \"%s\"", path.data); 220 "http put filename: \"%s\"", path.data);
221 221
222 temp = &r->request_body->temp_file->file.name; 222 temp = &r->request_body->temp_file->file.name;
223 223
224 if (ngx_file_info(path.data, &fi) == -1) { 224 if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
225 status = NGX_HTTP_CREATED; 225 status = NGX_HTTP_CREATED;
226 226
227 } else { 227 } else {
228 status = NGX_HTTP_NO_CONTENT; 228 status = NGX_HTTP_NO_CONTENT;
229 229
324 ngx_http_map_uri_to_path(r, &path, &root, 0); 324 ngx_http_map_uri_to_path(r, &path, &root, 0);
325 325
326 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 326 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
327 "http delete filename: \"%s\"", path.data); 327 "http delete filename: \"%s\"", path.data);
328 328
329 if (ngx_file_info(path.data, &fi) == -1) { 329 if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
330 err = ngx_errno; 330 err = ngx_errno;
331 331
332 rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND; 332 rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND;
333 333
334 return ngx_http_dav_error(r->connection->log, err, 334 return ngx_http_dav_error(r->connection->log, err,
676 } 676 }
677 677
678 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 678 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
679 "http copy to: \"%s\"", copy.path.data); 679 "http copy to: \"%s\"", copy.path.data);
680 680
681 if (ngx_file_info(copy.path.data, &fi) == -1) { 681 if (ngx_file_info(copy.path.data, &fi) == NGX_FILE_ERROR) {
682 err = ngx_errno; 682 err = ngx_errno;
683 683
684 if (err != NGX_ENOENT) { 684 if (err != NGX_ENOENT) {
685 return ngx_http_dav_error(r->connection->log, err, 685 return ngx_http_dav_error(r->connection->log, err,
686 NGX_HTTP_NOT_FOUND, ngx_file_info_n, 686 NGX_HTTP_NOT_FOUND, ngx_file_info_n,
710 } 710 }
711 711
712 dir = ngx_is_dir(&fi); 712 dir = ngx_is_dir(&fi);
713 } 713 }
714 714
715 if (ngx_file_info(path.data, &fi) == -1) { 715 if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
716 return ngx_http_dav_error(r->connection->log, ngx_errno, 716 return ngx_http_dav_error(r->connection->log, ngx_errno,
717 NGX_HTTP_NOT_FOUND, ngx_file_info_n, 717 NGX_HTTP_NOT_FOUND, ngx_file_info_n,
718 path.data); 718 path.data);
719 } 719 }
720 720