changeset 682:5cb5db9975ba NGINX_1_3_4

nginx 1.3.4 *) Change: the "ipv6only" parameter is now turned on by default for listening IPv6 sockets. *) 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.
author Igor Sysoev <http://sysoev.ru>
date Tue, 31 Jul 2012 00:00:00 +0400
parents 625501f84a6b
children 28cc2a208803
files CHANGES CHANGES.ru LICENSE auto/cc/clang auto/cc/conf auto/cc/gcc auto/cc/name configure src/core/nginx.h src/core/ngx_conf_file.c src/core/ngx_conf_file.h src/core/ngx_connection.c src/core/ngx_connection.h src/core/ngx_crypt.c src/core/ngx_slab.c src/event/modules/ngx_epoll_module.c src/event/modules/ngx_eventport_module.c src/event/modules/ngx_rtsig_module.c src/event/ngx_event.c src/http/modules/ngx_http_limit_conn_module.c src/http/modules/ngx_http_log_module.c src/http/modules/ngx_http_upstream_least_conn_module.c src/http/modules/perl/nginx.pm src/http/ngx_http.c src/http/ngx_http_core_module.c src/http/ngx_http_core_module.h src/http/ngx_http_parse_time.c src/http/ngx_http_request.c src/http/ngx_http_upstream.c src/mail/ngx_mail.h src/mail/ngx_mail_core_module.c src/mail/ngx_mail_parse.c src/misc/ngx_cpp_test_module.cpp src/os/unix/ngx_atomic.h src/os/unix/ngx_posix_init.c src/os/unix/ngx_solaris_sendfilev_chain.c
diffstat 36 files changed, 355 insertions(+), 112 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,24 @@
 
+Changes with nginx 1.3.4                                         31 Jul 2012
+
+    *) Change: the "ipv6only" parameter is now turned on by default for
+       listening IPv6 sockets.
+
+    *) 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.
+
+
 Changes with nginx 1.3.3                                         10 Jul 2012
 
     *) Feature: entity tags support and the "etag" directive.
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,24 @@
 
+Изменения в nginx 1.3.4                                           31.07.2012
+
+    *) Изменение: теперь на слушающих IPv6-сокетах параметр ipv6only включён
+       по умолчанию.
+
+    *) Добавление: поддержка компилятора 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 могли
+       наследоваться некорректно.
+
+
 Изменения в nginx 1.3.3                                           10.07.2012
 
     *) Добавление: поддержка entity tags и директива etag.
--- 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)
new file mode 100644
--- /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
--- 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
 
--- 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"
     ;;
--- 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
--- a/configure
+++ b/configure
@@ -4,6 +4,9 @@
 # Copyright (C) Nginx, Inc.
 
 
+LC_ALL=C
+export LC_ALL
+
 . auto/options
 . auto/init
 . auto/sources
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -9,8 +9,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version      1003003
-#define NGINX_VERSION      "1.3.3"
+#define nginx_version      1003004
+#define NGINX_VERSION      "1.3.4"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- 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
 {
     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
                 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
         }
     }
 
-    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,
+                       "unknown directive \"%s\"", name->data);
 
-    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                       "\"%s\" directive is not allowed here", name->data);
     return NGX_ERROR;
 
 invalid:
@@ -1448,12 +1441,16 @@ ngx_conf_set_bitmask_slot(ngx_conf_t *cf
 }
 
 
