changeset 470:6866b490272e NGINX_0_7_47

nginx 0.7.47 *) Bugfix: nginx could not be built on FreeBSD 6 and early versions; the bug had appeared in 0.7.46. *) Bugfix: nginx could not be built on MacOSX; the bug had appeared in 0.7.46. *) Bugfix: if the "max_size" parameter was set, then the cache manager might purge a whole cache; the bug had appeared in 0.7.46. *) Change: a segmentation fault might occur in worker process, if the "proxy_cache"/"fastcgi_cache" and the "proxy_cache_valid"/ "fastcgi_cache_valid" were set on different levels; the bug had appeared in 0.7.46. *) Bugfix: a segmentation fault might occur in worker process, if a request was redirected to a proxied or FastCGI server via error_page or try_files; the bug had appeared in 0.7.44.
author Igor Sysoev <http://sysoev.ru>
date Wed, 01 Apr 2009 00:00:00 +0400
parents 3174b44e74fc
children 0cc33540f2e0
files CHANGES CHANGES.ru auto/cc/msvc auto/headers auto/include auto/os/features src/core/nginx.h src/core/ngx_cycle.c src/core/ngx_log.c src/core/ngx_open_file_cache.c src/http/modules/perl/nginx.pm src/http/ngx_http_file_cache.c src/http/ngx_http_parse.c src/os/unix/ngx_darwin_config.h src/os/unix/ngx_errno.h src/os/unix/ngx_files.h src/os/unix/ngx_freebsd_config.h
diffstat 17 files changed, 82 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Mon Mar 30 00:00:00 2009 +0400
+++ b/CHANGES	Wed Apr 01 00:00:00 2009 +0400
@@ -1,4 +1,25 @@
 
+Changes with nginx 0.7.47                                        01 Apr 2009
+
+    *) Bugfix: nginx could not be built on FreeBSD 6 and early versions; 
+       the bug had appeared in 0.7.46.
+
+    *) Bugfix: nginx could not be built on MacOSX; the bug had 
+       appeared in 0.7.46.
+
+    *) Bugfix: if the "max_size" parameter was set, then the cache manager 
+       might purge a whole cache; the bug had appeared in 0.7.46.
+
+    *) Change: a segmentation fault might occur in worker process, if the 
+       "proxy_cache"/"fastcgi_cache" and the "proxy_cache_valid"/ 
+       "fastcgi_cache_valid" were set on different levels; the bug had 
+       appeared in 0.7.46.
+
+    *) Bugfix: a segmentation fault might occur in worker process, if a 
+       request was redirected to a proxied or FastCGI server via error_page 
+       or try_files; the bug had appeared in 0.7.44.
+
+
 Changes with nginx 0.7.46                                        30 Mar 2009
 
     *) Bugfix: the previous release tarball was incorrect.
@@ -6,8 +27,8 @@
 
 Changes with nginx 0.7.45                                        30 Mar 2009
 
-    *) Change: now the "proxy_cache" and the "proxy_cache_valid" can be set 
-       on different levels.
+    *) Change: now the "proxy_cache" and the "proxy_cache_valid" directives 
+       can be set on different levels.
 
     *) Change: the "clean_time" parameter of the "proxy_cache_path" 
        directive is canceled.
--- a/CHANGES.ru	Mon Mar 30 00:00:00 2009 +0400
+++ b/CHANGES.ru	Wed Apr 01 00:00:00 2009 +0400
@@ -1,4 +1,24 @@
 
+Изменения в nginx 0.7.47                                          01.04.2009
+
+    *) Исправление: nginx не собирался на FreeBSD 6 и более ранних версиях; 
+       ошибка появилась в 0.7.46.
+
+    *) Исправление: nginx не собирался на MacOSX; ошибка появилась в 0.7.46.
+
+    *) Исправление: если использовался параметр max_size, то cache manager 
+       мог удалить весь кэш; ошибка появилась в 0.7.46.
+
+    *) Изменение: в рабочем процессе мог произойти segmentation fault, если 
+       директивы proxy_cache/fastcgi_cache и proxy_cache_valid/ 
+       fastcgi_cache_valid не были заданы на одном уровне; ошибка появилась 
+       в 0.7.46.
+
+    *) Исправление: в рабочем процессе мог произойти segmentation fault при 
+       перенаправлении запроса проксированному или FastCGI-серверу с 
+       помощью error_page или try_files; ошибка появилась в 0.7.44.
+
+
 Изменения в nginx 0.7.46                                          30.03.2009
 
     *) Исправление: архив предыдущего релиза был неверным.
--- a/auto/cc/msvc	Mon Mar 30 00:00:00 2009 +0400
+++ b/auto/cc/msvc	Wed Apr 01 00:00:00 2009 +0400
@@ -2,7 +2,9 @@
 # Copyright (C) Igor Sysoev
 
 
