changeset 568:566e105a89f1 NGINX_0_8_36

nginx 0.8.36 *) Bugfix: the ngx_http_dav_module handled incorrectly the DELETE, COPY, and MOVE methods for symlinks. *) Bugfix: values of the $query_string, $arg_..., etc. variables cached in main request were used by the SSI module in subrequests. *) Bugfix: a variable value was repeatedly encoded after each an "echo" SSI-command output; the bug had appeared in 0.6.14. *) Bugfix: a worker process hung if a FIFO file was requested. Thanks to Vicente Aguilar and Maxim Dounin. *) Bugfix: OpenSSL-1.0.0 compatibility on 64-bit Linux. Thanks to Maxim Dounin. *) Bugfix: nginx could not be built --without-http-cache; the bug had appeared in 0.8.35.
author Igor Sysoev <http://sysoev.ru>
date Thu, 22 Apr 2010 00:00:00 +0400
parents a49f5d0aff01
children 19b134bf21c0
files CHANGES CHANGES.ru auto/lib/openssl/make src/core/nginx.h src/core/ngx_open_file_cache.c src/http/modules/ngx_http_dav_module.c src/http/modules/ngx_http_fastcgi_module.c src/http/modules/ngx_http_gzip_static_module.c src/http/modules/ngx_http_ssi_filter_module.c src/http/modules/ngx_http_static_module.c src/http/modules/perl/nginx.pm src/http/modules/perl/nginx.xs src/http/ngx_http_variables.c src/http/ngx_http_variables.h src/os/unix/ngx_files.h
diffstat 15 files changed, 91 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Mon Mar 29 00:00:00 2010 +0400
+++ b/CHANGES	Thu Apr 22 00:00:00 2010 +0400
@@ -1,5 +1,26 @@
 
-Changes with nginx 0.8.35                                        29 Mar 2010
+Changes with nginx 0.8.36                                        22 Apr 2010
+
+    *) Bugfix: the ngx_http_dav_module handled incorrectly the DELETE, 
+       COPY, and MOVE methods for symlinks.
+
+    *) Bugfix: values of the $query_string, $arg_..., etc. variables cached 
+       in main request were used by the SSI module in subrequests.
+
+    *) Bugfix: a variable value was repeatedly encoded after each an "echo" 
+       SSI-command output; the bug had appeared in 0.6.14.
+
+    *) Bugfix: a worker process hung if a FIFO file was requested.
+       Thanks to Vicente Aguilar and Maxim Dounin.
+
+    *) Bugfix: OpenSSL-1.0.0 compatibility on 64-bit Linux.
+       Thanks to Maxim Dounin.
+
+    *) Bugfix: nginx could not be built --without-http-cache; the bug had 
+       appeared in 0.8.35.
+
+
+Changes with nginx 0.8.35                                        01 Apr 2010
 
     *) Change: now the charset filter runs before the SSI filter.
 
--- a/CHANGES.ru	Mon Mar 29 00:00:00 2010 +0400
+++ b/CHANGES.ru	Thu Apr 22 00:00:00 2010 +0400
@@ -1,5 +1,27 @@
 
-Изменения в nginx 0.8.35                                          29.03.2010
+Изменения в nginx 0.8.36                                          22.04.2010
+
+    *) Исправление: модуль ngx_http_dav_module неправильно обрабатывал 
+       методы DELETE, COPY и MOVE для симлинков.
+
+    *) Исправление: модуль SSI в подзапросах использовал закэшированные в 
+       основном запросе значения переменных $query_string, $arg_... и им 
+       подобных.
+
+    *) Исправление: значение переменной повторно экранировалось после 
+       каждого вывода SSI-команды echo; ошибка появилась в 0.6.14.
+
+    *) Исправление: рабочий процесс зависал при запросе файла FIFO.
+       Спасибо Vicente Aguilar и Максиму Дунину.
+
+    *) Исправление: совместимость с OpenSSL-1.0.0 на 64-битном Linux.
+       Спасибо Максиму Дунину.
+
+    *) Исправление: nginx не собирался с параметром --without-http-cache; 
+       ошибка появилась в 0.8.35.
+
+
+Изменения в nginx 0.8.35                                          01.04.2010
 
     *) Изменение: теперь charset-фильтр работает до SSI-фильтра.
 