+#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)
--- 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
 
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -336,10 +336,10 @@ ngx_open_listening_sockets(ngx_cycle_t *
 
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
 
-            if (ls[i].sockaddr->sa_family == AF_INET6 && ls[i].ipv6only) {
+            if (ls[i].sockaddr->sa_family == AF_INET6) {
                 int  ipv6only;
 
-                ipv6only = (ls[i].ipv6only == 1);
+                ipv6only = ls[i].ipv6only;
 
                 if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
                                (const void *) &ipv6only, sizeof(int))
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -64,7 +64,7 @@ struct ngx_listening_s {
     unsigned            addr_ntop:1;
 
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
-    unsigned            ipv6only:2;
+    unsigned            ipv6only:1;
 #endif
     unsigned            keepalive:2;
 
--- 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>
--- 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,
--- 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
 
--- 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 {     /* defin
 
 #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;
--- 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;
--- 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 *c
 #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]);
+        }
 
-    if (rc == NGX_OK) {
+        cidr = ngx_array_push(&ecf->debug_connection);
+        if (cidr == NULL) {
+            return NGX_CONF_ERROR;
+        }
+
+        *cidr = c;
+
         return NGX_CONF_OK;
     }
 
-    h = gethostbyname((char *) value[1].data);
+    ngx_memzero(&u, sizeof(ngx_url_t));
+    u.host = value[1];
 
-    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);
+    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);
+        }
+
+        return NGX_CONF_ERROR;
+    }
+
+    cidr = ngx_array_push_n(&ecf->debug_connection, u.naddrs);
+    if (cidr == NULL) {
         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]);
+    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
 
--- 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_req
         }
 
         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--;
 
--- 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_
 };
 
 
-ngx_int_t
+static ngx_int_t
 ngx_http_log_handler(ngx_http_request_t *r)
 {
     u_char                   *line, *p;
--- 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_co
 };
 
 
-ngx_int_t
+static ngx_int_t
 ngx_http_upstream_init_least_conn(ngx_conf_t *cf,
     ngx_http_upstream_srv_conf_t *us)
 {
--- 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.3.3';
+our $VERSION = '1.3.4';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -1613,6 +1613,11 @@ ngx_http_cmp_conf_addrs(const void *one,
         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;
--- 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_comm
       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,
@@ -3912,6 +3912,9 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx
     lsopt.setfib = -1;
 #endif
     lsopt.wildcard = u.wildcard;
+#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
+    lsopt.ipv6only = 1;
+#endif
 
     (void) ngx_sock_ntop(&lsopt.u.sockaddr, lsopt.addr,
                          NGX_SOCKADDR_STRLEN, 1);
@@ -4031,7 +4034,7 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx
                     lsopt.ipv6only = 1;
 
                 } else if (ngx_strcmp(&value[n].data[10], "ff") == 0) {
-                    lsopt.ipv6only = 2;
+                    lsopt.ipv6only = 0;
 
                 } else {
                     ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -76,7 +76,7 @@ typedef struct {
     unsigned                   ssl:1;
 #endif
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
-    unsigned                   ipv6only:2;
+    unsigned                   ipv6only:1;
 #endif
     unsigned                   so_keepalive:2;
 
--- 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 };
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1831,7 +1831,7 @@ ngx_http_find_virtual_server(ngx_http_re
 
 #endif
 
-    return NGX_OK;
+    return NGX_DECLINED;
 
 found:
 
--- 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, ng
         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_
     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_
             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;
--- a/src/mail/ngx_mail.h
+++ b/src/mail/ngx_mail.h
@@ -39,7 +39,7 @@ typedef struct {
     unsigned                ssl:1;
 #endif
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
-    unsigned                ipv6only:2;
+    unsigned                ipv6only:1;
 #endif
     unsigned                so_keepalive:2;
 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
@@ -100,7 +100,7 @@ typedef struct {
     unsigned                ssl:1;
 #endif
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
-    unsigned                ipv6only:2;
+    unsigned                ipv6only:1;
 #endif
     unsigned                so_keepalive:2;
 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
--- a/src/mail/ngx_mail_core_module.c
+++ b/src/mail/ngx_mail_core_module.c
@@ -374,6 +374,10 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx
     ls->wildcard = u.wildcard;
     ls->ctx = cf->ctx;
 
+#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
+    ls->ipv6only = 1;
+#endif
+
     for (m = 0; ngx_modules[m]; m++) {
         if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
             continue;
@@ -413,7 +417,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx
                     ls->ipv6only = 1;
 
                 } else if (ngx_strcmp(&value[i].data[10], "ff") == 0) {
-                    ls->ipv6only = 2;
+                    ls->ipv6only = 0;
 
                 } else {
                     ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
--- 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
--- 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)
 {
--- 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_
 #include <libkern/OSAtomic.h>
 
 /* "bool" conflicts with perl's CORE/handy.h */
+#if 0
 #undef bool
+#endif
 
 
 #define NGX_HAVE_ATOMIC_OPS  1
--- 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
--- 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 s
     return -1;
 }
 
+ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in,
+    off_t limit);
+
 #endif