-# MSVC 6.0 SP2, MSVC Toolkit 2003 (7.1), MSVC 2005 Express Edition SP1 (8.0)
+# MSVC 6.0 SP2
+# MSVC Toolkit 2003 (7.1)
+# MSVC 2005 Express Edition SP1 (8.0)
 
 # optimizations
 
@@ -76,13 +78,11 @@
 # the link flags
 CORE_LINK="$CORE_LINK -link -verbose:lib"
 
-if [ $NGX_CC_NAME = msvc7 ]; then
-    # link with libcmt.lib, multithreaded
-    LIBC="-MT"
-else
-    # link with msvcrt.dll
-    LIBC="-MD"
-fi
+# link with libcmt.lib, multithreaded
+LIBC="-MT"
+# link with msvcrt.dll
+# however, MSVC Toolkit 2003 has no MSVCRT.LIB
+#LIBC="-MD"
 
 CFLAGS="$CFLAGS $LIBC"
 
--- a/auto/headers	Mon Mar 30 00:00:00 2009 +0400
+++ b/auto/headers	Wed Apr 01 00:00:00 2009 +0400
@@ -6,6 +6,7 @@
 ngx_include="inttypes.h";    . auto/include
 ngx_include="limits.h";      . auto/include
 ngx_include="sys/filio.h";   . auto/include
+ngx_include="sys/param.h";   . auto/include
 ngx_include="sys/mount.h";   . auto/include
 ngx_include="sys/statvfs.h"; . auto/include
 ngx_include="crypt.h";       . auto/include
--- a/auto/include	Mon Mar 30 00:00:00 2009 +0400
+++ b/auto/include	Wed Apr 01 00:00:00 2009 +0400
@@ -16,6 +16,7 @@
 
 cat << END > $NGX_AUTOTEST.c
 
+$NGX_INCLUDE_SYS_PARAM_H
 #include <$ngx_include>
 
 int main() {
--- a/auto/os/features	Mon Mar 30 00:00:00 2009 +0400
+++ b/auto/os/features	Wed Apr 01 00:00:00 2009 +0400
@@ -210,7 +210,8 @@
 ngx_feature="statfs()"
 ngx_feature_name="NGX_HAVE_STATFS"
 ngx_feature_run=no
-ngx_feature_incs="$NGX_INCLUDE_SYS_MOUNT_H
+ngx_feature_incs="$NGX_INCLUDE_SYS_PARAM_H
+                  $NGX_INCLUDE_SYS_MOUNT_H
                   $NGX_INCLUDE_SYS_VFS_H"
 ngx_feature_path=
 ngx_feature_libs=
--- a/src/core/nginx.h	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/core/nginx.h	Wed Apr 01 00:00:00 2009 +0400
@@ -8,8 +8,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version       007046
-#define NGINX_VERSION      "0.7.46"
+#define nginx_version       007047
+#define NGINX_VERSION      "0.7.47"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_cycle.c	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/core/ngx_cycle.c	Wed Apr 01 00:00:00 2009 +0400
@@ -359,8 +359,9 @@
             continue;
         }
 
-        file[i].fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR,
-                                   NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND,
+        file[i].fd = ngx_open_file(file[i].name.data,
+                                   NGX_FILE_APPEND,
+                                   NGX_FILE_CREATE_OR_OPEN,
                                    NGX_FILE_DEFAULT_ACCESS);
 
         ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
@@ -1064,9 +1065,8 @@
             file[i].pos = file[i].buffer;
         }
 
-        fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR,
-                           NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND,
-                           NGX_FILE_DEFAULT_ACCESS);
+        fd = ngx_open_file(file[i].name.data, NGX_FILE_APPEND,
+                           NGX_FILE_CREATE_OR_OPEN, NGX_FILE_DEFAULT_ACCESS);
 
         ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
                        "reopen file \"%s\", old:%d new:%d",
--- a/src/core/ngx_log.c	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/core/ngx_log.c	Wed Apr 01 00:00:00 2009 +0400
@@ -200,8 +200,10 @@
 
     ngx_stderr_fileno = GetStdHandle(STD_ERROR_HANDLE);
 