--- a/auto/lib/openssl/make	Mon Mar 29 00:00:00 2010 +0400
+++ b/auto/lib/openssl/make	Thu Apr 22 00:00:00 2010 +0400
@@ -57,7 +57,7 @@
 	&& \$(MAKE) clean \\
 	&& ./config --prefix=$ngx_prefix no-shared $OPENSSL_OPT \\
 	&& \$(MAKE) \\
-	&& \$(MAKE) install
+	&& \$(MAKE) install LIBDIR=lib
 
 END
 
--- a/src/core/nginx.h	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/core/nginx.h	Thu Apr 22 00:00:00 2010 +0400
@@ -8,8 +8,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version         8035
-#define NGINX_VERSION      "0.8.35"
+#define nginx_version         8036
+#define NGINX_VERSION      "0.8.36"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_open_file_cache.c	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/core/ngx_open_file_cache.c	Thu Apr 22 00:00:00 2010 +0400
@@ -490,7 +490,14 @@
     }
 
     if (!of->log) {
-        fd = ngx_open_file(name, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
+
+        /*
+         * Use non-blocking open() not to hang on FIFO files, etc.
+         * This flag has no effect on a regular files.
+         */
+
+        fd = ngx_open_file(name, NGX_FILE_RDONLY|NGX_FILE_NONBLOCK,
+                           NGX_FILE_OPEN, 0);
 
     } else {
         fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN,
--- a/src/http/modules/ngx_http_dav_module.c	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/http/modules/ngx_http_dav_module.c	Thu Apr 22 00:00:00 2010 +0400
@@ -325,13 +325,13 @@
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http delete filename: \"%s\"", path.data);
 
-    if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
+    if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
         err = ngx_errno;
 
         rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND;
 
         return ngx_http_dav_error(r->connection->log, err,
-                                  rc, ngx_file_info_n, path.data);
+                                  rc, ngx_link_info_n, path.data);
     }
 
     if (ngx_is_dir(&fi)) {
@@ -358,7 +358,7 @@
 
         /*
          * we do not need to test (r->uri.data[r->uri.len - 1] == '/')
-         * because ngx_file_info("/file/") returned NGX_ENOTDIR above
+         * because ngx_link_info("/file/") returned NGX_ENOTDIR above
          */
 
         depth = ngx_http_dav_depth(r, 0);
@@ -685,12 +685,12 @@
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http copy to: \"%s\"", copy.path.data);
 
-    if (ngx_file_info(copy.path.data, &fi) == NGX_FILE_ERROR) {
+    if (ngx_link_info(copy.path.data, &fi) == NGX_FILE_ERROR) {
         err = ngx_errno;
 
         if (err != NGX_ENOENT) {
             return ngx_http_dav_error(r->connection->log, err,
-                                      NGX_HTTP_NOT_FOUND, ngx_file_info_n,
+                                      NGX_HTTP_NOT_FOUND, ngx_link_info_n,
                                       copy.path.data);
         }
 
@@ -719,9 +719,9 @@
         dir = ngx_is_dir(&fi);
     }
 
-    if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
+    if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
         return ngx_http_dav_error(r->connection->log, ngx_errno,
-                                  NGX_HTTP_NOT_FOUND, ngx_file_info_n,
+                                  NGX_HTTP_NOT_FOUND, ngx_link_info_n,
                                   path.data);
     }
 
--- a/src/http/modules/ngx_http_fastcgi_module.c	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/http/modules/ngx_http_fastcgi_module.c	Thu Apr 22 00:00:00 2010 +0400
@@ -1101,7 +1101,6 @@
     ngx_table_elt_t                *h;
     ngx_http_upstream_t            *u;
     ngx_http_fastcgi_ctx_t         *f;
