comparison src/http/modules/ngx_http_dav_module.c @ 268:a0c9f21ee120 NGINX_0_5_4

nginx 0.5.4 *) Feature: the "perl" directive may be used inside the "limit_except" block. *) Bugfix: the ngx_http_dav_module required the "Date" request header line for the DELETE method. *) Bugfix: if one only parameter was used in the "dav_access" directive, then nginx might report about configuration error. *) Bugfix: a segmentation fault might occur if the $host variable was used; bug appeared in 0.4.14.
author Igor Sysoev <http://sysoev.ru>
date Fri, 15 Dec 2006 00:00:00 +0300
parents acd2ec3541cb
children 29a6403156b0
comparison
equal deleted inserted replaced
267:fb0eff2f3efe 268:a0c9f21ee120
104 char *failed; 104 char *failed;
105 size_t root; 105 size_t root;
106 ngx_int_t rc; 106 ngx_int_t rc;
107 ngx_str_t path; 107 ngx_str_t path;
108 ngx_file_info_t fi; 108 ngx_file_info_t fi;
109 ngx_table_elt_t *depth;
109 ngx_http_dav_loc_conf_t *dlcf; 110 ngx_http_dav_loc_conf_t *dlcf;
110 111
111 /* TODO: Win32 */ 112 /* TODO: Win32 */
112 if (r->zero_in_uri) { 113 if (r->zero_in_uri) {
113 return NGX_DECLINED; 114 return NGX_DECLINED;
160 161
161 if (ngx_file_info(path.data, &fi) != -1) { 162 if (ngx_file_info(path.data, &fi) != -1) {
162 163
163 if (ngx_is_dir(&fi)) { 164 if (ngx_is_dir(&fi)) {
164 165
165 if (r->uri.data[r->uri.len - 1] != '/' 166 if (r->uri.data[r->uri.len - 1] != '/') {
166 || r->headers_in.depth == NULL 167 return NGX_HTTP_BAD_REQUEST;
167 || r->headers_in.depth->value.len != sizeof("infinity") - 1 168 }
168 || ngx_strcmp(r->headers_in.depth->value.data, "infinity") 169
169 != 0) 170 depth = r->headers_in.depth;
171
172 if (depth
173 && (depth->value.len != sizeof("infinity") - 1
174 || ngx_strcmp(depth->value.data, "infinity") != 0))
170 { 175 {
171 return NGX_HTTP_BAD_REQUEST; 176 return NGX_HTTP_BAD_REQUEST;
172 } 177 }
173 178
174 if (ngx_delete_dir(path.data) != NGX_FILE_ERROR) { 179 if (ngx_delete_dir(path.data) != NGX_FILE_ERROR) {
181 186
182 if (r->uri.data[r->uri.len - 1] == '/') { 187 if (r->uri.data[r->uri.len - 1] == '/') {
183 return NGX_HTTP_BAD_REQUEST; 188 return NGX_HTTP_BAD_REQUEST;
184 } 189 }
185 190
186 if (r->headers_in.depth 191 depth = r->headers_in.depth;
187 && r->headers_in.depth->value.len == 1 192
188 && r->headers_in.depth->value.data[0] == '1') 193 if (depth
194 && depth->value.len == 1
195 && depth->value.data[0] == '1')
189 { 196 {
190 return NGX_HTTP_BAD_REQUEST; 197 return NGX_HTTP_BAD_REQUEST;
191 } 198 }
192 199
193 if (ngx_delete_file(path.data) != NGX_FILE_ERROR) { 200 if (ngx_delete_file(path.data) != NGX_FILE_ERROR) {
474 481
475 value = cf->args->elts; 482 value = cf->args->elts;
476 483
477 lcf->access = 0700; 484 lcf->access = 0700;
478 485
479 for (i = 1; i < 3; i++) { 486 for (i = 1; i < cf->args->nelts; i++) {
480 487
481 p = value[i].data; 488 p = value[i].data;
482 489
483 if (ngx_strncmp(p, "user:", sizeof("user:") - 1) == 0) { 490 if (ngx_strncmp(p, "user:", sizeof("user:") - 1) == 0) {
484 shift = 6; 491 shift = 6;