summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNGINX team <nginx@nginx.org>2012-08-07 12:42:55 +0000
committerJon Kolb <jon@b0g.us>2012-08-07 12:42:55 +0000
commitc60d94a437519d123e7f5b4023e19dbd2d918f43 (patch)
treefebc087177873b065631be4781fea2e9dab4f7f1
parent8acdf917b63fa9b8c3463d0b69e3c7fb066cb6e8 (diff)
downloadnginx-c60d94a437519d123e7f5b4023e19dbd2d918f43.tar.gz
Changes with nginx 1.2.3 07 Aug 2012v1.2.3
*) Feature: the Clang compiler support. *) Bugfix: extra listening sockets might be created. Thanks to Roman Odaisky. *) Bugfix: nginx/Windows might hog CPU if a worker process failed to start. Thanks to Ricardo Villalobos Guevara. *) Bugfix: the "proxy_pass_header", "fastcgi_pass_header", "scgi_pass_header", "uwsgi_pass_header", "proxy_hide_header", "fastcgi_hide_header", "scgi_hide_header", and "uwsgi_hide_header" directives might be inherited incorrectly. *) Bugfix: trailing dot in a source value was not ignored if the "map" directive was used with the "hostnames" parameter. *) Bugfix: incorrect location might be used to process a request if a URI was changed via a "rewrite" directive before an internal redirect to a named location.
-rw-r--r--CHANGES26
-rw-r--r--CHANGES.ru24
-rw-r--r--LICENSE5
-rw-r--r--auto/cc/clang98
-rw-r--r--auto/cc/conf6
-rw-r--r--auto/cc/gcc4
-rw-r--r--auto/cc/name40
-rw-r--r--auto/install2
-rw-r--r--auto/lib/libatomic/make2
-rw-r--r--auto/lib/perl/make2
-rwxr-xr-xconfigure3
-rw-r--r--src/core/nginx.h4
-rw-r--r--src/core/ngx_conf_file.c39
-rw-r--r--src/core/ngx_conf_file.h2
-rw-r--r--src/core/ngx_crypt.c1
-rw-r--r--src/core/ngx_shmtx.c6
-rw-r--r--src/core/ngx_shmtx.h2
-rw-r--r--src/core/ngx_slab.c6
-rw-r--r--src/event/modules/ngx_epoll_module.c14
-rw-r--r--src/event/modules/ngx_eventport_module.c31
-rw-r--r--src/event/modules/ngx_rtsig_module.c12
-rw-r--r--src/event/ngx_event.c93
-rw-r--r--src/http/modules/ngx_http_limit_conn_module.c4
-rw-r--r--src/http/modules/ngx_http_log_module.c2
-rw-r--r--src/http/modules/ngx_http_map_module.c9
-rw-r--r--src/http/modules/ngx_http_upstream_least_conn_module.c2
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/ngx_http.c5
-rw-r--r--src/http/ngx_http_core_module.c3
-rw-r--r--src/http/ngx_http_parse_time.c1
-rw-r--r--src/http/ngx_http_request.c13
-rw-r--r--src/http/ngx_http_upstream.c12
-rw-r--r--src/mail/ngx_mail_parse.c3
-rw-r--r--src/misc/ngx_cpp_test_module.cpp2
-rw-r--r--src/os/unix/ngx_atomic.h2
-rw-r--r--src/os/unix/ngx_files.c12
-rw-r--r--src/os/unix/ngx_posix_init.c4
-rw-r--r--src/os/unix/ngx_solaris_sendfilev_chain.c3
38 files changed, 368 insertions, 133 deletions
diff --git a/CHANGES b/CHANGES
index f113116b2..1bfebf38d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,28 @@
+Changes with nginx 1.2.3 07 Aug 2012
+
+ *) Feature: the Clang compiler support.
+
+ *) Bugfix: extra listening sockets might be created.
+ Thanks to Roman Odaisky.
+
+ *) Bugfix: nginx/Windows might hog CPU if a worker process failed to
+ start.
+ Thanks to Ricardo Villalobos Guevara.
+
+ *) Bugfix: the "proxy_pass_header", "fastcgi_pass_header",
+ "scgi_pass_header", "uwsgi_pass_header", "proxy_hide_header",
+ "fastcgi_hide_header", "scgi_hide_header", and "uwsgi_hide_header"
+ directives might be inherited incorrectly.
+
+ *) Bugfix: trailing dot in a source value was not ignored if the "map"
+ directive was used with the "hostnames" parameter.
+
+ *) Bugfix: incorrect location might be used to process a request if a
+ URI was changed via a "rewrite" directive before an internal redirect
+ to a named location.
+
+
Changes with nginx 1.2.2 03 Jul 2012
*) Change: the "single" parameter of the "keepalive" directive is now
@@ -11,7 +35,7 @@ Changes with nginx 1.2.2 03 Jul 2012
directives, and the "server" directive inside the "upstream" block,
now support IPv6 addresses.
- *) Feature: the "resolver" directive now support IPv6 addresses and an
+ *) Feature: the "resolver" directive now supports IPv6 addresses and an
optional port specification.
*) Feature: the "least_conn" directive inside the "upstream" block.
diff --git a/CHANGES.ru b/CHANGES.ru
index 5ae0817b5..d85b2f929 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,28 @@
+Изменения в nginx 1.2.3 07.08.2012
+
+ *) Добавление: поддержка компилятора Clang.
+
+ *) Исправление: могли создаваться лишние слушающие сокеты.
+ Спасибо Роману Одайскому.
+
+ *) Исправление: nginx/Windows мог нагружать процессор, если при запуске
+ рабочего процесса происходила ошибка.
+ Спасибо Ricardo Villalobos Guevara.
+
+ *) Исправление: директивы proxy_pass_header, fastcgi_pass_header,
+ scgi_pass_header, uwsgi_pass_header, proxy_hide_header,
+ fastcgi_hide_header, scgi_hide_header и uwsgi_hide_header могли
+ наследоваться некорректно.
+
+ *) Исправление: при использовании директивы map с параметром hostnames
+ не игнорировалась конечная точка в исходном значении.
+
+ *) Исправление: для обработки запроса мог использоваться неверный
+ location, если переход в именованный location происходил после
+ изменения URI с помощью директивы rewrite.
+
+
Изменения в nginx 1.2.2 03.07.2012
*) Изменение: параметр single директивы keepalive теперь игнорируется.
diff --git a/LICENSE b/LICENSE
index 1bfc054da..c78be7e37 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2002-2012 Igor Sysoev
* Copyright (C) 2011,2012 Nginx, Inc.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +12,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
diff --git a/auto/cc/clang b/auto/cc/clang
new file mode 100644
index 000000000..9f60d7b3a
--- /dev/null
+++ b/auto/cc/clang
@@ -0,0 +1,98 @@
+
+# Copyright (C) Nginx, Inc.
+
+
+# clang
+
+
+NGX_CLANG_VER=`$CC -v 2>&1 | grep 'clang version' 2>&1 \
+ | sed -e 's/^.*clang version \(.*\)/\1/'`
+
+echo " + clang version: $NGX_CLANG_VER"
+
+have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define
+
+
+CC_TEST_FLAGS="-pipe"
+
+
+# optimizations
+
+#NGX_CLANG_OPT="-O2"
+#NGX_CLANG_OPT="-Oz"
+NGX_CLANG_OPT="-O"
+
+case $CPU in
+ pentium)
+ # optimize for Pentium
+ CPU_OPT="-march=pentium"
+ NGX_CPU_CACHE_LINE=32
+ ;;
+
+ pentiumpro | pentium3)
+ # optimize for Pentium Pro, Pentium II and Pentium III
+ CPU_OPT="-march=pentiumpro"
+ NGX_CPU_CACHE_LINE=32
+ ;;
+
+ pentium4)
+ # optimize for Pentium 4
+ CPU_OPT="-march=pentium4"
+ NGX_CPU_CACHE_LINE=128
+ ;;
+
+ athlon)
+ # optimize for Athlon
+ CPU_OPT="-march=athlon"
+ NGX_CPU_CACHE_LINE=64
+ ;;
+
+ opteron)
+ # optimize for Opteron
+ CPU_OPT="-march=opteron"
+ NGX_CPU_CACHE_LINE=64
+ ;;
+
+esac
+
+CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT"
+
+
+CFLAGS="$CFLAGS -pipe $CPU_OPT"
+
+if [ ".$PCRE_OPT" = "." ]; then
+ PCRE_OPT="-O2 -pipe $CPU_OPT"
+else
+ PCRE_OPT="$PCRE_OPT -pipe"
+fi
+
+if [ ".$MD5_OPT" = "." ]; then
+ MD5_OPT="-O2 -pipe $CPU_OPT"
+else
+ MD5_OPT="$MD5_OPT -pipe"
+fi
+
+if [ ".$ZLIB_OPT" = "." ]; then
+ ZLIB_OPT="-O2 -pipe $CPU_OPT"
+else
+ ZLIB_OPT="$ZLIB_OPT -pipe"
+fi
+
+
+# warnings
+
+CFLAGS="$CFLAGS $NGX_CLANG_OPT -Wall -Wextra -Wpointer-arith"
+#CFLAGS="$CFLAGS -Wmissing-prototypes"
+
+# we have a lot of unused function arguments
+CFLAGS="$CFLAGS -Wno-unused-parameter"
+
+# stop on warning
+#CFLAGS="$CFLAGS -Werror"
+
+# debug
+CFLAGS="$CFLAGS -g"
+
+if [ ".$CPP" = "." ]; then
+ CPP="$CC -E"
+fi
diff --git a/auto/cc/conf b/auto/cc/conf
index c9118f2fd..8027b9805 100644
--- a/auto/cc/conf
+++ b/auto/cc/conf
@@ -56,6 +56,12 @@ else
. auto/cc/gcc
;;
+ clang)
+ # Clang C compiler
+
+ . auto/cc/clang
+ ;;
+
icc)
# Intel C++ compiler 7.1, 8.0, 8.1
diff --git a/auto/cc/gcc b/auto/cc/gcc
index de666a34c..c27d857e3 100644
--- a/auto/cc/gcc
+++ b/auto/cc/gcc
@@ -149,15 +149,13 @@ CFLAGS="$CFLAGS ${NGX_GCC_OPT:--O} -W"
CFLAGS="$CFLAGS -Wall -Wpointer-arith"
#CFLAGS="$CFLAGS -Wconversion"
#CFLAGS="$CFLAGS -Winline"
+#CFLAGS="$CFLAGS -Wmissing-prototypes"
case "$NGX_GCC_VER" in
3.* | 4.* )
# we have a lot of the unused function arguments
CFLAGS="$CFLAGS -Wno-unused-parameter"
- CFLAGS="$CFLAGS -Wunused-function"
- CFLAGS="$CFLAGS -Wunused-variable"
- CFLAGS="$CFLAGS -Wunused-value"
# 4.2.1 shows the warning in wrong places
#CFLAGS="$CFLAGS -Wunreachable-code"
;;
diff --git a/auto/cc/name b/auto/cc/name
index 7860c69e2..7a5656c64 100644
--- a/auto/cc/name
+++ b/auto/cc/name
@@ -32,14 +32,14 @@ if [ "$CC" = cl ]; then
NGX_CC_NAME=msvc10
echo " + using Microsoft Visual C++ 10 compiler"
- else if `$NGX_WINE $CC -v 2>&1 \
+ elif `$NGX_WINE $CC -v 2>&1 \
| grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14' \
>/dev/null 2>&1`; then
NGX_CC_NAME=msvc8
echo " + using Microsoft Visual C++ 8 compiler"
- else if `$NGX_WINE $CC -v 2>&1 \
+ elif `$NGX_WINE $CC -v 2>&1 \
| grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13' \
>/dev/null 2>&1`; then
@@ -50,52 +50,40 @@ if [ "$CC" = cl ]; then
NGX_CC_NAME=msvc
echo " + using Microsoft Visual C++ compiler"
fi
- fi
- fi
-else
-if [ "$CC" = wcl386 ]; then
+elif [ "$CC" = wcl386 ]; then
NGX_CC_NAME=owc
echo " + using Open Watcom C compiler"
-else
-if [ "$CC" = bcc32 ]; then
+elif [ "$CC" = bcc32 ]; then
NGX_CC_NAME=bcc
echo " + using Borland C++ compiler"
-else
-if `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then
+elif `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then
NGX_CC_NAME=icc
echo " + using Intel C++ compiler"
-else
-if `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then
+elif `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then
NGX_CC_NAME=gcc
echo " + using GNU C compiler"
-else
-if `$CC -V 2>&1 | grep 'Sun C' >/dev/null 2>&1`; then
+elif `$CC -v 2>&1 | grep 'clang version' >/dev/null 2>&1`; then
+ NGX_CC_NAME=clang
+ echo " + using Clang C compiler"
+
+elif `$CC -V 2>&1 | grep 'Sun C' >/dev/null 2>&1`; then
NGX_CC_NAME=sunc
echo " + using Sun C compiler"
-else
-if `$CC -V 2>&1 | grep '^Compaq C' >/dev/null 2>&1`; then
+elif `$CC -V 2>&1 | grep '^Compaq C' >/dev/null 2>&1`; then
NGX_CC_NAME=ccc
echo " + using Compaq C compiler"
-else
-if `$CC -V 2>&1 | grep '^aCC: ' >/dev/null 2>&1`; then
+elif `$CC -V 2>&1 | grep '^aCC: ' >/dev/null 2>&1`; then
NGX_CC_NAME=acc
echo " + using HP aC++ compiler"
else
NGX_CC_NAME=unknown
-fi # acc
-fi # ccc
-fi # sunc
-fi # icc
-fi # gcc
-fi # bcc
-fi # owc
-fi # msvc
+fi
diff --git a/auto/install b/auto/install
index c2c0ade59..6ef0da9df 100644
--- a/auto/install
+++ b/auto/install
@@ -8,7 +8,7 @@ if [ $USE_PERL = YES ]; then
cat << END >> $NGX_MAKEFILE
install_perl_modules:
- cd $NGX_OBJS/src/http/modules/perl && make install
+ cd $NGX_OBJS/src/http/modules/perl && \${MAKE} install
END
NGX_INSTALL_PERL_MODULES=install_perl_modules
diff --git a/auto/lib/libatomic/make b/auto/lib/libatomic/make
index b84267b63..f3cd83281 100644
--- a/auto/lib/libatomic/make
+++ b/auto/lib/libatomic/make
@@ -6,7 +6,7 @@
cat << END >> $NGX_MAKEFILE
$NGX_LIBATOMIC/src/libatomic_ops.a: $NGX_LIBATOMIC/Makefile
- cd $NGX_LIBATOMIC && make
+ cd $NGX_LIBATOMIC && \${MAKE}
$NGX_LIBATOMIC/Makefile: $NGX_MAKEFILE
cd $NGX_LIBATOMIC && ./configure
diff --git a/auto/lib/perl/make b/auto/lib/perl/make
index b4df01dd9..248be9e3f 100644
--- a/auto/lib/perl/make
+++ b/auto/lib/perl/make
@@ -12,7 +12,7 @@ $NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.so: \
$NGX_OBJS/src/http/modules/perl/Makefile
cp -p src/http/modules/perl/nginx.* $NGX_OBJS/src/http/modules/perl/
- cd $NGX_OBJS/src/http/modules/perl && make
+ cd $NGX_OBJS/src/http/modules/perl && \${MAKE}
rm -rf $NGX_OBJS/install_perl
diff --git a/configure b/configure
index 45ea15473..d7d8189af 100755
--- a/configure
+++ b/configure
@@ -4,6 +4,9 @@
# Copyright (C) Nginx, Inc.
+LC_ALL=C
+export LC_ALL
+
. auto/options
. auto/init
. auto/sources
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 8d626b52a..c807c9a12 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1002002
-#define NGINX_VERSION "1.2.2"
+#define nginx_version 1002003
+#define NGINX_VERSION "1.2.3"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 892fa4719..0aa659cd8 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -282,24 +282,16 @@ ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last)
{
char *rv;
void *conf, **confp;
- ngx_uint_t i, multi;
+ ngx_uint_t i, found;
ngx_str_t *name;
ngx_command_t *cmd;
name = cf->args->elts;
- multi = 0;
+ found = 0;
for (i = 0; ngx_modules[i]; i++) {
- /* look up the directive in the appropriate modules */
-
- if (ngx_modules[i]->type != NGX_CONF_MODULE
- && ngx_modules[i]->type != cf->module_type)
- {
- continue;
- }
-
cmd = ngx_modules[i]->commands;
if (cmd == NULL) {
continue;
@@ -315,16 +307,18 @@ ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last)
continue;
}
+ found = 1;
+
+ if (ngx_modules[i]->type != NGX_CONF_MODULE
+ && ngx_modules[i]->type != cf->module_type)
+ {
+ continue;
+ }
/* is the directive's location right ? */
if (!(cmd->type & cf->cmd_type)) {
- if (cmd->type & NGX_CONF_MULTI) {
- multi = 1;
- continue;
- }
-
- goto not_allowed;
+ continue;
}
if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) {
@@ -408,17 +402,16 @@ ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last)
}
}
- if (multi == 0) {
+ if (found) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "unknown directive \"%s\"", name->data);
+ "\"%s\" directive is not allowed here", name->data);
return NGX_ERROR;
}
-not_allowed:
-
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"%s\" directive is not allowed here", name->data);
+ "unknown directive \"%s\"", name->data);
+
return NGX_ERROR;
invalid:
@@ -1448,12 +1441,16 @@ ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
+#if 0
+
char *
ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
return "unsupported on this platform";
}
+#endif
+
char *
ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data)
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 4b87f1aad..41bacaa98 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -45,7 +45,7 @@
#define NGX_CONF_ANY 0x00000400
#define NGX_CONF_1MORE 0x00000800
#define NGX_CONF_2MORE 0x00001000
-#define NGX_CONF_MULTI 0x00002000
+#define NGX_CONF_MULTI 0x00000000 /* compatibility */
#define NGX_DIRECT_CONF 0x00010000
diff --git a/src/core/ngx_crypt.c b/src/core/ngx_crypt.c
index 9564c3618..365f9c82a 100644
--- a/src/core/ngx_crypt.c
+++ b/src/core/ngx_crypt.c
@@ -6,6 +6,7 @@
#include <ngx_config.h>
#include <ngx_core.h>
+#include <ngx_crypt.h>
#include <ngx_md5.h>
#if (NGX_HAVE_SHA1)
#include <ngx_sha1.h>
diff --git a/src/core/ngx_shmtx.c b/src/core/ngx_shmtx.c
index 085294a91..6cf7af58a 100644
--- a/src/core/ngx_shmtx.c
+++ b/src/core/ngx_shmtx.c
@@ -44,7 +44,7 @@ ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr, u_char *name)
void
-ngx_shmtx_destory(ngx_shmtx_t *mtx)
+ngx_shmtx_destroy(ngx_shmtx_t *mtx)
{
#if (NGX_HAVE_POSIX_SEM)
@@ -208,7 +208,7 @@ ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr, u_char *name)
return NGX_OK;
}
- ngx_shmtx_destory(mtx);
+ ngx_shmtx_destroy(mtx);
}
mtx->fd = ngx_open_file(name, NGX_FILE_RDWR, NGX_FILE_CREATE_OR_OPEN,
@@ -232,7 +232,7 @@ ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr, u_char *name)
void
-ngx_shmtx_destory(ngx_shmtx_t *mtx)
+ngx_shmtx_destroy(ngx_shmtx_t *mtx)
{
if (ngx_close_file(mtx->fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_errno,
diff --git a/src/core/ngx_shmtx.h b/src/core/ngx_shmtx.h
index 830b6f5b1..91e11bebb 100644
--- a/src/core/ngx_shmtx.h
+++ b/src/core/ngx_shmtx.h
@@ -39,7 +39,7 @@ typedef struct {
ngx_int_t ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr,
u_char *name);
-void ngx_shmtx_destory(ngx_shmtx_t *mtx);
+void ngx_shmtx_destroy(ngx_shmtx_t *mtx);
ngx_uint_t ngx_shmtx_trylock(ngx_shmtx_t *mtx);
void ngx_shmtx_lock(ngx_shmtx_t *mtx);
void ngx_shmtx_unlock(ngx_shmtx_t *mtx);
diff --git a/src/core/ngx_slab.c b/src/core/ngx_slab.c
index 3d5660377..782792d79 100644
--- a/src/core/ngx_slab.c
+++ b/src/core/ngx_slab.c
@@ -45,9 +45,7 @@
#define ngx_slab_junk(p, size) ngx_memset(p, 0xA5, size)
-#else
-
-#if (NGX_HAVE_DEBUG_MALLOC)
+#elif (NGX_HAVE_DEBUG_MALLOC)
#define ngx_slab_junk(p, size) \
if (ngx_debug_malloc) ngx_memset(p, 0xA5, size)
@@ -58,8 +56,6 @@
#endif
-#endif
-
static ngx_slab_page_t *ngx_slab_alloc_pages(ngx_slab_pool_t *pool,
ngx_uint_t pages);
static void ngx_slab_free_pages(ngx_slab_pool_t *pool, ngx_slab_page_t *page,
diff --git a/src/event/modules/ngx_epoll_module.c b/src/event/modules/ngx_epoll_module.c
index a73394906..ee77d8e4a 100644
--- a/src/event/modules/ngx_epoll_module.c
+++ b/src/event/modules/ngx_epoll_module.c
@@ -44,16 +44,25 @@ struct epoll_event {
epoll_data_t data;
};
+
+int epoll_create(int size);
+
int epoll_create(int size)
{
return -1;
}
+
+int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
+
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
{
return -1;
}
+
+int epoll_wait(int epfd, struct epoll_event *events, int nevents, int timeout);
+
int epoll_wait(int epfd, struct epoll_event *events, int nevents, int timeout)
{
return -1;
@@ -76,11 +85,6 @@ struct io_event {
};
-int eventfd(u_int initval)
-{
- return -1;
-}
-
#endif
#endif
diff --git a/src/event/modules/ngx_eventport_module.c b/src/event/modules/ngx_eventport_module.c
index bbcd6dd6b..d6dcb0bed 100644
--- a/src/event/modules/ngx_eventport_module.c
+++ b/src/event/modules/ngx_eventport_module.c
@@ -15,6 +15,12 @@
#define ushort_t u_short
#define uint_t u_int
+#ifndef CLOCK_REALTIME
+#define CLOCK_REALTIME 0
+typedef int clockid_t;
+typedef void * timer_t;
+#endif
+
/* Solaris declarations */
#define PORT_SOURCE_AIO 1
@@ -24,7 +30,9 @@
#define PORT_SOURCE_ALERT 5
#define PORT_SOURCE_MQ 6
+#ifndef ETIME
#define ETIME 64
+#endif
#define SIGEV_PORT 4
@@ -50,39 +58,62 @@ typedef struct itimerspec { /* definition per POSIX.4 */
#endif
+int port_create(void);
+
int port_create(void)
{
return -1;
}
+
+int port_associate(int port, int source, uintptr_t object, int events,
+ void *user);
+
int port_associate(int port, int source, uintptr_t object, int events,
void *user)
{
return -1;
}
+
+int port_dissociate(int port, int source, uintptr_t object);
+
int port_dissociate(int port, int source, uintptr_t object)
{
return -1;
}
+
+int port_getn(int port, port_event_t list[], uint_t max, uint_t *nget,
+ struct timespec *timeout);
+
int port_getn(int port, port_event_t list[], uint_t max, uint_t *nget,
struct timespec *timeout)
{
return -1;
}
+
+int timer_create(clockid_t clock_id, struct sigevent *evp, timer_t *timerid);
+
int timer_create(clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
{
return -1;
}
+
+int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
+ struct itimerspec *ovalue);
+
int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
struct itimerspec *ovalue)
{
return -1;
}
+
+int timer_delete(timer_t timerid);
+
int timer_delete(timer_t timerid)
{
return -1;
diff --git a/src/event/modules/ngx_rtsig_module.c b/src/event/modules/ngx_rtsig_module.c
index 2f0f9970f..b36230c76 100644
--- a/src/event/modules/ngx_rtsig_module.c
+++ b/src/event/modules/ngx_rtsig_module.c
@@ -12,6 +12,13 @@
#if (NGX_TEST_BUILD_RTSIG)
+#if (NGX_DARWIN)
+
+#define SIGRTMIN 33
+#define si_fd __pad[0]
+
+#else
+
#ifdef SIGRTMIN
#define si_fd _reason.__spare__.__spare2__[0]
#else
@@ -19,11 +26,16 @@
#define si_fd __spare__[0]
#endif
+#endif
+
#define F_SETSIG 10
#define KERN_RTSIGNR 30
#define KERN_RTSIGMAX 31
int sigtimedwait(const sigset_t *set, siginfo_t *info,
+ const struct timespec *timeout);
+
+int sigtimedwait(const sigset_t *set, siginfo_t *info,
const struct timespec *timeout)
{
return -1;
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
index c584dd87d..600a43394 100644
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -567,7 +567,7 @@ ngx_event_module_init(ngx_cycle_t *cycle)
#if !(NGX_WIN32)
-void
+static void
ngx_timer_signal_handler(int signo)
{
ngx_event_timer_alarm = 1;
@@ -1062,50 +1062,91 @@ ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
#if (NGX_DEBUG)
ngx_event_conf_t *ecf = conf;
- ngx_int_t rc;
- ngx_str_t *value;
- struct hostent *h;
- ngx_cidr_t *cidr;
+ ngx_int_t rc;
+ ngx_str_t *value;
+ ngx_url_t u;
+ ngx_cidr_t c, *cidr;
+ ngx_uint_t i;
+ struct sockaddr_in *sin;
+#if (NGX_HAVE_INET6)
+ struct sockaddr_in6 *sin6;
+#endif
value = cf->args->elts;
- cidr = ngx_array_push(&ecf->debug_connection);
- if (cidr == NULL) {
- return NGX_CONF_ERROR;
- }
-
#if (NGX_HAVE_UNIX_DOMAIN)
if (ngx_strcmp(value[1].data, "unix:") == 0) {
- cidr->family = AF_UNIX;
- return NGX_CONF_OK;
+ cidr = ngx_array_push(&ecf->debug_connection);
+ if (cidr == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ cidr->family = AF_UNIX;
+ return NGX_CONF_OK;
}
#endif
- rc = ngx_ptocidr(&value[1], cidr);
+ rc = ngx_ptocidr(&value[1], &c);
- if (rc == NGX_DONE) {
- ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
- "low address bits of %V are meaningless", &value[1]);
- return NGX_CONF_OK;
- }
+ if (rc != NGX_ERROR) {
+ if (rc == NGX_DONE) {
+ ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
+ "low address bits of %V are meaningless",
+ &value[1]);
+ }
+
+ cidr = ngx_array_push(&ecf->debug_connection);
+ if (cidr == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ *cidr = c;
- if (rc == NGX_OK) {
return NGX_CONF_OK;
}
- h = gethostbyname((char *) value[1].data);
+ ngx_memzero(&u, sizeof(ngx_url_t));
+ u.host = value[1];
+
+ if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
+ if (u.err) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "%s in debug_connection \"%V\"",
+ u.err, &u.host);
+ }
- if (h == NULL || h->h_addr_list[0] == NULL) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "host \"%s\" not found", value[1].data);
return NGX_CONF_ERROR;
}
- cidr->family = AF_INET;
- cidr->u.in.mask = 0xffffffff;
- cidr->u.in.addr = *(in_addr_t *)(h->h_addr_list[0]);
+ cidr = ngx_array_push_n(&ecf->debug_connection, u.naddrs);
+ if (cidr == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ ngx_memzero(cidr, u.naddrs * sizeof(ngx_cidr_t));
+
+ for (i = 0; i < u.naddrs; i++) {
+ cidr[i].family = u.addrs[i].sockaddr->sa_family;
+
+ switch (cidr[i].family) {
+
+#if (NGX_HAVE_INET6)
+ case AF_INET6:
+ sin6 = (struct sockaddr_in6 *) u.addrs[i].sockaddr;
+ cidr[i].u.in6.addr = sin6->sin6_addr;
+ ngx_memset(cidr[i].u.in6.mask.s6_addr, 0xff, 16);
+ break;
+#endif
+
+ default: /* AF_INET */
+ sin = (struct sockaddr_in *) u.addrs[i].sockaddr;
+ cidr[i].u.in.addr = sin->sin_addr.s_addr;
+ cidr[i].u.in.mask = 0xffffffff;
+ break;
+ }
+ }
#else
diff --git a/src/http/modules/ngx_http_limit_conn_module.c b/src/http/modules/ngx_http_limit_conn_module.c
index c23c046ed..106da7a53 100644
--- a/src/http/modules/ngx_http_limit_conn_module.c
+++ b/src/http/modules/ngx_http_limit_conn_module.c
@@ -238,7 +238,7 @@ ngx_http_limit_conn_handler(ngx_http_request_t *r)
}
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "limit zone: %08XD %d", node->key, lc->conn);
+ "limit conn: %08XD %d", node->key, lc->conn);
ngx_shmtx_unlock(&shpool->mutex);
@@ -358,7 +358,7 @@ ngx_http_limit_conn_cleanup(void *data)
ngx_shmtx_lock(&shpool->mutex);
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, lccln->shm_zone->shm.log, 0,
- "limit zone cleanup: %08XD %d", node->key, lc->conn);
+ "limit conn cleanup: %08XD %d", node->key, lc->conn);
lc->conn--;
diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c
index edb145992..5b9c79986 100644
--- a/src/http/modules/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -218,7 +218,7 @@ static ngx_http_log_var_t ngx_http_log_vars[] = {
};
-ngx_int_t
+static ngx_int_t
ngx_http_log_handler(ngx_http_request_t *r)
{
u_char *line, *p;
diff --git a/src/http/modules/ngx_http_map_module.c b/src/http/modules/ngx_http_map_module.c
index 2fe925f1c..e8a4ab4cc 100644
--- a/src/http/modules/ngx_http_map_module.c
+++ b/src/http/modules/ngx_http_map_module.c
@@ -110,7 +110,6 @@ ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
{
ngx_http_map_ctx_t *map = (ngx_http_map_ctx_t *) data;
- size_t len;
ngx_str_t val;
ngx_http_variable_value_t *value;
@@ -121,10 +120,8 @@ ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
return NGX_ERROR;
}
- len = val.len;
-
- if (len && map->hostnames && val.data[len - 1] == '.') {
- len--;
+ if (map->hostnames && val.len > 0 && val.data[val.len - 1] == '.') {
+ val.len--;
}
value = ngx_http_map_find(r, &map->map, &val);
@@ -281,6 +278,8 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
map->default_value = ctx.default_value ? ctx.default_value:
&ngx_http_variable_null_value;
+ map->hostnames = ctx.hostnames;
+
hash.key = ngx_hash_key_lc;
hash.max_size = mcf->hash_max_size;
hash.bucket_size = mcf->hash_bucket_size;
diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c
index 50e68b21b..21156ae1a 100644
--- a/src/http/modules/ngx_http_upstream_least_conn_module.c
+++ b/src/http/modules/ngx_http_upstream_least_conn_module.c
@@ -81,7 +81,7 @@ ngx_module_t ngx_http_upstream_least_conn_module = {
};
-ngx_int_t
+static ngx_int_t
ngx_http_upstream_init_least_conn(ngx_conf_t *cf,
ngx_http_upstream_srv_conf_t *us)
{
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index b1d60e913..7f825475a 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -50,7 +50,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '1.2.2';
+our $VERSION = '1.2.3';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 3e077fb95..f1f8a48e0 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -1613,6 +1613,11 @@ ngx_http_cmp_conf_addrs(const void *one, const void *two)
return 1;
}
+ if (second->opt.wildcard) {
+ /* a wildcard address must be the last resort, shift it to the end */
+ return -1;
+ }
+
if (first->opt.bind && !second->opt.bind) {
/* shift explicit bind()ed addresses to the start */
return -1;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 5bb01d9ea..be1f1e3b5 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -222,7 +222,7 @@ static ngx_command_t ngx_http_core_commands[] = {
NULL },
{ ngx_string("server"),
- NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_MULTI|NGX_CONF_NOARGS,
+ NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
ngx_http_core_server,
0,
0,
@@ -2588,6 +2588,7 @@ ngx_http_named_location(ngx_http_request_t *r, ngx_str_t *name)
r->internal = 1;
r->content_handler = NULL;
+ r->uri_changed = 0;
r->loc_conf = (*clcfp)->loc_conf;
/* clear the modules contexts */
diff --git a/src/http/ngx_http_parse_time.c b/src/http/ngx_http_parse_time.c
index 3801df2fd..985af3172 100644
--- a/src/http/ngx_http_parse_time.c
+++ b/src/http/ngx_http_parse_time.c
@@ -7,6 +7,7 @@
#include <ngx_config.h>
#include <ngx_core.h>
+#include <ngx_http.h>
static ngx_uint_t mday[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index e0ae5241f..c104db1c0 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -747,6 +747,7 @@ ngx_http_process_request_line(ngx_event_t *rev)
r->request_line.len = r->request_end - r->request_start;
r->request_line.data = r->request_start;
+ r->request_length = r->header_in->pos - r->request_start;
if (r->args_start) {
@@ -1056,6 +1057,8 @@ ngx_http_process_request_headers(ngx_event_t *rev)
if (rc == NGX_OK) {
+ r->request_length += r->header_in->pos - r->header_name_start;
+
if (r->invalid_header && cscf->ignore_invalid_headers) {
/* there was error while a header line parsing */
@@ -1119,7 +1122,7 @@ ngx_http_process_request_headers(ngx_event_t *rev)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http header done");
- r->request_length += r->header_in->pos - r->header_in->start;
+ r->request_length += r->header_in->pos - r->header_name_start;
r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE;
@@ -1226,8 +1229,6 @@ ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
/* the client fills up the buffer with "\r\n" */
- r->request_length += r->header_in->end - r->header_in->start;
-
r->header_in->pos = r->header_in->start;
r->header_in->last = r->header_in->start;
@@ -1287,8 +1288,6 @@ ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
* to relocate the parser header pointers
*/
- r->request_length += r->header_in->end - r->header_in->start;
-
r->header_in = b;
return NGX_OK;
@@ -1297,8 +1296,6 @@ ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http large header copy: %d", r->header_in->pos - old);
- r->request_length += old - r->header_in->start;
-
new = b->start;
ngx_memcpy(new, old, r->header_in->pos - old);
@@ -1826,7 +1823,7 @@ ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
#endif
- return NGX_OK;
+ return NGX_DECLINED;
found:
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 3730a2026..6c34f39d6 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -4422,18 +4422,18 @@ ngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags)
uscf->servers = ngx_array_create(cf->pool, 1,
sizeof(ngx_http_upstream_server_t));
if (uscf->servers == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
us = ngx_array_push(uscf->servers);
if (us == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
ngx_memzero(us, sizeof(ngx_http_upstream_server_t));
us->addrs = u->addrs;
- us->naddrs = u->naddrs;
+ us->naddrs = 1;
}
uscfp = ngx_array_push(&umcf->upstreams);
@@ -4541,6 +4541,9 @@ ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf,
if (conf->hide_headers == NGX_CONF_UNSET_PTR
&& conf->pass_headers == NGX_CONF_UNSET_PTR)
{
+ conf->hide_headers = prev->hide_headers;
+ conf->pass_headers = prev->pass_headers;
+
conf->hide_headers_hash = prev->hide_headers_hash;
if (conf->hide_headers_hash.buckets
@@ -4552,9 +4555,6 @@ ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf,
return NGX_OK;
}
- conf->hide_headers = prev->hide_headers;
- conf->pass_headers = prev->pass_headers;
-
} else {
if (conf->hide_headers == NGX_CONF_UNSET_PTR) {
conf->hide_headers = prev->hide_headers;
diff --git a/src/mail/ngx_mail_parse.c b/src/mail/ngx_mail_parse.c
index ae0f7e39a..eb16d5b4f 100644
--- a/src/mail/ngx_mail_parse.c
+++ b/src/mail/ngx_mail_parse.c
@@ -9,6 +9,9 @@
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_mail.h>
+#include <ngx_mail_pop3_module.h>
+#include <ngx_mail_imap_module.h>
+#include <ngx_mail_smtp_module.h>
ngx_int_t
diff --git a/src/misc/ngx_cpp_test_module.cpp b/src/misc/ngx_cpp_test_module.cpp
index 8f87dcdad..3cbc0a811 100644
--- a/src/misc/ngx_cpp_test_module.cpp
+++ b/src/misc/ngx_cpp_test_module.cpp
@@ -20,6 +20,8 @@ extern "C" {
// #include <string>
+void ngx_cpp_test_handler(void *data);
+
void
ngx_cpp_test_handler(void *data)
{
diff --git a/src/os/unix/ngx_atomic.h b/src/os/unix/ngx_atomic.h
index 104ac376a..417cd86ff 100644
--- a/src/os/unix/ngx_atomic.h
+++ b/src/os/unix/ngx_atomic.h
@@ -48,7 +48,9 @@ typedef volatile ngx_atomic_uint_t ngx_atomic_t;
#include <libkern/OSAtomic.h>
/* "bool" conflicts with perl's CORE/handy.h */
+#if 0
#undef bool
+#endif
#define NGX_HAVE_ATOMIC_OPS 1
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index ca5458104..2dfa1b7a1 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -413,9 +413,7 @@ ngx_trylock_fd(ngx_fd_t fd)
{
struct flock fl;
- fl.l_start = 0;
- fl.l_len = 0;
- fl.l_pid = 0;
+ ngx_memzero(&fl, sizeof(struct flock));
fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET;
@@ -432,9 +430,7 @@ ngx_lock_fd(ngx_fd_t fd)
{
struct flock fl;
- fl.l_start = 0;
- fl.l_len = 0;
- fl.l_pid = 0;
+ ngx_memzero(&fl, sizeof(struct flock));
fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET;
@@ -451,9 +447,7 @@ ngx_unlock_fd(ngx_fd_t fd)
{
struct flock fl;
- fl.l_start = 0;
- fl.l_len = 0;
- fl.l_pid = 0;
+ ngx_memzero(&fl, sizeof(struct flock));
fl.l_type = F_UNLCK;
fl.l_whence = SEEK_SET;
diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c
index eea65a903..58e6f7614 100644
--- a/src/os/unix/ngx_posix_init.c
+++ b/src/os/unix/ngx_posix_init.c
@@ -98,6 +98,8 @@ ngx_os_status(ngx_log_t *log)
}
+#if 0
+
ngx_int_t
ngx_posix_post_conf_init(ngx_log_t *log)
{
@@ -122,3 +124,5 @@ ngx_posix_post_conf_init(ngx_log_t *log)
return NGX_OK;
}
+
+#endif
diff --git a/src/os/unix/ngx_solaris_sendfilev_chain.c b/src/os/unix/ngx_solaris_sendfilev_chain.c
index f800c15f5..520eaaab4 100644
--- a/src/os/unix/ngx_solaris_sendfilev_chain.c
+++ b/src/os/unix/ngx_solaris_sendfilev_chain.c
@@ -29,6 +29,9 @@ static ssize_t sendfilev(int fd, const struct sendfilevec *vec,
return -1;
}
+ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in,
+ off_t limit);
+
#endif