-    ngx_http_fastcgi_header_t      *fh;
     ngx_http_upstream_header_t     *hh;
     ngx_http_fastcgi_loc_conf_t    *flcf;
     ngx_http_fastcgi_split_part_t  *part;
@@ -1255,8 +1254,9 @@
 #if (NGX_HTTP_CACHE)
 
         if (f->large_stderr && r->cache) {
-            u_char   *start;
-            ssize_t   len;
+            u_char                     *start;
+            ssize_t                     len;
+            ngx_http_fastcgi_header_t  *fh;
 
             start = u->buffer.start + r->cache->header_start;
 
--- a/src/http/modules/ngx_http_gzip_static_module.c	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/http/modules/ngx_http_gzip_static_module.c	Thu Apr 22 00:00:00 2010 +0400
@@ -180,7 +180,7 @@
 #if !(NGX_WIN32) /* the not regular files are probably Unix specific */
 
     if (!of.is_file) {
-        ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
+        ngx_log_error(NGX_LOG_CRIT, log, 0,
                       "\"%s\" is not a regular file", path.data);
 
         return NGX_HTTP_NOT_FOUND;
--- a/src/http/modules/ngx_http_ssi_filter_module.c	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/http/modules/ngx_http_ssi_filter_module.c	Thu Apr 22 00:00:00 2010 +0400
@@ -14,7 +14,6 @@
 
 #define NGX_HTTP_SSI_ADD_PREFIX     1
 #define NGX_HTTP_SSI_ADD_ZERO       2
-#define NGX_HTTP_SSI_EXPR_TEST      4
 
 
 typedef struct {
@@ -1701,8 +1700,7 @@
             val = ngx_http_ssi_get_variable(r, &var, key);
 
             if (val == NULL) {
-                vv = ngx_http_get_variable(r, &var, key,
-                                           flags & NGX_HTTP_SSI_EXPR_TEST);
+                vv = ngx_http_get_variable(r, &var, key);
                 if (vv == NULL) {
                     return NGX_ERROR;
                 }
@@ -2110,7 +2108,7 @@
     value = ngx_http_ssi_get_variable(r, var, key);
 
     if (value == NULL) {
-        vv = ngx_http_get_variable(r, var, key, 1);
+        vv = ngx_http_get_variable(r, var, key);
 
         if (vv == NULL) {
             return NGX_HTTP_SSI_ERROR;
@@ -2161,11 +2159,10 @@
         }
     }
 
+    p = value->data;
+
     switch (ctx->encoding) {
 
-    case NGX_HTTP_SSI_NO_ENCODING:
-        break;
-
     case NGX_HTTP_SSI_URL_ENCODING:
         len = 2 * ngx_escape_uri(NULL, value->data, value->len,
                                  NGX_ESCAPE_HTML);
@@ -2177,11 +2174,9 @@
             }
 
             (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML);
-
-            value->len += len;
-            value->data = p;
         }
 
+        len += value->len;
         break;
 
     case NGX_HTTP_SSI_ENTITY_ENCODING:
@@ -2194,11 +2189,13 @@
             }
 
             (void) ngx_escape_html(p, value->data, value->len);
-
-            value->len += len;
-            value->data = p;
         }
 
+        len += value->len;
+        break;
+
+    default: /* NGX_HTTP_SSI_NO_ENCODING */
+        len = value->len;
         break;
     }
 
@@ -2213,8 +2210,8 @@
     }
 
     b->memory = 1;
-    b->pos = value->data;
-    b->last = value->data + value->len;
+    b->pos = p;
+    b->last = p + len;
 
     cl->buf = b;
     cl->next = NULL;
@@ -2362,7 +2359,7 @@
         p++;
     }
 
