[-]
[+]
|
Changed |
nginx-1.2.changes
|
|
[-]
[+]
|
Changed |
nginx-1.2.spec
^
|
|
|
Deleted |
2.7-iis-nginx.tar.bz2
^
|
|
Added |
modsecurity-apache_2.7.0-rc3.tar.bz2
^
|
[-]
[+]
|
Deleted |
nginx-1.2.1.tar.bz2/auto/endianess
^
|
@@ -1,45 +0,0 @@
-
-# Copyright (C) Igor Sysoev
-# Copyright (C) Nginx, Inc.
-
-
-echo $ngx_n "checking for system endianess ...$ngx_c"
-echo >> $NGX_ERR
-echo "checking for system endianess" >> $NGX_ERR
-
-
-cat << END > $NGX_AUTOTEST.c
-
-int main() {
- int i = 0x11223344;
- char *p;
-
- p = (char *) &i;
- if (*p == 0x44) return 0;
- return 1;
-}
-
-END
-
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
-
-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
-
-if [ -x $NGX_AUTOTEST ]; then
- if $NGX_AUTOTEST >/dev/null 2>&1; then
- echo " little endianess"
- have=NGX_HAVE_LITTLE_ENDIAN . auto/have
- else
- echo " big endianess"
- fi
-
- rm $NGX_AUTOTEST*
-
-else
- rm $NGX_AUTOTEST*
-
- echo
- echo "$0: error: can not detect system endianess"
- exit 1
-fi
|
|
Deleted |
nginx-1.2.2.tar.bz2
^
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/CHANGES
^
|
@@ -1,4 +1,88 @@
+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
+ ignored.
+
+ *) Change: SSL compression is now disabled when using all versions of
+ OpenSSL, including ones prior to 1.0.0.
+
+ *) Feature: the "proxy_pass", "fastcgi_pass", "scgi_pass", "uwsgi_pass"
+ directives, and the "server" directive inside the "upstream" block,
+ now support IPv6 addresses.
+
+ *) Feature: the "resolver" directive now supports IPv6 addresses and an
+ optional port specification.
+
+ *) Feature: the "least_conn" directive inside the "upstream" block.
+
+ *) Feature: it is now possible to specify a weight for servers while
+ using the "ip_hash" directive.
+
+ *) Feature: it is now possible to use the "ip_hash" directive to balance
+ IPv6 clients.
+
+ *) Feature: the $status variable can now be used not only in the
+ "log_format" directive.
+
+ *) Bugfix: nginx could not be built with ngx_cpp_test_module; the bug
+ had appeared in 1.1.12.
+
+ *) Bugfix: access to variables from SSI and embedded perl module might
+ not work after reconfiguration.
+ Thanks to Yichun Zhang.
+
+ *) Bugfix: in the ngx_http_xslt_filter_module.
+ Thanks to Kuramoto Eiji.
+
+ *) Bugfix: memory leak if $geoip_org variable was used.
+ Thanks to Denis F. Latypoff.
+
+ *) Bugfix: in the "proxy_cookie_domain" and "proxy_cookie_path"
+ directives.
+
+ *) Bugfix: a segmentation fault might occur in a worker process on
+ shutdown if the "resolver" directive was used.
+
+ *) Bugfix: a segmentation fault might occur in a worker process if the
+ ngx_http_mp4_module was used.
+
+ *) Bugfix: in the ngx_http_mp4_module.
+
+ *) Bugfix: a segmentation fault might occur in a worker process if
+ conflicting wildcard server names were used.
+
+ *) Bugfix: nginx might be terminated abnormally on a SIGBUS signal on
+ ARM platform.
+
+ *) Bugfix: an alert "sendmsg() failed (9: Bad file number)" on HP-UX
+ while reconfiguration.
+
+
Changes with nginx 1.2.1 05 Jun 2012
*) Security: now nginx/Windows ignores trailing dot in URI path
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/CHANGES.ru
^
|
@@ -1,4 +1,85 @@
+Изменения в 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 теперь игнорируется.
+
+ *) Изменение: сжатие SSL теперь отключено в том числе при использовании
+ OpenSSL cтарее 1.0.0.
+
+ *) Добавление: директивы proxy_pass, fastcgi_pass, scgi_pass, uwsgi_pass
+ и директива server в блоке upstream теперь поддерживают IPv6-адреса.
+
+ *) Добавление: в директиве resolver теперь можно указывать порт и
+ задавать IPv6-адреса DNS-серверов.
+
+ *) Добавление: директива least_conn в блоке upstream.
+
+ *) Добавление: при использовании директивы ip_hash теперь можно задавать
+ веса серверов.
+
+ *) Добавление: директиву "ip_hash" теперь можно использовать для
+ балансировки IPv6 клиентов.
+
+ *) Добавление: переменную $status теперь можно использовать не только в
+ директиве log_format.
+
+ *) Исправление: nginx не собирался с модулем ngx_cpp_test_module; ошибка
+ появилась в 1.1.12.
+
+ *) Исправление: доступ к переменным из SSI и встроенного перла мог не
+ работать после переконфигурации.
+ Спасибо Yichun Zhang.
+
+ *) Исправление: в модуле ngx_http_xslt_filter_module.
+ Спасибо Kuramoto Eiji.
+
+ *) Исправление: утечки памяти при использовании переменной $geoip_org.
+ Спасибо Денису Латыпову.
+
+ *) Исправление: в директивах proxy_cookie_domain и proxy_cookie_path.
+
+ *) Исправление: при завершении рабочего процесса мог произойти
+ segmentation fault, если использовалась директива resolver.
+
+ *) Исправление: в рабочем процессе мог произойти segmentation fault,
+ если использовался модуль ngx_http_mp4_module.
+
+ *) Исправление: в модуле ngx_http_mp4_module.
+
+ *) Исправление: в рабочем процессе мог произойти segmentation fault,
+ если использовались конфликтующие имена серверов с масками.
+
+ *) Исправление: на платформе ARM nginx мог аварийно завершаться по
+ сигналу SIGBUS.
+
+ *) Исправление: во время переконфигурации на HP-UX в лог записывался
+ alert "sendmsg() failed (9: Bad file number)".
+
+
Изменения в nginx 1.2.1 05.06.2012
*) Безопасность: теперь nginx/Windows игнорирует точку в конце
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/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)
|
[-]
[+]
|
Added |
nginx-1.2.3.tar.bz2/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
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/cc/conf
^
|
@@ -56,6 +56,12 @@
. auto/cc/gcc
;;
+ clang)
+ # Clang C compiler
+
+ . auto/cc/clang
+ ;;
+
icc)
# Intel C++ compiler 7.1, 8.0, 8.1
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/cc/gcc
^
|
@@ -149,15 +149,13 @@
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"
;;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/cc/name
^
|
@@ -32,14 +32,14 @@
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 @@
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
|
[-]
[+]
|
Added |
nginx-1.2.3.tar.bz2/auto/endianness
^
|
@@ -0,0 +1,45 @@
+
+# Copyright (C) Igor Sysoev
+# Copyright (C) Nginx, Inc.
+
+
+echo $ngx_n "checking for system byte ordering ...$ngx_c"
+echo >> $NGX_ERR
+echo "checking for system byte ordering" >> $NGX_ERR
+
+
+cat << END > $NGX_AUTOTEST.c
+
+int main() {
+ int i = 0x11223344;
+ char *p;
+
+ p = (char *) &i;
+ if (*p == 0x44) return 0;
+ return 1;
+}
+
+END
+
+ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+
+eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+
+if [ -x $NGX_AUTOTEST ]; then
+ if $NGX_AUTOTEST >/dev/null 2>&1; then
+ echo " little endian"
+ have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+ else
+ echo " big endian"
+ fi
+
+ rm $NGX_AUTOTEST*
+
+else
+ rm $NGX_AUTOTEST*
+
+ echo
+ echo "$0: error: cannot detect system byte ordering"
+ exit 1
+fi
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/install
^
|
@@ -8,7 +8,7 @@
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
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/lib/google-perftools/conf
^
|
@@ -29,6 +29,22 @@
fi
+if [ $ngx_found = no ]; then
+
+ # MacPorts
+
+ ngx_feature="Google perftools in /opt/local/"
+
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lprofiler"
+ else
+ ngx_feature_libs="-L/opt/local/lib -lprofiler"
+ fi
+
+ . auto/feature
+fi
+
+
if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/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
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/lib/perl/make
^
|
@@ -12,7 +12,7 @@
$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
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/modules
^
|
@@ -223,6 +223,7 @@
if [ $HTTP_REALIP = YES ]; then
have=NGX_HTTP_REALIP . auto/have
+ have=NGX_HTTP_X_FORWARDED_FOR . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_REALIP_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_REALIP_SRCS"
fi
@@ -234,11 +235,13 @@
if [ $HTTP_GEO = YES ]; then
have=NGX_HTTP_GEO . auto/have
+ have=NGX_HTTP_X_FORWARDED_FOR . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_GEO_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_GEO_SRCS"
fi
if [ $HTTP_GEOIP = YES ]; then
+ have=NGX_HTTP_X_FORWARDED_FOR . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_GEOIP_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_GEOIP_SRCS"
fi
@@ -274,6 +277,7 @@
if [ $HTTP_PROXY = YES ]; then
have=NGX_HTTP_PROXY . auto/have
+ have=NGX_HTTP_X_FORWARDED_FOR . auto/have
#USE_MD5=YES
HTTP_MODULES="$HTTP_MODULES $HTTP_PROXY_MODULE"
HTTP_DEPS="$HTTP_DEPS $HTTP_PROXY_DEPS"
@@ -345,6 +349,11 @@
HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_IP_HASH_SRCS"
fi
+if [ $HTTP_UPSTREAM_LEAST_CONN = YES ]; then
+ HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_LEAST_CONN_MODULE"
+ HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_LEAST_CONN_SRCS"
+fi
+
if [ $HTTP_UPSTREAM_KEEPALIVE = YES ]; then
HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_KEEPALIVE_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_KEEPALIVE_SRCS"
@@ -458,6 +467,7 @@
if [ $NGX_CPP_TEST = YES ]; then
NGX_MISC_SRCS="$NGX_MISC_SRCS $NGX_CPP_TEST_SRCS"
+ CORE_LIBS="$CORE_LIBS -lstdc++"
fi
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/options
^
|
@@ -96,6 +96,7 @@
HTTP_MP4=NO
HTTP_GZIP_STATIC=NO
HTTP_UPSTREAM_IP_HASH=YES
+HTTP_UPSTREAM_LEAST_CONN=YES
HTTP_UPSTREAM_KEEPALIVE=YES
# STUB
@@ -243,6 +244,8 @@
--without-http_empty_gif_module) HTTP_EMPTY_GIF=NO ;;
--without-http_browser_module) HTTP_BROWSER=NO ;;
--without-http_upstream_ip_hash_module) HTTP_UPSTREAM_IP_HASH=NO ;;
+ --without-http_upstream_least_conn_module)
+ HTTP_UPSTREAM_LEAST_CONN=NO ;;
--without-http_upstream_keepalive_module) HTTP_UPSTREAM_KEEPALIVE=NO ;;
--with-http_perl_module) HTTP_PERL=YES ;;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/os/conf
^
|
@@ -48,6 +48,7 @@
CORE_DEPS="$UNIX_DEPS $POSIX_DEPS"
CORE_SRCS="$UNIX_SRCS"
CC_AUX_FLAGS="$CC_AUX_FLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CC_AUX_FLAGS="$CC_AUX_FLAGS -D_HPUX_ALT_XOPEN_SOCKET_API"
;;
OSF1:*)
@@ -93,6 +94,7 @@
;;
*)
+ have=NGX_ALIGNMENT value=16 . auto/define
NGX_MACH_CACHE_LINE=32
;;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/sources
^
|
@@ -479,6 +479,11 @@
HTTP_UPSTREAM_IP_HASH_SRCS=src/http/modules/ngx_http_upstream_ip_hash_module.c
+HTTP_UPSTREAM_LEAST_CONN_MODULE=ngx_http_upstream_least_conn_module
+HTTP_UPSTREAM_LEAST_CONN_SRCS=" \
+ src/http/modules/ngx_http_upstream_least_conn_module.c"
+
+
HTTP_UPSTREAM_KEEPALIVE_MODULE=ngx_http_upstream_keepalive_module
HTTP_UPSTREAM_KEEPALIVE_SRCS=" \
src/http/modules/ngx_http_upstream_keepalive_module.c"
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/auto/unix
^
|
@@ -464,7 +464,7 @@
. auto/types/uintptr_t
-. auto/endianess
+. auto/endianness
ngx_type="size_t"; . auto/types/sizeof
ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/configure
^
|
@@ -4,6 +4,9 @@
# Copyright (C) Nginx, Inc.
+LC_ALL=C
+export LC_ALL
+
. auto/options
. auto/init
. auto/sources
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/core/nginx.h
^
|
@@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1002001
-#define NGINX_VERSION "1.2.1"
+#define nginx_version 1002003
+#define NGINX_VERSION "1.2.3"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/core/ngx_conf_file.c
^
|
@@ -282,24 +282,16 @@
{
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 @@
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 @@
}
}
- 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 @@
}
+#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)
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/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
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/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>
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/core/ngx_hash.c
^
|
@@ -924,17 +924,6 @@
}
- hk = ngx_array_push(hwc);
- if (hk == NULL) {
- return NGX_ERROR;
- }
-
- hk->key.len = last - 1;
- hk->key.data = p;
- hk->key_hash = 0;
- hk->value = value;
-
-
/* check conflicts in wildcard hash */
name = keys->elts;
@@ -972,5 +961,18 @@
ngx_memcpy(name->data, key->data + skip, name->len);
+
+ /* add to wildcard hash */
+
+ hk = ngx_array_push(hwc);
+ if (hk == NULL) {
+ return NGX_ERROR;
+ }
+
+ hk->key.len = last - 1;
+ hk->key.data = p;
+ hk->key_hash = 0;
+ hk->value = value;
+
return NGX_OK;
}
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/core/ngx_inet.c
^
|
@@ -522,11 +522,6 @@
return ngx_parse_unix_domain_url(pool, u);
}
- if ((p[0] == ':' || p[0] == '/') && !u->listen) {
- u->err = "invalid host";
- return NGX_ERROR;
- }
-
if (p[0] == '[') {
return ngx_parse_inet6_url(pool, u);
}
@@ -639,10 +634,7 @@
args = ngx_strlchr(host, last, '?');
if (args) {
- if (uri == NULL) {
- uri = args;
-
- } else if (args < uri) {
+ if (uri == NULL || args < uri) {
uri = args;
}
}
@@ -668,11 +660,6 @@
len = last - port;
- if (len == 0) {
- u->err = "invalid port";
- return NGX_ERROR;
- }
-
n = ngx_atoi(port, len);
if (n < 1 || n > 65535) {
@@ -779,11 +766,7 @@
return NGX_OK;
}
- if (ngx_inet_resolve_host(pool, u) != NGX_OK) {
- return NGX_ERROR;
- }
-
- return NGX_OK;
+ return ngx_inet_resolve_host(pool, u);
}
@@ -825,6 +808,8 @@
u->uri.len = last - uri;
u->uri.data = uri;
+
+ last = uri;
}
if (*port == ':') {
@@ -832,11 +817,6 @@
len = last - port;
- if (len == 0) {
- u->err = "invalid port";
- return NGX_ERROR;
- }
-
n = ngx_atoi(port, len);
if (n < 1 || n > 65535) {
@@ -862,8 +842,8 @@
return NGX_ERROR;
}
- u->host.len = len;
- u->host.data = host;
+ u->host.len = len + 2;
+ u->host.data = host - 1;
if (ngx_inet6_addr(host, len, sin6->sin6_addr.s6_addr) != NGX_OK) {
u->err = "invalid IPv6 address";
@@ -874,17 +854,38 @@
u->wildcard = 1;
}
+ if (u->no_port) {
+ u->port = u->default_port;
+ sin6->sin6_port = htons(u->default_port);
+ }
+
u->family = AF_INET6;
+ u->naddrs = 1;
- if (u->no_resolve) {
- return NGX_OK;
+ u->addrs = ngx_pcalloc(pool, sizeof(ngx_addr_t));
+ if (u->addrs == NULL) {
+ return NGX_ERROR;
}
- if (u->no_port) {
- u->port = u->default_port;
- sin6->sin6_port = htons(u->default_port);
+ sin6 = ngx_pcalloc(pool, sizeof(struct sockaddr_in6));
+ if (sin6 == NULL) {
+ return NGX_ERROR;
}
+ ngx_memcpy(sin6, u->sockaddr, sizeof(struct sockaddr_in6));
+
+ u->addrs[0].sockaddr = (struct sockaddr *) sin6;
+ u->addrs[0].socklen = sizeof(struct sockaddr_in6);
+
+ p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1);
+ if (p == NULL) {
+ return NGX_ERROR;
+ }
+
+ u->addrs[0].name.len = ngx_sprintf(p, "%V:%d",
+ &u->host, u->port) - p;
+ u->addrs[0].name.data = p;
+
return NGX_OK;
#else
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/core/ngx_regex.c
^
|
@@ -152,7 +152,7 @@
return NGX_ERROR;
}
- rc->regex->pcre = re;
+ rc->regex->code = re;
/* do not study at runtime */
@@ -367,7 +367,7 @@
i = 0;
}
- elts[i].regex->extra = pcre_study(elts[i].regex->pcre, opt, &errstr);
+ elts[i].regex->extra = pcre_study(elts[i].regex->code, opt, &errstr);
if (errstr != NULL) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
@@ -380,7 +380,7 @@
int jit, n;
jit = 0;
- n = pcre_fullinfo(elts[i].regex->pcre, elts[i].regex->extra,
+ n = pcre_fullinfo(elts[i].regex->code, elts[i].regex->extra,
PCRE_INFO_JIT, &jit);
if (n != 0 || jit != 1) {
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/core/ngx_regex.h
^
|
@@ -21,7 +21,7 @@
typedef struct {
- pcre *pcre;
+ pcre *code;
pcre_extra *extra;
} ngx_regex_t;
@@ -50,7 +50,7 @@
ngx_int_t ngx_regex_compile(ngx_regex_compile_t *rc);
#define ngx_regex_exec(re, s, captures, size) \
- pcre_exec(re->pcre, re->extra, (const char *) (s)->data, (s)->len, 0, 0, \
+ pcre_exec(re->code, re->extra, (const char *) (s)->data, (s)->len, 0, 0, \
captures, size)
#define ngx_regex_exec_n "pcre_exec()"
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/core/ngx_resolver.c
^
|
@@ -96,7 +96,7 @@
{
ngx_str_t s;
ngx_url_t u;
- ngx_uint_t i;
+ ngx_uint_t i, j;
ngx_resolver_t *r;
ngx_pool_cleanup_t *cln;
ngx_udp_connection_t *uc;
@@ -171,24 +171,31 @@
ngx_memzero(&u, sizeof(ngx_url_t));
- u.host = names[i];
- u.port = 53;
+ u.url = names[i];
+ u.default_port = 53;
+
+ if (ngx_parse_url(cf->pool, &u) != NGX_OK) {
+ if (u.err) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "%s in resolver \"%V\"",
+ u.err, &u.url);
+ }
- if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V: %s", &u.host, u.err);
return NULL;
}
- uc = ngx_array_push(&r->udp_connections);
+ uc = ngx_array_push_n(&r->udp_connections, u.naddrs);
if (uc == NULL) {
return NULL;
}
- ngx_memzero(uc, sizeof(ngx_udp_connection_t));
+ ngx_memzero(uc, u.naddrs * sizeof(ngx_udp_connection_t));
- uc->sockaddr = u.addrs->sockaddr;
- uc->socklen = u.addrs->socklen;
- uc->server = u.addrs->name;
+ for (j = 0; j < u.naddrs; j++) {
+ uc[j].sockaddr = u.addrs[j].sockaddr;
+ uc[j].socklen = u.addrs[j].socklen;
+ uc[j].server = u.addrs[j].name;
+ }
}
return r;
@@ -972,12 +979,11 @@
if (rn->waiting) {
- if (ngx_resolver_send_query(r, rn) == NGX_OK) {
+ (void) ngx_resolver_send_query(r, rn);
- rn->expire = now + r->resend_timeout;
+ rn->expire = now + r->resend_timeout;
- ngx_queue_insert_head(queue, &rn->queue);
- }
+ ngx_queue_insert_head(queue, q);
continue;
}
@@ -1035,7 +1041,7 @@
nan = (query->nan_hi << 8) + query->nan_lo;
ngx_log_debug6(NGX_LOG_DEBUG_CORE, r->log, 0,
- "resolver DNS response %ui fl:%04Xui %ui/%ui/%ui/%ui",
+ "resolver DNS response %ui fl:%04Xui %ui/%ui/%ud/%ud",
ident, flags, nqs, nan,
(query->nns_hi << 8) + query->nns_lo,
(query->nar_hi << 8) + query->nar_lo);
@@ -2184,7 +2190,7 @@
ngx_socket_t s;
ngx_connection_t *c;
- s = ngx_socket(AF_INET, SOCK_DGRAM, 0);
+ s = ngx_socket(uc->sockaddr->sa_family, SOCK_DGRAM, 0);
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &uc->log, 0, "UDP socket %d", s);
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/core/ngx_shmtx.c
^
|
@@ -44,7 +44,7 @@
void
-ngx_shmtx_destory(ngx_shmtx_t *mtx)
+ngx_shmtx_destroy(ngx_shmtx_t *mtx)
{
#if (NGX_HAVE_POSIX_SEM)
@@ -208,7 +208,7 @@
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 @@
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,
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/core/ngx_shmtx.h
^
|
@@ -39,7 +39,7 @@
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);
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/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,
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/event/modules/ngx_epoll_module.c
^
|
@@ -44,16 +44,25 @@
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 @@
};
-int eventfd(u_int initval)
-{
- return -1;
-}
-
#endif
#endif
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/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 @@
#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;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/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;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/event/ngx_event.c
^
|
@@ -567,7 +567,7 @@
#if !(NGX_WIN32)
-void
+static void
ngx_timer_signal_handler(int signo)
{
ngx_event_timer_alarm = 1;
@@ -1062,50 +1062,91 @@
#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 (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
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/event/ngx_event_openssl.c
^
|
@@ -94,6 +94,24 @@
OpenSSL_add_all_algorithms();
+#ifndef SSL_OP_NO_COMPRESSION
+ {
+ /*
+ * Disable gzip compression in OpenSSL prior to 1.0.0 version,
+ * this saves about 522K per connection.
+ */
+ int i, n;
+ STACK_OF(SSL_COMP) *ssl_comp_methods;
+
+ ssl_comp_methods = SSL_COMP_get_compression_methods();
+ n = sk_SSL_COMP_num(ssl_comp_methods);
+
+ for (i = 0; i < n; i++) {
+ (void) sk_SSL_COMP_delete(ssl_comp_methods, i);
+ }
+ }
+#endif
+
ngx_ssl_connection_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
if (ngx_ssl_connection_index == -1) {
@@ -990,7 +1008,6 @@
}
if (n == NGX_AGAIN) {
- c->buffered |= NGX_SSL_BUFFERED;
return in;
}
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_geo_module.c
^
|
@@ -145,7 +145,7 @@
u_char GEORNG[6];
u_char version;
u_char ptr_size;
- uint32_t endianess;
+ uint32_t endianness;
uint32_t crc32;
} ngx_http_geo_header_t;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_geoip_module.c
^
|
@@ -28,7 +28,7 @@
} ngx_http_geoip_var_t;
-typedef const char *(*ngx_http_geoip_variable_handler_pt)(GeoIP *, u_long addr);
+typedef char *(*ngx_http_geoip_variable_handler_pt)(GeoIP *, u_long addr);
static u_long ngx_http_geoip_addr(ngx_http_request_t *r,
ngx_http_geoip_conf_t *gcf);
@@ -291,7 +291,8 @@
ngx_http_geoip_variable_handler_pt handler =
(ngx_http_geoip_variable_handler_pt) data;
- const char *val;
+ size_t len;
+ char *val;
ngx_http_geoip_conf_t *gcf;
gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip_module);
@@ -306,11 +307,21 @@
goto not_found;
}
- v->len = ngx_strlen(val);
+ len = ngx_strlen(val);
+ v->data = ngx_pnalloc(r->pool, len);
+ if (v->data == NULL) {
+ ngx_free(val);
+ return NGX_ERROR;
+ }
+
+ ngx_memcpy(v->data, val, len);
+
+ v->len = len;
v->valid = 1;
v->no_cacheable = 0;
v->not_found = 0;
- v->data = (u_char *) val;
+
+ ngx_free(val);
return NGX_OK;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_limit_conn_module.c
^
|
@@ -238,7 +238,7 @@
}
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_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--;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_log_module.c
^
|
@@ -205,7 +205,7 @@
{ ngx_string("msec"), NGX_TIME_T_LEN + 4, ngx_http_log_msec },
{ ngx_string("request_time"), NGX_TIME_T_LEN + 4,
ngx_http_log_request_time },
- { ngx_string("status"), 3, ngx_http_log_status },
+ { ngx_string("status"), NGX_INT_T_LEN, ngx_http_log_status },
{ ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent },
{ ngx_string("body_bytes_sent"), NGX_OFF_T_LEN,
ngx_http_log_body_bytes_sent },
@@ -218,7 +218,7 @@
};
-ngx_int_t
+static ngx_int_t
ngx_http_log_handler(ngx_http_request_t *r)
{
u_char *line, *p;
@@ -584,16 +584,13 @@
status = r->headers_out.status;
} else if (r->http_version == NGX_HTTP_VERSION_9) {
- *buf++ = '0';
- *buf++ = '0';
- *buf++ = '9';
- return buf;
+ status = 9;
} else {
status = 0;
}
- return ngx_sprintf(buf, "%ui", status);
+ return ngx_sprintf(buf, "%03ui", status);
}
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_map_module.c
^
|
@@ -110,7 +110,6 @@
{
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 @@
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 @@
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;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_mp4_module.c
^
|
@@ -1024,6 +1024,10 @@
+ NGX_HTTP_MP4_MOOV_BUFFER_EXCESS * no_mdat;
}
+ if (ngx_http_mp4_read(mp4, (size_t) atom_data_size) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
mp4->trak.elts = &mp4->traks;
mp4->trak.size = sizeof(ngx_http_mp4_trak_t);
mp4->trak.nalloc = 2;
@@ -1044,6 +1048,12 @@
mp4->buffer_start = mp4->buffer_pos;
mp4->buffer_size = NGX_HTTP_MP4_MOOV_BUFFER_EXCESS;
+ if (mp4->buffer_start + mp4->buffer_size > mp4->buffer_end) {
+ mp4->buffer = NULL;
+ mp4->buffer_pos = NULL;
+ mp4->buffer_end = NULL;
+ }
+
} else {
/* skip atoms after moov atom */
mp4->offset = mp4->end;
@@ -2488,7 +2498,13 @@
ngx_mp4_set_32value(entry->chunk, 1);
- if (trak->chunk_samples) {
+ if (trak->chunk_samples && next_chunk - trak->start_chunk == 2) {
+
+ /* last chunk in the entry */
+
+ ngx_mp4_set_32value(entry->samples, samples - trak->chunk_samples);
+
+ } else if (trak->chunk_samples) {
first = &trak->stsc_chunk_entry;
ngx_mp4_set_32value(first->chunk, 1);
@@ -2504,6 +2520,7 @@
ngx_mp4_set_32value(entry->chunk, 2);
+ entries++;
atom_size += sizeof(ngx_mp4_stsc_entry_t);
}
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_rewrite_module.c
^
|
@@ -485,6 +485,12 @@
} else {
+ if (ret->status > 999) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid return code \"%V\"", &value[1]);
+ return NGX_CONF_ERROR;
+ }
+
if (cf->args->nelts == 2) {
return NGX_CONF_OK;
}
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_split_clients_module.c
^
|
@@ -138,6 +138,13 @@
}
name = value[2];
+
+ if (name.len < 2 || name.data[0] != '$') {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid variable name \"%V\"", &name);
+ return NGX_CONF_ERROR;
+ }
+
name.len--;
name.data++;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_upstream_ip_hash_module.c
^
|
@@ -16,7 +16,8 @@
ngx_uint_t hash;
- u_char addr[3];
+ u_char addrlen;
+ u_char *addr;
u_char tries;
@@ -76,7 +77,10 @@
};
-ngx_int_t
+static u_char ngx_http_upstream_ip_hash_pseudo_addr[3];
+
+
+static ngx_int_t
ngx_http_upstream_init_ip_hash(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
{
if (ngx_http_upstream_init_round_robin(cf, us) != NGX_OK) {
@@ -93,8 +97,10 @@
ngx_http_upstream_init_ip_hash_peer(ngx_http_request_t *r,
ngx_http_upstream_srv_conf_t *us)
{
- u_char *p;
struct sockaddr_in *sin;
+#if (NGX_HAVE_INET6)
+ struct sockaddr_in6 *sin6;
+#endif
ngx_http_upstream_ip_hash_peer_data_t *iphp;
iphp = ngx_palloc(r->pool, sizeof(ngx_http_upstream_ip_hash_peer_data_t));
@@ -110,20 +116,25 @@
r->upstream->peer.get = ngx_http_upstream_get_ip_hash_peer;
- /* AF_INET only */
-
- if (r->connection->sockaddr->sa_family == AF_INET) {
+ switch (r->connection->sockaddr->sa_family) {
+ case AF_INET:
sin = (struct sockaddr_in *) r->connection->sockaddr;
- p = (u_char *) &sin->sin_addr.s_addr;
- iphp->addr[0] = p[0];
- iphp->addr[1] = p[1];
- iphp->addr[2] = p[2];
-
- } else {
- iphp->addr[0] = 0;
- iphp->addr[1] = 0;
- iphp->addr[2] = 0;
+ iphp->addr = (u_char *) &sin->sin_addr.s_addr;
+ iphp->addrlen = 3;
+ break;
+
+#if (NGX_HAVE_INET6)
+ case AF_INET6:
+ sin6 = (struct sockaddr_in6 *) r->connection->sockaddr;
+ iphp->addr = (u_char *) &sin6->sin6_addr.s6_addr;
+ iphp->addrlen = 16;
+ break;
+#endif
+
+ default:
+ iphp->addr = ngx_http_upstream_ip_hash_pseudo_addr;
+ iphp->addrlen = 3;
}
iphp->hash = 89;
@@ -140,6 +151,7 @@
ngx_http_upstream_ip_hash_peer_data_t *iphp = data;
time_t now;
+ ngx_int_t w;
uintptr_t m;
ngx_uint_t i, n, p, hash;
ngx_http_upstream_rr_peer_t *peer;
@@ -162,11 +174,25 @@
for ( ;; ) {
- for (i = 0; i < 3; i++) {
+ for (i = 0; i < iphp->addrlen; i++) {
hash = (hash * 113 + iphp->addr[i]) % 6271;
}
- p = hash % iphp->rrp.peers->number;
+ if (!iphp->rrp.peers->weighted) {
+ p = hash % iphp->rrp.peers->number;
+
+ } else {
+ w = hash % iphp->rrp.peers->total_weight;
+
+ for (i = 0; i < iphp->rrp.peers->number; i++) {
+ w -= iphp->rrp.peers->peer[i].weight;
+ if (w < 0) {
+ break;
+ }
+ }
+
+ p = i;
+ }
n = p / (8 * sizeof(uintptr_t));
m = (uintptr_t) 1 << p % (8 * sizeof(uintptr_t));
@@ -229,6 +255,7 @@
uscf->peer.init_upstream = ngx_http_upstream_init_ip_hash;
uscf->flags = NGX_HTTP_UPSTREAM_CREATE
+ |NGX_HTTP_UPSTREAM_WEIGHT
|NGX_HTTP_UPSTREAM_MAX_FAILS
|NGX_HTTP_UPSTREAM_FAIL_TIMEOUT
|NGX_HTTP_UPSTREAM_DOWN;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_upstream_keepalive_module.c
^
|
@@ -12,7 +12,6 @@
typedef struct {
ngx_uint_t max_cached;
- ngx_uint_t single; /* unsigned:1 */
ngx_queue_t cache;
ngx_queue_t free;
@@ -223,36 +222,11 @@
kp->failed = 0;
- /* single pool of cached connections */
-
- if (kp->conf->single && !ngx_queue_empty(&kp->conf->cache)) {
-
- q = ngx_queue_head(&kp->conf->cache);
-
- item = ngx_queue_data(q, ngx_http_upstream_keepalive_cache_t, queue);
- c = item->connection;
-
- ngx_queue_remove(q);
- ngx_queue_insert_head(&kp->conf->free, q);
-
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
- "get keepalive peer: using connection %p", c);
-
- c->idle = 0;
- c->log = pc->log;
- c->read->log = pc->log;
- c->write->log = pc->log;
- c->pool->log = pc->log;
-
- pc->connection = c;
- pc->cached = 1;
-
- return NGX_DONE;
- }
+ /* ask balancer */
rc = kp->original_get_peer(pc, kp->data);
- if (kp->conf->single || rc != NGX_OK) {
+ if (rc != NGX_OK) {
return rc;
}
@@ -552,7 +526,8 @@
for (i = 2; i < cf->args->nelts; i++) {
if (ngx_strcmp(value[i].data, "single") == 0) {
- kcf->single = 1;
+ ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
+ "the \"single\" parameter is deprecated");
continue;
}
|
[-]
[+]
|
Added |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_upstream_least_conn_module.c
^
|
@@ -0,0 +1,402 @@
+
+/*
+ * Copyright (C) Maxim Dounin
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <ngx_http.h>
+
+
+typedef struct {
+ ngx_uint_t *conns;
+} ngx_http_upstream_least_conn_conf_t;
+
+
+typedef struct {
+ /* the round robin data must be first */
+ ngx_http_upstream_rr_peer_data_t rrp;
+
+ ngx_uint_t *conns;
+
+ ngx_event_get_peer_pt get_rr_peer;
+ ngx_event_free_peer_pt free_rr_peer;
+} ngx_http_upstream_lc_peer_data_t;
+
+
+static ngx_int_t ngx_http_upstream_init_least_conn_peer(ngx_http_request_t *r,
+ ngx_http_upstream_srv_conf_t *us);
+static ngx_int_t ngx_http_upstream_get_least_conn_peer(
+ ngx_peer_connection_t *pc, void *data);
+static void ngx_http_upstream_free_least_conn_peer(ngx_peer_connection_t *pc,
+ void *data, ngx_uint_t state);
+static void *ngx_http_upstream_least_conn_create_conf(ngx_conf_t *cf);
+static char *ngx_http_upstream_least_conn(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf);
+
+
+static ngx_command_t ngx_http_upstream_least_conn_commands[] = {
+
+ { ngx_string("least_conn"),
+ NGX_HTTP_UPS_CONF|NGX_CONF_NOARGS,
+ ngx_http_upstream_least_conn,
+ 0,
+ 0,
+ NULL },
+
+ ngx_null_command
+};
+
+
+static ngx_http_module_t ngx_http_upstream_least_conn_module_ctx = {
+ NULL, /* preconfiguration */
+ NULL, /* postconfiguration */
+
+ NULL, /* create main configuration */
+ NULL, /* init main configuration */
+
+ ngx_http_upstream_least_conn_create_conf, /* create server configuration */
+ NULL, /* merge server configuration */
+
+ NULL, /* create location configuration */
+ NULL /* merge location configuration */
+};
+
+
+ngx_module_t ngx_http_upstream_least_conn_module = {
+ NGX_MODULE_V1,
+ &ngx_http_upstream_least_conn_module_ctx, /* module context */
+ ngx_http_upstream_least_conn_commands, /* module directives */
+ NGX_HTTP_MODULE, /* module type */
+ NULL, /* init master */
+ NULL, /* init module */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
+};
+
+
+static ngx_int_t
+ngx_http_upstream_init_least_conn(ngx_conf_t *cf,
+ ngx_http_upstream_srv_conf_t *us)
+{
+ ngx_uint_t n;
+ ngx_http_upstream_rr_peers_t *peers;
+ ngx_http_upstream_least_conn_conf_t *lcf;
+
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cf->log, 0,
+ "init least conn");
+
+ if (ngx_http_upstream_init_round_robin(cf, us) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
+ peers = us->peer.data;
+
+ n = peers->number;
+
+ if (peers->next) {
+ n += peers->next->number;
+ }
+
+ lcf = ngx_http_conf_upstream_srv_conf(us,
+ ngx_http_upstream_least_conn_module);
+
+ lcf->conns = ngx_pcalloc(cf->pool, sizeof(ngx_uint_t) * n);
+ if (lcf->conns == NULL) {
+ return NGX_ERROR;
+ }
+
+ us->peer.init = ngx_http_upstream_init_least_conn_peer;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
+ngx_http_upstream_init_least_conn_peer(ngx_http_request_t *r,
+ ngx_http_upstream_srv_conf_t *us)
+{
+ ngx_http_upstream_lc_peer_data_t *lcp;
+ ngx_http_upstream_least_conn_conf_t *lcf;
+
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "init least conn peer");
+
+ lcf = ngx_http_conf_upstream_srv_conf(us,
+ ngx_http_upstream_least_conn_module);
+
+ lcp = ngx_palloc(r->pool, sizeof(ngx_http_upstream_lc_peer_data_t));
+ if (lcp == NULL) {
+ return NGX_ERROR;
+ }
+
+ lcp->conns = lcf->conns;
+
+ r->upstream->peer.data = &lcp->rrp;
+
+ if (ngx_http_upstream_init_round_robin_peer(r, us) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
+ r->upstream->peer.get = ngx_http_upstream_get_least_conn_peer;
+ r->upstream->peer.free = ngx_http_upstream_free_least_conn_peer;
+
+ lcp->get_rr_peer = ngx_http_upstream_get_round_robin_peer;
+ lcp->free_rr_peer = ngx_http_upstream_free_round_robin_peer;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
+ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
+{
+ ngx_http_upstream_lc_peer_data_t *lcp = data;
+
+ time_t now;
+ uintptr_t m;
+ ngx_int_t rc, total;
+ ngx_uint_t i, n, p, many;
+ ngx_http_upstream_rr_peer_t *peer, *best;
+ ngx_http_upstream_rr_peers_t *peers;
+
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get least conn peer, try: %ui", pc->tries);
+
+ if (lcp->rrp.peers->single) {
+ return lcp->get_rr_peer(pc, &lcp->rrp);
+ }
+
+ pc->cached = 0;
+ pc->connection = NULL;
+
+ now = ngx_time();
+
+ peers = lcp->rrp.peers;
+
+ best = NULL;
+ total = 0;
+
+#if (NGX_SUPPRESS_WARN)
+ many = 0;
+ p = 0;
+#endif
+
+ for (i = 0; i < peers->number; i++) {
+
+ n = i / (8 * sizeof(uintptr_t));
+ m = (uintptr_t) 1 << i % (8 * sizeof(uintptr_t));
+
+ if (lcp->rrp.tried[n] & m) {
+ continue;
+ }
+
+ peer = &peers->peer[i];
+
+ if (peer->down) {
+ continue;
+ }
+
+ if (peer->max_fails
+ && peer->fails >= peer->max_fails
+ && now - peer->checked <= peer->fail_timeout)
+ {
+ continue;
+ }
+
+ /*
+ * select peer with least number of connections; if there are
+ * multiple peers with the same number of connections, select
+ * based on round-robin
+ */
+
+ if (best == NULL
+ || lcp->conns[i] * best->weight < lcp->conns[p] * peer->weight)
+ {
+ best = peer;
+ many = 0;
+ p = i;
+
+ } else if (lcp->conns[i] * best->weight
+ == lcp->conns[p] * peer->weight)
+ {
+ many = 1;
+ }
+ }
+
+ if (best == NULL) {
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get least conn peer, no peer found");
+
+ goto failed;
+ }
+
+ if (many) {
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get least conn peer, many");
+
+ for (i = p; i < peers->number; i++) {
+
+ n = i / (8 * sizeof(uintptr_t));
+ m = (uintptr_t) 1 << i % (8 * sizeof(uintptr_t));
+
+ if (lcp->rrp.tried[n] & m) {
+ continue;
+ }
+
+ peer = &peers->peer[i];
+
+ if (peer->down) {
+ continue;
+ }
+
+ if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
+ continue;
+ }
+
+ if (peer->max_fails
+ && peer->fails >= peer->max_fails
+ && now - peer->checked <= peer->fail_timeout)
+ {
+ continue;
+ }
+
+ peer->current_weight += peer->effective_weight;
+ total += peer->effective_weight;
+
+ if (peer->effective_weight < peer->weight) {
+ peer->effective_weight++;
+ }
+
+ if (peer->current_weight > best->current_weight) {
+ best = peer;
+ p = i;
+ }
+ }
+ }
+
+ best->current_weight -= total;
+ best->checked = now;
+
+ pc->sockaddr = best->sockaddr;
+ pc->socklen = best->socklen;
+ pc->name = &best->name;
+
+ lcp->rrp.current = p;
+
+ n = p / (8 * sizeof(uintptr_t));
+ m = (uintptr_t) 1 << p % (8 * sizeof(uintptr_t));
+
+ lcp->rrp.tried[n] |= m;
+ lcp->conns[p]++;
+
+ if (pc->tries == 1 && peers->next) {
+ pc->tries += peers->next->number;
+ }
+
+ return NGX_OK;
+
+failed:
+
+ if (peers->next) {
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get least conn peer, backup servers");
+
+ lcp->conns += peers->number;
+
+ lcp->rrp.peers = peers->next;
+ pc->tries = lcp->rrp.peers->number;
+
+ n = lcp->rrp.peers->number / (8 * sizeof(uintptr_t)) + 1;
+ for (i = 0; i < n; i++) {
+ lcp->rrp.tried[i] = 0;
+ }
+
+ rc = ngx_http_upstream_get_least_conn_peer(pc, lcp);
+
+ if (rc != NGX_BUSY) {
+ return rc;
+ }
+ }
+
+ /* all peers failed, mark them as live for quick recovery */
+
+ for (i = 0; i < peers->number; i++) {
+ peers->peer[i].fails = 0;
+ }
+
+ pc->name = peers->name;
+
+ return NGX_BUSY;
+}
+
+
+static void
+ngx_http_upstream_free_least_conn_peer(ngx_peer_connection_t *pc,
+ void *data, ngx_uint_t state)
+{
+ ngx_http_upstream_lc_peer_data_t *lcp = data;
+
+ ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "free least conn peer %ui %ui", pc->tries, state);
+
+ if (lcp->rrp.peers->single) {
+ lcp->free_rr_peer(pc, &lcp->rrp, state);
+ return;
+ }
+
+ if (state == 0 && pc->tries == 0) {
+ return;
+ }
+
+ lcp->conns[lcp->rrp.current]--;
+
+ lcp->free_rr_peer(pc, &lcp->rrp, state);
+}
+
+
+static void *
+ngx_http_upstream_least_conn_create_conf(ngx_conf_t *cf)
+{
+ ngx_http_upstream_least_conn_conf_t *conf;
+
+ conf = ngx_pcalloc(cf->pool,
+ sizeof(ngx_http_upstream_least_conn_conf_t));
+ if (conf == NULL) {
+ return NULL;
+ }
+
+ /*
+ * set by ngx_pcalloc():
+ *
+ * conf->conns = NULL;
+ */
+
+ return conf;
+}
+
+
+static char *
+ngx_http_upstream_least_conn(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ ngx_http_upstream_srv_conf_t *uscf;
+
+ uscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_upstream_module);
+
+ uscf->peer.init_upstream = ngx_http_upstream_init_least_conn;
+
+ uscf->flags = NGX_HTTP_UPSTREAM_CREATE
+ |NGX_HTTP_UPSTREAM_WEIGHT
+ |NGX_HTTP_UPSTREAM_MAX_FAILS
+ |NGX_HTTP_UPSTREAM_FAIL_TIMEOUT
+ |NGX_HTTP_UPSTREAM_DOWN
+ |NGX_HTTP_UPSTREAM_BACKUP;
+
+ return NGX_CONF_OK;
+}
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/ngx_http_xslt_filter_module.c
^
|
@@ -810,7 +810,7 @@
file = xmcf->dtd_files.elts;
for (i = 0; i < xmcf->dtd_files.nelts; i++) {
- if (ngx_strcmp(file[i].name, &value[1].data) == 0) {
+ if (ngx_strcmp(file[i].name, value[1].data) == 0) {
xlcf->dtd = file[i].data;
return NGX_CONF_OK;
}
@@ -884,7 +884,7 @@
file = xmcf->sheet_files.elts;
for (i = 0; i < xmcf->sheet_files.nelts; i++) {
- if (ngx_strcmp(file[i].name, &value[1].data) == 0) {
+ if (ngx_strcmp(file[i].name, value[1].data) == 0) {
sheet->stylesheet = file[i].data;
goto found;
}
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/perl/nginx.pm
^
|
@@ -50,7 +50,7 @@
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '1.2.1';
+our $VERSION = '1.2.3';
require XSLoader;
XSLoader::load('nginx', $VERSION);
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/modules/perl/nginx.xs
^
|
@@ -476,7 +476,7 @@
}
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;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/ngx_http.c
^
|
@@ -1613,6 +1613,11 @@
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;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/ngx_http_core_module.c
^
|
@@ -222,7 +222,7 @@
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 @@
r->internal = 1;
r->content_handler = NULL;
+ r->uri_changed = 0;
r->loc_conf = (*clcfp)->loc_conf;
/* clear the modules contexts */
@@ -4662,7 +4663,7 @@
code = ngx_atoi(tf[i - 1].name.data + 1, tf[i - 1].name.len - 2);
- if (code == NGX_ERROR) {
+ if (code == NGX_ERROR || code > 999) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid code \"%*s\"",
tf[i - 1].name.len - 1, tf[i - 1].name.data);
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/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 };
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/ngx_http_request.c
^
|
@@ -138,7 +138,7 @@
{ ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive),
ngx_http_process_header_line },
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
+#if (NGX_HTTP_X_FORWARDED_FOR)
{ ngx_string("X-Forwarded-For"),
offsetof(ngx_http_headers_in_t, x_forwarded_for),
ngx_http_process_header_line },
@@ -747,6 +747,7 @@
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 @@
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_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 @@
/* 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 @@
* 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_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 @@
#endif
- return NGX_OK;
+ return NGX_DECLINED;
found:
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/ngx_http_request.h
^
|
@@ -137,6 +137,13 @@
#define NGX_HTTP_COPY_BUFFERED 0x04
+#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
+#ifndef NGX_HTTP_X_FORWARDED_FOR
+#define NGX_HTTP_X_FORWARDED_FOR 1
+#endif
+#endif
+
+
typedef enum {
NGX_HTTP_INITING_REQUEST_STATE = 0,
NGX_HTTP_READING_REQUEST_STATE,
@@ -192,7 +199,7 @@
ngx_table_elt_t *keep_alive;
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
+#if (NGX_HTTP_X_FORWARDED_FOR)
ngx_table_elt_t *x_forwarded_for;
#endif
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/ngx_http_upstream.c
^
|
@@ -3677,6 +3677,7 @@
ngx_http_upstream_rewrite_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h,
ngx_uint_t offset)
{
+ ngx_int_t rc;
ngx_table_elt_t *ho;
ho = ngx_list_push(&r->headers_out.headers);
@@ -3687,7 +3688,20 @@
*ho = *h;
if (r->upstream->rewrite_cookie) {
- return r->upstream->rewrite_cookie(r, ho);
+ rc = r->upstream->rewrite_cookie(r, ho);
+
+ if (rc == NGX_DECLINED) {
+ return NGX_OK;
+ }
+
+#if (NGX_DEBUG)
+ if (rc == NGX_OK) {
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "rewritten cookie: \"%V\"", &ho->value);
+ }
+#endif
+
+ return rc;
}
return NGX_OK;
@@ -4408,18 +4422,18 @@
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);
@@ -4527,6 +4541,9 @@
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
@@ -4538,9 +4555,6 @@
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;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/ngx_http_upstream_round_robin.c
^
|
@@ -30,7 +30,7 @@
ngx_http_upstream_srv_conf_t *us)
{
ngx_url_t u;
- ngx_uint_t i, j, n;
+ ngx_uint_t i, j, n, w;
ngx_http_upstream_server_t *server;
ngx_http_upstream_rr_peers_t *peers, *backup;
@@ -40,6 +40,7 @@
server = us->servers->elts;
n = 0;
+ w = 0;
for (i = 0; i < us->servers->nelts; i++) {
if (server[i].backup) {
@@ -47,6 +48,7 @@
}
n += server[i].naddrs;
+ w += server[i].naddrs * server[i].weight;
}
if (n == 0) {
@@ -64,6 +66,8 @@
peers->single = (n == 1);
peers->number = n;
+ peers->weighted = (w != n);
+ peers->total_weight = w;
peers->name = &us->host;
n = 0;
@@ -96,6 +100,7 @@
/* backup servers */
n = 0;
+ w = 0;
for (i = 0; i < us->servers->nelts; i++) {
if (!server[i].backup) {
@@ -103,6 +108,7 @@
}
n += server[i].naddrs;
+ w += server[i].naddrs * server[i].weight;
}
if (n == 0) {
@@ -118,6 +124,8 @@
peers->single = 0;
backup->single = 0;
backup->number = n;
+ backup->weighted = (w != n);
+ backup->total_weight = w;
backup->name = &us->host;
n = 0;
@@ -185,6 +193,8 @@
peers->single = (n == 1);
peers->number = n;
+ peers->weighted = 0;
+ peers->total_weight = n;
peers->name = &us->host;
for (i = 0; i < u.naddrs; i++) {
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/ngx_http_upstream_round_robin.h
^
|
@@ -41,13 +41,17 @@
typedef struct ngx_http_upstream_rr_peers_s ngx_http_upstream_rr_peers_t;
struct ngx_http_upstream_rr_peers_s {
- ngx_uint_t single; /* unsigned single:1; */
ngx_uint_t number;
ngx_uint_t last_cached;
/* ngx_mutex_t *mutex; */
ngx_connection_t **cached;
+ ngx_uint_t total_weight;
+
+ unsigned single:1;
+ unsigned weighted:1;
+
ngx_str_t *name;
ngx_http_upstream_rr_peers_t *next;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/http/ngx_http_variables.c
^
|
@@ -77,6 +77,8 @@
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_request_body_file(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_status(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_sent_content_type(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
@@ -132,7 +134,7 @@
offsetof(ngx_http_request_t, headers_in.via), 0, 0 },
#endif
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP)
+#if (NGX_HTTP_X_FORWARDED_FOR)
{ ngx_string("http_x_forwarded_for"), NULL, ngx_http_variable_header,
offsetof(ngx_http_request_t, headers_in.x_forwarded_for), 0, 0 },
#endif
@@ -225,6 +227,10 @@
ngx_http_variable_request_body_file,
0, 0, 0 },
+ { ngx_string("status"), NULL,
+ ngx_http_variable_status, 0,
+ NGX_HTTP_VAR_NOCACHEABLE, 0 },
+
{ ngx_string("sent_http_content_type"), NULL,
ngx_http_variable_sent_content_type, 0, 0, 0 },
@@ -1456,6 +1462,39 @@
static ngx_int_t
+ngx_http_variable_status(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ ngx_uint_t status;
+
+ v->data = ngx_pnalloc(r->pool, NGX_INT_T_LEN);
+ if (v->data == NULL) {
+ return NGX_ERROR;
+ }
+
+ if (r->err_status) {
+ status = r->err_status;
+
+ } else if (r->headers_out.status) {
+ status = r->headers_out.status;
+
+ } else if (r->http_version == NGX_HTTP_VERSION_9) {
+ status = 9;
+
+ } else {
+ status = 0;
+ }
+
+ v->len = ngx_sprintf(v->data, "%03ui", status) - v->data;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_variable_sent_content_type(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{
@@ -2016,7 +2055,7 @@
ngx_http_variables_add_core_vars(ngx_conf_t *cf)
{
ngx_int_t rc;
- ngx_http_variable_t *v;
+ ngx_http_variable_t *cv, *v;
ngx_http_core_main_conf_t *cmcf;
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
@@ -2036,7 +2075,14 @@
return NGX_ERROR;
}
- for (v = ngx_http_core_variables; v->name.len; v++) {
+ for (cv = ngx_http_core_variables; cv->name.len; cv++) {
+ v = ngx_palloc(cf->pool, sizeof(ngx_http_variable_t));
+ if (v == NULL) {
+ return NGX_ERROR;
+ }
+
+ *v = *cv;
+
rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v,
NGX_HASH_READONLY_KEY);
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/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
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/misc/ngx_cpp_test_module.cpp
^
|
@@ -20,6 +20,8 @@
// #include <string>
+void ngx_cpp_test_handler(void *data);
+
void
ngx_cpp_test_handler(void *data)
{
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/os/unix/ngx_atomic.h
^
|
@@ -48,7 +48,9 @@
#include <libkern/OSAtomic.h>
/* "bool" conflicts with perl's CORE/handy.h */
+#if 0
#undef bool
+#endif
#define NGX_HAVE_ATOMIC_OPS 1
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/os/unix/ngx_errno.c
^
|
@@ -42,7 +42,7 @@
}
-ngx_uint_t
+ngx_int_t
ngx_strerror_init(void)
{
char *msg;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/os/unix/ngx_errno.h
^
|
@@ -69,7 +69,7 @@
u_char *ngx_strerror(ngx_err_t err, u_char *errstr, size_t size);
-ngx_uint_t ngx_strerror_init(void);
+ngx_int_t ngx_strerror_init(void);
#endif /* _NGX_ERRNO_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/os/unix/ngx_files.c
^
|
@@ -413,9 +413,7 @@
{
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 @@
{
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 @@
{
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;
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/os/unix/ngx_freebsd_init.c
^
|
@@ -76,9 +76,9 @@
{
#if (NGX_DEBUG_MALLOC)
-#if __FreeBSD_version >= 500014
+#if __FreeBSD_version >= 500014 && __FreeBSD_version < 1000011
_malloc_options = "J";
-#else
+#elif __FreeBSD_version < 500014
malloc_options = "J";
#endif
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/os/unix/ngx_posix_config.h
^
|
@@ -12,6 +12,7 @@
#if (NGX_HPUX)
#define _XOPEN_SOURCE
#define _XOPEN_SOURCE_EXTENDED 1
+#define _HPUX_ALT_XOPEN_SOCKET_API
#endif
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/os/unix/ngx_posix_init.c
^
|
@@ -98,6 +98,8 @@
}
+#if 0
+
ngx_int_t
ngx_posix_post_conf_init(ngx_log_t *log)
{
@@ -122,3 +124,5 @@
return NGX_OK;
}
+
+#endif
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/os/unix/ngx_process_cycle.c
^
|
@@ -711,6 +711,8 @@
ngx_exit_log.file = &ngx_exit_log_file;
ngx_exit_cycle.log = &ngx_exit_log;
+ ngx_exit_cycle.files = ngx_cycle->files;
+ ngx_exit_cycle.files_n = ngx_cycle->files_n;
ngx_cycle = &ngx_exit_cycle;
ngx_destroy_pool(cycle->pool);
@@ -1054,6 +1056,8 @@
ngx_exit_log.file = &ngx_exit_log_file;
ngx_exit_cycle.log = &ngx_exit_log;
+ ngx_exit_cycle.files = ngx_cycle->files;
+ ngx_exit_cycle.files_n = ngx_cycle->files_n;
ngx_cycle = &ngx_exit_cycle;
ngx_destroy_pool(cycle->pool);
|
[-]
[+]
|
Changed |
nginx-1.2.3.tar.bz2/src/os/unix/ngx_solaris_sendfilev_chain.c
^
|
@@ -29,6 +29,9 @@
return -1;
}
+ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in,
+ off_t limit);
+
#endif
|