Mercurial > hg > nginx
comparison src/http/modules/ngx_http_dav_module.c @ 921:cba27113c33c
DELETE may not have the "Depth" header
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 14 Dec 2006 22:12:42 +0000 |
parents | da097813ff2e |
children | 7ea5db4c06cb |
comparison
equal
deleted
inserted
replaced
920:da097813ff2e | 921:cba27113c33c |
---|---|
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) { |