-    flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0;
+    flags = 0;
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "left: \"%V\"", &left);
--- a/src/http/modules/ngx_http_static_module.c	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/http/modules/ngx_http_static_module.c	Thu Apr 22 00:00:00 2010 +0400
@@ -189,7 +189,7 @@
 #if !(NGX_WIN32) /* the not regular files are probably Unix specific */
 
     if (!of.is_file) {
-        ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
+        ngx_log_error(NGX_LOG_CRIT, log, 0,
                       "\"%s\" is not a regular file", path.data);
 
         return NGX_HTTP_NOT_FOUND;
--- a/src/http/modules/perl/nginx.pm	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/http/modules/perl/nginx.pm	Thu Apr 22 00:00:00 2010 +0400
@@ -47,7 +47,7 @@
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.8.35';
+our $VERSION = '0.8.36';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/modules/perl/nginx.xs	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/http/modules/perl/nginx.xs	Thu Apr 22 00:00:00 2010 +0400
@@ -848,7 +848,7 @@
 
     #endif
 
-    vv = ngx_http_get_variable(r, &var, hash, 1);
+    vv = ngx_http_get_variable(r, &var, hash);
     if (vv == NULL) {
         XSRETURN_UNDEF;
     }
--- a/src/http/ngx_http_variables.c	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/http/ngx_http_variables.c	Thu Apr 22 00:00:00 2010 +0400
@@ -441,8 +441,7 @@
 
 
 ngx_http_variable_value_t *
-ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
-    ngx_uint_t nowarn)
+ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key)
 {
     ngx_http_variable_t        *v;
     ngx_http_variable_value_t  *vv;
@@ -454,7 +453,7 @@
 
     if (v) {
         if (v->flags & NGX_HTTP_VAR_INDEXED) {
-            return ngx_http_get_indexed_variable(r, v->index);
+            return ngx_http_get_flushed_variable(r, v->index);
 
         } else {
 
@@ -526,11 +525,6 @@
 
     vv->not_found = 1;
 
-    if (nowarn == 0) {
-        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                      "unknown \"%V\" variable", name);
-    }
-
     return vv;
 }
 
@@ -1937,6 +1931,7 @@
         if (ngx_strncmp(v[i].name.data, "arg_", 4) == 0) {
             v[i].get_handler = ngx_http_variable_argument;
             v[i].data = (uintptr_t) &v[i].name;
+            v[i].flags = NGX_HTTP_VAR_NOCACHEABLE;
 
             continue;
         }
--- a/src/http/ngx_http_variables.h	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/http/ngx_http_variables.h	Thu Apr 22 00:00:00 2010 +0400
@@ -50,7 +50,7 @@
     ngx_uint_t index);
 
 ngx_http_variable_value_t *ngx_http_get_variable(ngx_http_request_t *r,
-    ngx_str_t *name, ngx_uint_t key, ngx_uint_t nowarn);
+    ngx_str_t *name, ngx_uint_t key);
 
 ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v,
     ngx_str_t *var, ngx_list_part_t *part, size_t prefix);
--- a/src/os/unix/ngx_files.h	Mon Mar 29 00:00:00 2010 +0400
+++ b/src/os/unix/ngx_files.h	Thu Apr 22 00:00:00 2010 +0400
@@ -64,6 +64,7 @@
 #define NGX_FILE_OPEN            0
 #define NGX_FILE_TRUNCATE        O_CREAT|O_TRUNC
 #define NGX_FILE_APPEND          O_WRONLY|O_APPEND
+#define NGX_FILE_NONBLOCK        O_NONBLOCK
 
 #define NGX_FILE_DEFAULT_ACCESS  0644
 #define NGX_FILE_OWNER_ACCESS    0600
@@ -138,6 +139,9 @@
 #define ngx_fd_info(fd, sb)      fstat(fd, sb)
 #define ngx_fd_info_n            "fstat()"
 
+#define ngx_link_info(file, sb)  lstat((const char *) file, sb)
+#define ngx_link_info_n          "lstat()"
+
 #define ngx_is_dir(sb)           (S_ISDIR((sb)->st_mode))
 #define ngx_is_file(sb)          (S_ISREG((sb)->st_mode))
 #define ngx_is_link(sb)          (S_ISLNK((sb)->st_mode))