changeset 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 fb0eff2f3efe
children aa9c0062124d
files CHANGES CHANGES.ru src/core/nginx.h src/http/modules/ngx_http_dav_module.c src/http/modules/perl/nginx.pm src/http/modules/perl/ngx_http_perl_module.c src/http/ngx_http_parse.c
diffstat 7 files changed, 50 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,19 @@
 
+Changes with nginx 0.5.4                                         15 Dec 2006
+
+    *) 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.
+
+
 Changes with nginx 0.5.3                                         13 Dec 2006
 
     *) Feature: the ngx_http_perl_module supports the $r->status, 
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,19 @@
 
+Изменения в nginx 0.5.4                                           15.12.2006
+
+    *) Добавление: директиву perl можно использовать внутри блока 
+       limit_except.
+
+    *) Исправление: модуль ngx_http_dav_module требовал строку "Date" в 
+       заголовке запроса для метода DELETE.
+
+    *) Исправление: при использовании одного параметра в директиве 
+       dav_access nginx мог сообщить об ошибке в конфигурации.
+
+    *) Исправление: при использовании переменной $host мог произойти 
+       segmentation fault; ошибка появилась в 0.4.14.
+
+
 Изменения в nginx 0.5.3                                           13.12.2006
 
     *) Добавление: модуль ngx_http_perl_module поддерживает методы 
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VERSION      "0.5.3"
+#define NGINX_VERSION      "0.5.4"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- 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;
 
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -47,7 +47,7 @@ our @EXPORT = qw(
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.5.3';
+our $VERSION = '0.5.4';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -86,7 +86,7 @@ static ngx_command_t  ngx_http_perl_comm
       NULL },
 
     { ngx_string("perl"),
-      NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+      NGX_HTTP_LOC_CONF|NGX_HTTP_LMT_CONF|NGX_CONF_TAKE1,
       ngx_http_perl,
       NGX_HTTP_LOC_CONF_OFFSET,
       0,
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -290,6 +290,7 @@ ngx_http_parse_request_line(ngx_http_req
                 state = sw_after_slash_in_uri;
                 break;
             default:
+                r->host_end = p;
                 return NGX_HTTP_PARSE_INVALID_REQUEST;
             }
             break;