# HG changeset patch # User Igor Sysoev # Date 1238529600 -14400 # Node ID 6866b490272ef912cd285ce6edc2c393546ea947 # Parent 3174b44e74fca3208064185d62d951af34e8a53e 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. diff --git a/CHANGES b/CHANGES --- a/CHANGES +++ b/CHANGES @@ -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.46 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. diff --git a/CHANGES.ru b/CHANGES.ru --- a/CHANGES.ru +++ b/CHANGES.ru @@ -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 *) Исправление: архив предыдущего релиза был неверным. diff --git a/auto/cc/msvc b/auto/cc/msvc --- a/auto/cc/msvc +++ b/auto/cc/msvc @@ -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 @@ LINK="\$(CC)" # 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" diff --git a/auto/headers b/auto/headers --- a/auto/headers +++ b/auto/headers @@ -6,6 +6,7 @@ ngx_include="unistd.h"; . auto/incl 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 diff --git a/auto/include b/auto/include --- a/auto/include +++ b/auto/include @@ -16,6 +16,7 @@ ngx_found=no cat << END > $NGX_AUTOTEST.c +$NGX_INCLUDE_SYS_PARAM_H #include <$ngx_include> int main() { diff --git a/auto/os/features b/auto/os/features --- a/auto/os/features +++ b/auto/os/features @@ -210,7 +210,8 @@ ngx_feature_test="directio(0, DIRECTIO_O 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= diff --git a/src/core/nginx.h b/src/core/nginx.h --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -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" diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -359,8 +359,9 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) 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 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx 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", diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c --- a/src/core/ngx_log.c +++ b/src/core/ngx_log.c @@ -200,8 +200,10 @@ ngx_log_init(void) 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 @@ ngx_log_init(void) 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; diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c --- a/src/core/ngx_open_file_cache.c +++ b/src/core/ngx_open_file_cache.c @@ -466,8 +466,7 @@ ngx_open_and_stat_file(u_char *name, ngx 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); } diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm --- 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.7.46'; +our $VERSION = '0.7.47'; require XSLoader; XSLoader::load('nginx', $VERSION); diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c --- a/src/http/ngx_http_file_cache.c +++ b/src/http/ngx_http_file_cache.c @@ -448,6 +448,7 @@ renew: fcn->valid_sec = 0; fcn->uniq = 0; fcn->body_start = 0; + fcn->length = 0; done: @@ -1065,6 +1066,9 @@ ngx_http_file_cache_manager(void *data) 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_http_file_cache_valid(ngx_array_t *c 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++) { diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c --- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c @@ -1534,6 +1534,8 @@ ngx_http_split_args(ngx_http_request_t * last = p + uri->len; + args->len = 0; + while (p < last) { ch = *p++; diff --git a/src/os/unix/ngx_darwin_config.h b/src/os/unix/ngx_darwin_config.h --- a/src/os/unix/ngx_darwin_config.h +++ b/src/os/unix/ngx_darwin_config.h @@ -24,6 +24,7 @@ #include #include #include +#include /* statfs() */ #include /* FIONBIO */ #include diff --git a/src/os/unix/ngx_errno.h b/src/os/unix/ngx_errno.h --- a/src/os/unix/ngx_errno.h +++ b/src/os/unix/ngx_errno.h @@ -44,6 +44,7 @@ typedef int ngx_err_t; #define NGX_EHOSTUNREACH EHOSTUNREACH #define NGX_ENOSYS ENOSYS #define NGX_ECANCELED ECANCELED +#define NGX_EILSEQ EILSEQ #define NGX_ENOMOREFILES 0 diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h --- a/src/os/unix/ngx_files.h +++ b/src/os/unix/ngx_files.h @@ -64,7 +64,7 @@ typedef struct { #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 diff --git a/src/os/unix/ngx_freebsd_config.h b/src/os/unix/ngx_freebsd_config.h --- a/src/os/unix/ngx_freebsd_config.h +++ b/src/os/unix/ngx_freebsd_config.h @@ -22,6 +22,7 @@ #include #include #include +#include /* ALIGN() */ #include /* statfs() */ #include /* FIONBIO */ @@ -44,7 +45,6 @@ #include /* setproctitle() before 4.1 */ #include #include -#include /* ALIGN() */ #if __FreeBSD_version < 400017