diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2012-08-21 11:31:53 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2012-08-21 11:31:53 +0000 |
commit | 182ed170e6cc6db9b888273e87a8975267743ae9 (patch) | |
tree | c0044da3e697e090bad2813b97a94f87b7526e97 /usr.sbin | |
parent | 848ff7afbead08e1d91d7812b2f24f64cab81ada (diff) |
update to nginx-1.2.3
Diffstat (limited to 'usr.sbin')
38 files changed, 271 insertions, 134 deletions
diff --git a/usr.sbin/nginx/CHANGES b/usr.sbin/nginx/CHANGES index f113116b2a3..1bfebf38d89 100644 --- a/usr.sbin/nginx/CHANGES +++ b/usr.sbin/nginx/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/usr.sbin/nginx/CHANGES.ru b/usr.sbin/nginx/CHANGES.ru index 5ae0817b539..d85b2f9297d 100644 --- a/usr.sbin/nginx/CHANGES.ru +++ b/usr.sbin/nginx/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/usr.sbin/nginx/LICENSE b/usr.sbin/nginx/LICENSE index 1bfc054da93..c78be7e376f 100644 --- a/usr.sbin/nginx/LICENSE +++ b/usr.sbin/nginx/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/usr.sbin/nginx/auto/cc/conf b/usr.sbin/nginx/auto/cc/conf index c9118f2fd6f..8027b980502 100644 --- a/usr.sbin/nginx/auto/cc/conf +++ b/usr.sbin/nginx/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/usr.sbin/nginx/auto/cc/gcc b/usr.sbin/nginx/auto/cc/gcc index 7033ce8f70c..eb4bf92bd4f 100644 --- a/usr.sbin/nginx/auto/cc/gcc +++ b/usr.sbin/nginx/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/usr.sbin/nginx/auto/cc/name b/usr.sbin/nginx/auto/cc/name index 7860c69e20f..7a5656c6475 100644 --- a/usr.sbin/nginx/auto/cc/name +++ b/usr.sbin/nginx/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/usr.sbin/nginx/auto/install b/usr.sbin/nginx/auto/install index 9a160fbc2ac..7c7dc6bbc06 100644 --- a/usr.sbin/nginx/auto/install +++ b/usr.sbin/nginx/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/usr.sbin/nginx/auto/lib/libatomic/make b/usr.sbin/nginx/auto/lib/libatomic/make index b84267b63e4..f3cd83281af 100644 --- a/usr.sbin/nginx/auto/lib/libatomic/make +++ b/usr.sbin/nginx/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/usr.sbin/nginx/auto/lib/perl/make b/usr.sbin/nginx/auto/lib/perl/make index b4df01dd90c..248be9e3f02 100644 --- a/usr.sbin/nginx/auto/lib/perl/make +++ b/usr.sbin/nginx/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/usr.sbin/nginx/configure b/usr.sbin/nginx/configure index 45ea15473a7..d7d8189af93 100644 --- a/usr.sbin/nginx/configure +++ b/usr.sbin/nginx/configure @@ -4,6 +4,9 @@ # Copyright (C) Nginx, Inc. +LC_ALL=C +export LC_ALL + . auto/options . auto/init . auto/sources diff --git a/usr.sbin/nginx/src/core/nginx.h b/usr.sbin/nginx/src/core/nginx.h index 8d626b52a29..c807c9a1200 100644 --- a/usr.sbin/nginx/src/core/nginx.h +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/core/ngx_conf_file.c b/usr.sbin/nginx/src/core/ngx_conf_file.c index 892fa4719a8..0aa659cd8bb 100644 --- a/usr.sbin/nginx/src/core/ngx_conf_file.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/core/ngx_conf_file.h b/usr.sbin/nginx/src/core/ngx_conf_file.h index 4b87f1aad48..41bacaa9875 100644 --- a/usr.sbin/nginx/src/core/ngx_conf_file.h +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/core/ngx_crypt.c b/usr.sbin/nginx/src/core/ngx_crypt.c index 9564c3618cb..365f9c82a8e 100644 --- a/usr.sbin/nginx/src/core/ngx_crypt.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/core/ngx_shmtx.c b/usr.sbin/nginx/src/core/ngx_shmtx.c index 085294a914a..6cf7af58ae9 100644 --- a/usr.sbin/nginx/src/core/ngx_shmtx.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/core/ngx_shmtx.h b/usr.sbin/nginx/src/core/ngx_shmtx.h index 830b6f5b198..91e11bebbf4 100644 --- a/usr.sbin/nginx/src/core/ngx_shmtx.h +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/core/ngx_slab.c b/usr.sbin/nginx/src/core/ngx_slab.c index 3d566037708..782792d79ef 100644 --- a/usr.sbin/nginx/src/core/ngx_slab.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/event/modules/ngx_epoll_module.c b/usr.sbin/nginx/src/event/modules/ngx_epoll_module.c index a73394906d1..ee77d8e4aff 100644 --- a/usr.sbin/nginx/src/event/modules/ngx_epoll_module.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/event/modules/ngx_eventport_module.c b/usr.sbin/nginx/src/event/modules/ngx_eventport_module.c index bbcd6dd6bae..d6dcb0bedf4 100644 --- a/usr.sbin/nginx/src/event/modules/ngx_eventport_module.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/event/modules/ngx_rtsig_module.c b/usr.sbin/nginx/src/event/modules/ngx_rtsig_module.c index 2f0f9970f39..b36230c7650 100644 --- a/usr.sbin/nginx/src/event/modules/ngx_rtsig_module.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/event/ngx_event.c b/usr.sbin/nginx/src/event/ngx_event.c index c584dd87d93..600a433942f 100644 --- a/usr.sbin/nginx/src/event/ngx_event.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/http/modules/ngx_http_limit_conn_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_limit_conn_module.c index c23c046ed4d..106da7a535e 100644 --- a/usr.sbin/nginx/src/http/modules/ngx_http_limit_conn_module.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/http/modules/ngx_http_log_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_log_module.c index edb145992a6..5b9c7998696 100644 --- a/usr.sbin/nginx/src/http/modules/ngx_http_log_module.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/http/modules/ngx_http_map_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_map_module.c index 2fe925f1cc1..e8a4ab4cc18 100644 --- a/usr.sbin/nginx/src/http/modules/ngx_http_map_module.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c index 50e68b21b90..21156ae1aef 100644 --- a/usr.sbin/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/http/modules/perl/nginx.pm b/usr.sbin/nginx/src/http/modules/perl/nginx.pm index 117ffd837f6..7f825475adb 100644 --- a/usr.sbin/nginx/src/http/modules/perl/nginx.pm +++ b/usr.sbin/nginx/src/http/modules/perl/nginx.pm @@ -50,7 +50,7 @@ our @EXPORT = qw( HTTP_INSUFFICIENT_STORAGE ); -our $VERSION = '1.2.1'; +our $VERSION = '1.2.3'; require XSLoader; XSLoader::load('nginx', $VERSION); diff --git a/usr.sbin/nginx/src/http/modules/perl/nginx.xs b/usr.sbin/nginx/src/http/modules/perl/nginx.xs index ecd11ffbc07..ed974391163 100644 --- a/usr.sbin/nginx/src/http/modules/perl/nginx.xs +++ b/usr.sbin/nginx/src/http/modules/perl/nginx.xs @@ -476,7 +476,7 @@ header_out(r, key, value) } if (header->key.len == sizeof("Content-Encoding") - 1 - && ngx_strncasecmp(header->key.data, "Content-Encoding", + && ngx_strncasecmp(header->key.data, (u_char *) "Content-Encoding", sizeof("Content-Encoding") - 1) == 0) { r->headers_out.content_encoding = header; diff --git a/usr.sbin/nginx/src/http/ngx_http.c b/usr.sbin/nginx/src/http/ngx_http.c index 3e077fb95ab..f1f8a48e08f 100644 --- a/usr.sbin/nginx/src/http/ngx_http.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/http/ngx_http_core_module.c b/usr.sbin/nginx/src/http/ngx_http_core_module.c index a079795c4d7..1776d432e7c 100644 --- a/usr.sbin/nginx/src/http/ngx_http_core_module.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/http/ngx_http_parse_time.c b/usr.sbin/nginx/src/http/ngx_http_parse_time.c index 3801df2fd64..985af31725b 100644 --- a/usr.sbin/nginx/src/http/ngx_http_parse_time.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/http/ngx_http_request.c b/usr.sbin/nginx/src/http/ngx_http_request.c index e0ae5241f4e..c104db1c0c6 100644 --- a/usr.sbin/nginx/src/http/ngx_http_request.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/http/ngx_http_upstream.c b/usr.sbin/nginx/src/http/ngx_http_upstream.c index 3730a20262c..6c34f39d64f 100644 --- a/usr.sbin/nginx/src/http/ngx_http_upstream.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/mail/ngx_mail_parse.c b/usr.sbin/nginx/src/mail/ngx_mail_parse.c index ae0f7e39a92..eb16d5b4fe9 100644 --- a/usr.sbin/nginx/src/mail/ngx_mail_parse.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/misc/ngx_cpp_test_module.cpp b/usr.sbin/nginx/src/misc/ngx_cpp_test_module.cpp index 8f87dcdad60..3cbc0a8111a 100644 --- a/usr.sbin/nginx/src/misc/ngx_cpp_test_module.cpp +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/os/unix/ngx_atomic.h b/usr.sbin/nginx/src/os/unix/ngx_atomic.h index 104ac376a2c..417cd86ff29 100644 --- a/usr.sbin/nginx/src/os/unix/ngx_atomic.h +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/os/unix/ngx_files.c b/usr.sbin/nginx/src/os/unix/ngx_files.c index ca5458104e8..2dfa1b7a1ab 100644 --- a/usr.sbin/nginx/src/os/unix/ngx_files.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/os/unix/ngx_posix_init.c b/usr.sbin/nginx/src/os/unix/ngx_posix_init.c index eea65a9034e..58e6f76143b 100644 --- a/usr.sbin/nginx/src/os/unix/ngx_posix_init.c +++ b/usr.sbin/nginx/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/usr.sbin/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c b/usr.sbin/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c index f800c15f5c9..520eaaab4c7 100644 --- a/usr.sbin/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +++ b/usr.sbin/nginx/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 |