diff 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
line wrap: on
line diff
--- a/src/http/modules/ngx_http_dav_module.c
+++ b/src/http/modules/ngx_http_dav_module.c
@@ -106,6 +106,7 @@ ngx_http_dav_handler(ngx_http_request_t 
     ngx_int_t                 rc;
     ngx_str_t                 path;
     ngx_file_info_t           fi;
+    ngx_table_elt_t          *depth;
     ngx_http_dav_loc_conf_t  *dlcf;
 
     /* TODO: Win32 */
@@ -162,11 +163,15 @@ ngx_http_dav_handler(ngx_http_request_t 
 
             if (ngx_is_dir(&fi)) {
 
-                if (r->uri.data[r->uri.len - 1] != '/'
-                    || r->headers_in.depth == NULL
-                    || r->headers_in.depth->value.len != sizeof("infinity") - 1
-                    || ngx_strcmp(r->headers_in.depth->value.data, "infinity")
-                       != 0)
+                if (r->uri.data[r->uri.len - 1] != '/') {
+                    return NGX_HTTP_BAD_REQUEST;
+                }
+
+                depth = r->headers_in.depth;
+
+                if (depth
+                    && (depth->value.len != sizeof("infinity") - 1
+                        || ngx_strcmp(depth->value.data, "infinity") != 0))
                 {
                     return NGX_HTTP_BAD_REQUEST;
                 }
@@ -183,9 +188,11 @@ ngx_http_dav_handler(ngx_http_request_t 
                     return NGX_HTTP_BAD_REQUEST;
                 }
 
-                if (r->headers_in.depth
-                    && r->headers_in.depth->value.len == 1
-                    && r->headers_in.depth->value.data[0] == '1')
+                depth = r->headers_in.depth;
+
+                if (depth
+                    && depth->value.len == 1
+                    && depth->value.data[0] == '1')
                 {
                     return NGX_HTTP_BAD_REQUEST;
                 }
@@ -476,7 +483,7 @@ ngx_http_dav_access(ngx_conf_t *cf, ngx_
 
     lcf->access = 0700;
 
-    for (i = 1; i < 3; i++) {
+    for (i = 1; i < cf->args->nelts; i++) {
 
         p = value[i].data;