comparison src/http/modules/ngx_http_dav_module.c @ 439:dac47e9ef0d5 NGINX_0_7_27

nginx 0.7.27 *) Feature: the "try_files" directive. *) Feature: variables support in the "fastcgi_pass" directive. *) Feature: now the $geo variable may get an address from a variable. Thanks to Andrei Nigmatulin. *) Feature: now a location's modifier may be used without space before name. *) Feature: the $upstream_response_length variable. *) Bugfix: now a "add_header" directive does not add an empty value. *) Bugfix: if zero length static file was requested, then nginx just closed connection; the bug had appeared in 0.7.25. *) Bugfix: a MOVE method could not move file in non-existent directory. *) Bugfix: a segmentation fault occurred in worker process, if no one named location was defined in server, but some one was used in an error_page directive. Thanks to Sergey Bochenkov.
author Igor Sysoev <http://sysoev.ru>
date Mon, 15 Dec 2008 00:00:00 +0300
parents 984bb0b1399b
children 549994537f15
comparison
equal deleted inserted replaced
438:3b8e9d1bc9bb 439:dac47e9ef0d5
244 } 244 }
245 245
246 dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module); 246 dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
247 247
248 ext.access = dlcf->access; 248 ext.access = dlcf->access;
249 ext.path_access = dlcf->access;
249 ext.time = -1; 250 ext.time = -1;
250 ext.create_path = dlcf->create_full_put_path; 251 ext.create_path = dlcf->create_full_put_path;
251 ext.delete_file = 1; 252 ext.delete_file = 1;
253 ext.log_rename_error = 1;
252 ext.log = r->connection->log; 254 ext.log = r->connection->log;
253 255
254 if (r->headers_in.date) { 256 if (r->headers_in.date) {
255 date = ngx_http_parse_time(r->headers_in.date->value.data, 257 date = ngx_http_parse_time(r->headers_in.date->value.data,
256 r->headers_in.date->value.len); 258 r->headers_in.date->value.len);
519 ngx_uint_t overwrite, slash, dir; 521 ngx_uint_t overwrite, slash, dir;
520 ngx_str_t path, uri; 522 ngx_str_t path, uri;
521 ngx_tree_ctx_t tree; 523 ngx_tree_ctx_t tree;
522 ngx_file_info_t fi; 524 ngx_file_info_t fi;
523 ngx_table_elt_t *dest, *over; 525 ngx_table_elt_t *dest, *over;
526 ngx_ext_rename_file_t ext;
524 ngx_http_dav_copy_ctx_t copy; 527 ngx_http_dav_copy_ctx_t copy;
525 ngx_http_dav_loc_conf_t *dlcf; 528 ngx_http_dav_loc_conf_t *dlcf;
526 529
527 if (r->headers_in.content_length_n > 0) { 530 if (r->headers_in.content_length_n > 0) {
528 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE; 531 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
779 } 782 }
780 783
781 } else { 784 } else {
782 785
783 if (r->method == NGX_HTTP_MOVE) { 786 if (r->method == NGX_HTTP_MOVE) {
784 if (ngx_rename_file(path.data, copy.path.data) != NGX_FILE_ERROR) { 787
788 dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
789
790 ext.access = 0;
791 ext.path_access = dlcf->access;
792 ext.time = -1;
793 ext.create_path = 1;
794 ext.delete_file = 0;
795 ext.log_rename_error = 0;
796 ext.log = r->connection->log;
797
798 if (ngx_ext_rename_file(&path, &copy.path, &ext) == NGX_OK) {
785 return NGX_HTTP_NO_CONTENT; 799 return NGX_HTTP_NO_CONTENT;
800 }
801
802 if (ext.rename_error != NGX_EXDEV) {
803
804 if (ext.rename_error) {
805 ngx_log_error(NGX_LOG_CRIT, r->connection->log,
806 ext.rename_error,
807 ngx_rename_file_n " \"%s\" to \"%s\" failed",
808 path.data, copy.path.data);
809 }
810
811 return NGX_HTTP_INTERNAL_SERVER_ERROR;
786 } 812 }
787 } 813 }
788 814
789 dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module); 815 dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
790 816