-    ngx_stderr.fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR,
-                                  NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND, 0);
+    ngx_stderr.fd = ngx_open_file((u_char *) NGX_ERROR_LOG_PATH,
+                                  NGX_FILE_APPEND,
+                                  NGX_FILE_CREATE_OR_OPEN,
+                                  NGX_FILE_DEFAULT_ACCESS);
 
     if (ngx_stderr.fd == NGX_INVALID_FILE) {
         ngx_message_box("nginx", MB_OK, ngx_errno,
@@ -210,14 +212,6 @@
         return NULL;
     }
 
-    if (ngx_file_append_mode(ngx_stderr.fd) == NGX_ERROR) {
-        ngx_message_box("nginx", MB_OK, ngx_errno,
-                        "Could not open error log file: "
-                        ngx_file_append_mode_n " \"" NGX_ERROR_LOG_PATH
-                        "\" failed");
-        return NULL;
-    }
-
 #else
 
     ngx_stderr.fd = STDERR_FILENO;
--- a/src/core/ngx_open_file_cache.c	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/core/ngx_open_file_cache.c	Wed Apr 01 00:00:00 2009 +0400
@@ -466,8 +466,7 @@
         fd = ngx_open_file(name, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
 
     } else {
-        fd = ngx_open_file(name, NGX_FILE_RDWR,
-                           NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND,
+        fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN,
                            NGX_FILE_DEFAULT_ACCESS);
     }
 
--- a/src/http/modules/perl/nginx.pm	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/http/modules/perl/nginx.pm	Wed Apr 01 00:00:00 2009 +0400
@@ -47,7 +47,7 @@
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.7.46';
+our $VERSION = '0.7.47';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_file_cache.c	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/http/ngx_http_file_cache.c	Wed Apr 01 00:00:00 2009 +0400
@@ -448,6 +448,7 @@
     fcn->valid_sec = 0;
     fcn->uniq = 0;
     fcn->body_start = 0;
+    fcn->length = 0;
 
 done:
 
@@ -1065,6 +1066,9 @@
 
         ngx_shmtx_unlock(&cache->shpool->mutex);
 
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
+                       "http file cache size: %O", size);
+
         if (size < cache->max_size) {
             return next;
         }
@@ -1290,6 +1294,10 @@
     ngx_uint_t               i;
     ngx_http_cache_valid_t  *valid;
 
+    if (cache_valid == NULL) {
+        return 0;
+    }
+
     valid = cache_valid->elts;
     for (i = 0; i < cache_valid->nelts; i++) {
 
--- a/src/http/ngx_http_parse.c	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/http/ngx_http_parse.c	Wed Apr 01 00:00:00 2009 +0400
@@ -1534,6 +1534,8 @@
 
     last = p + uri->len;
 
+    args->len = 0;
+
     while (p < last) {
 
         ch = *p++;
--- a/src/os/unix/ngx_darwin_config.h	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/os/unix/ngx_darwin_config.h	Wed Apr 01 00:00:00 2009 +0400
@@ -24,6 +24,7 @@
 #include <grp.h>
 #include <dirent.h>
 #include <glob.h>
+#include <sys/mount.h>          /* statfs() */
 
 #include <sys/filio.h>          /* FIONBIO */
 #include <sys/ioctl.h>
--- a/src/os/unix/ngx_errno.h	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/os/unix/ngx_errno.h	Wed Apr 01 00:00:00 2009 +0400
@@ -44,6 +44,7 @@
 #define NGX_EHOSTUNREACH  EHOSTUNREACH
 #define NGX_ENOSYS        ENOSYS
 #define NGX_ECANCELED     ECANCELED
+#define NGX_EILSEQ        EILSEQ
 #define NGX_ENOMOREFILES  0
 
 
--- a/src/os/unix/ngx_files.h	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/os/unix/ngx_files.h	Wed Apr 01 00:00:00 2009 +0400
@@ -64,7 +64,7 @@
 #define NGX_FILE_CREATE_OR_OPEN  O_CREAT
 #define NGX_FILE_OPEN            0
 #define NGX_FILE_TRUNCATE        O_TRUNC
-#define NGX_FILE_APPEND          O_APPEND
+#define NGX_FILE_APPEND          O_WRONLY|O_APPEND
 
 #define NGX_FILE_DEFAULT_ACCESS  0644
 #define NGX_FILE_OWNER_ACCESS    0600
--- a/src/os/unix/ngx_freebsd_config.h	Mon Mar 30 00:00:00 2009 +0400
+++ b/src/os/unix/ngx_freebsd_config.h	Wed Apr 01 00:00:00 2009 +0400
@@ -22,6 +22,7 @@
 #include <grp.h>
 #include <dirent.h>
 #include <glob.h>
+#include <sys/param.h>          /* ALIGN() */
 #include <sys/mount.h>          /* statfs() */
 
 #include <sys/filio.h>          /* FIONBIO */
@@ -44,7 +45,6 @@
 #include <libutil.h>            /* setproctitle() before 4.1 */
 #include <osreldate.h>
 #include <sys/sysctl.h>
-#include <sys/param.h>          /* ALIGN() */
 
 
 #if __FreeBSD_version < 400017