[-]
[+]
|
Changed |
nginx-1.9.changes
|
|
[-]
[+]
|
Changed |
nginx-1.9.spec
^
|
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/CHANGES
^
|
@@ -1,4 +1,16 @@
+Changes with nginx 1.9.11 09 Feb 2016
+
+ *) Feature: TCP support in resolver.
+
+ *) Feature: dynamic modules.
+
+ *) Bugfix: the $request_length variable did not include size of request
+ headers when using HTTP/2.
+
+ *) Bugfix: in the ngx_http_v2_module.
+
+
Changes with nginx 1.9.10 26 Jan 2016
*) Security: invalid pointer dereference might occur during DNS server
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/CHANGES.ru
^
|
@@ -1,4 +1,16 @@
+Изменения в nginx 1.9.11 09.02.2016
+
+ *) Добавление: теперь resolver поддерживает TCP.
+
+ *) Добавление: динамические модули.
+
+ *) Исправление: при использовании HTTP/2 переменная $request_length не
+ учитывала размер заголовков запроса.
+
+ *) Исправление: в модуле ngx_http_v2_module.
+
+
Изменения в nginx 1.9.10 26.01.2016
*) Безопасность: при использовании директивы resolver во время обработки
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/cc/conf
^
|
@@ -5,12 +5,17 @@
LINK="\$(CC)"
+MAIN_LINK=
+MODULE_LINK="-shared"
+
ngx_include_opt="-I "
ngx_compile_opt="-c"
+ngx_pic_opt="-fPIC"
ngx_objout="-o "
ngx_binout="-o "
ngx_objext="o"
ngx_binext=
+ngx_modext=".so"
ngx_long_start=
ngx_long_end=
@@ -45,6 +50,9 @@
sunc)
+ MAIN_LINK=
+ MODULE_LINK="-G"
+
case "$NGX_MACHINE" in
i86pc)
@@ -156,6 +164,20 @@
fi
+ ngx_feature="-Wl,-E switch"
+ ngx_feature_name=
+ ngx_feature_run=no
+ ngx_feature_incs=
+ ngx_feature_path=
+ ngx_feature_libs=-Wl,-E
+ ngx_feature_test=
+ . auto/feature
+
+ if [ $ngx_found = yes ]; then
+ MAIN_LINK="-Wl,-E"
+ fi
+
+
ngx_feature="gcc builtin atomic operations"
ngx_feature_name=NGX_HAVE_GCC_ATOMIC
ngx_feature_run=yes
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/cc/msvc
^
|
@@ -118,6 +118,12 @@
CORE_LINK="$NGX_RES $CORE_LINK"
+# dynamic modules
+#MAIN_LINK="-link -def:$NGX_OBJS/nginx.def"
+#MODULE_LINK="-LD $NGX_OBJS/nginx.lib"
+
+
+ngx_pic_opt=
ngx_objout="-Fo"
ngx_binout="-Fe"
ngx_objext="obj"
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/cc/sunc
^
|
@@ -57,6 +57,9 @@
esac
+MAIN_LINK=
+MODULE_LINK="-G"
+
# optimizations
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/init
^
|
@@ -5,6 +5,7 @@
NGX_MAKEFILE=$NGX_OBJS/Makefile
NGX_MODULES_C=$NGX_OBJS/ngx_modules.c
+NGX_MODULES=
NGX_AUTO_HEADERS_H=$NGX_OBJS/ngx_auto_headers.h
NGX_AUTO_CONFIG_H=$NGX_OBJS/ngx_auto_config.h
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/install
^
|
@@ -26,6 +26,18 @@
esac
+case ".$NGX_MODULES_PATH" in
+ ./*)
+ ;;
+
+ *)
+ NGX_MODULES_PATH=$NGX_PREFIX/$NGX_MODULES_PATH
+ ;;
+esac
+
+NGX_MODULES_PATH=`dirname $NGX_MODULES_PATH/.`
+
+
case ".$NGX_CONF_PATH" in
./*)
;;
@@ -158,12 +170,24 @@
fi
+if test -n "$NGX_MODULES"; then
+ cat << END >> $NGX_MAKEFILE
+
+ test -d '\$(DESTDIR)$NGX_MODULES_PATH' \
+ || mkdir -p '\$(DESTDIR)$NGX_MODULES_PATH'
+ cp $NGX_MODULES '\$(DESTDIR)$NGX_MODULES_PATH'
+END
+
+fi
+
+
# create Makefile
cat << END >> Makefile
build:
\$(MAKE) -f $NGX_MAKEFILE
+ \$(MAKE) -f $NGX_MAKEFILE modules
\$(MAKE) -f $NGX_MAKEFILE manpage
install:
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/lib/conf
^
|
@@ -58,11 +58,11 @@
. auto/lib/zlib/conf
fi
-if [ $USE_LIBXSLT = YES ]; then
+if [ $USE_LIBXSLT != NO ]; then
. auto/lib/libxslt/conf
fi
-if [ $USE_LIBGD = YES ]; then
+if [ $USE_LIBGD != NO ]; then
. auto/lib/libgd/conf
fi
@@ -70,7 +70,7 @@
. auto/lib/perl/conf
fi
-if [ $HTTP_GEOIP = YES ]; then
+if [ $USE_GEOIP != NO ]; then
. auto/lib/geoip/conf
fi
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/lib/geoip/conf
^
|
@@ -67,7 +67,12 @@
if [ $ngx_found = yes ]; then
CORE_INCS="$CORE_INCS $ngx_feature_path"
- CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+
+ if [ $USE_GEOIP = YES ]; then
+ CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+ fi
+
+ NGX_LIB_GEOIP=$ngx_feature_libs
if [ $NGX_IPV6 = YES ]; then
ngx_feature="GeoIP IPv6 support"
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/lib/libgd/conf
^
|
@@ -67,7 +67,12 @@
if [ $ngx_found = yes ]; then
CORE_INCS="$CORE_INCS $ngx_feature_path"
- CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+
+ if [ $USE_LIBGD = YES ]; then
+ CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+ fi
+
+ NGX_LIB_LIBGD=$ngx_feature_libs
else
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/lib/libxslt/conf
^
|
@@ -76,7 +76,12 @@
if [ $ngx_found = yes ]; then
CORE_INCS="$CORE_INCS $ngx_feature_path"
- CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+
+ if [ $USE_LIBXSLT = YES ]; then
+ CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+ fi
+
+ NGX_LIB_LIBXSLT=$ngx_feature_libs
else
@@ -152,5 +157,9 @@
if [ $ngx_found = yes ]; then
- CORE_LIBS="$CORE_LIBS -lexslt"
+ if [ $USE_LIBXSLT = YES ]; then
+ CORE_LIBS="$CORE_LIBS -lexslt"
+ fi
+
+ NGX_LIB_LIBXSLT="$NGX_LIB_LIBXSLT -lexslt"
fi
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/lib/openssl/conf
^
|
@@ -32,7 +32,6 @@
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
- CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
if [ "$NGX_PLATFORM" = win32 ]; then
CORE_LIBS="$CORE_LIBS -lgdi32 -lcrypt32 -lws2_32"
@@ -106,7 +105,7 @@
if [ $ngx_found = yes ]; then
have=NGX_SSL . auto/have
CORE_INCS="$CORE_INCS $ngx_feature_path"
- CORE_LIBS="$CORE_LIBS $ngx_feature_libs $NGX_LIBDL"
+ CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
OPENSSL=YES
fi
fi
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/make
^
|
@@ -98,9 +98,11 @@
# the mail dependencies and include paths
-if [ $MAIL = YES ]; then
+if [ $MAIL != NO ]; then
- ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS"
+ if [ $MAIL = YES ]; then
+ ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS"
+ fi
ngx_deps=`echo $MAIL_DEPS \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
@@ -124,9 +126,11 @@
# the stream dependencies and include paths
-if [ $STREAM = YES ]; then
+if [ $STREAM != NO ]; then
- ngx_all_srcs="$ngx_all_srcs $STREAM_SRCS"
+ if [ $STREAM = YES ]; then
+ ngx_all_srcs="$ngx_all_srcs $STREAM_SRCS"
+ fi
ngx_deps=`echo $STREAM_DEPS \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
@@ -148,7 +152,7 @@
fi
-ngx_all_srcs="$ngx_all_srcs $NGX_MISC_SRCS"
+ngx_all_srcs="$ngx_all_srcs $MISC_SRCS"
if test -n "$NGX_ADDON_SRCS"; then
@@ -204,6 +208,7 @@
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
+ngx_libs=
if test -n "$NGX_LD_OPT$CORE_LIBS"; then
ngx_libs=`echo $NGX_LD_OPT $CORE_LIBS \
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
@@ -212,13 +217,18 @@
ngx_link=${CORE_LINK:+`echo $CORE_LINK \
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
+ngx_main_link=${MAIN_LINK:+`echo $MAIN_LINK \
+ | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
+
cat << END >> $NGX_MAKEFILE
$NGX_OBJS${ngx_dirsep}nginx${ngx_binext}: $ngx_deps$ngx_spacer
- \$(LINK) ${ngx_long_start}${ngx_binout}$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link
+ \$(LINK) ${ngx_long_start}${ngx_binout}$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main_link
$ngx_rcc
${ngx_long_end}
+
+modules:
END
@@ -365,11 +375,11 @@
# the misc sources
-if test -n "$NGX_MISC_SRCS"; then
+if test -n "$MISC_SRCS"; then
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
- for ngx_src in $NGX_MISC_SRCS
+ for ngx_src in $MISC_SRCS
do
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
ngx_obj=`echo $ngx_src \
@@ -472,3 +482,186 @@
END
fi
+
+
+# dynamic modules
+
+if test -n "$NGX_PCH"; then
+ ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
+else
+ ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) \$(ALL_INCS)"
+fi
+
+ngx_obj_deps="\$(CORE_DEPS)"
+if [ $HTTP != NO ]; then
+ ngx_obj_deps="$ngx_obj_deps \$(HTTP_DEPS)"
+fi
+if [ $MAIL != NO ]; then
+ ngx_obj_deps="$ngx_obj_deps \$(MAIL_DEPS)"
+fi
+if [ $STREAM != NO ]; then
+ ngx_obj_deps="$ngx_obj_deps \$(STREAM_DEPS)"
+fi
+
+for ngx_module in $DYNAMIC_MODULES
+do
+ eval ngx_module_srcs="\$${ngx_module}_SRCS"
+ eval eval ngx_module_libs="\\\"\$${ngx_module}_LIBS\\\""
+
+ eval ngx_module_modules="\$${ngx_module}_MODULES"
+ eval ngx_module_order="\$${ngx_module}_ORDER"
+
+ ngx_modules_c=$NGX_OBJS/${ngx_module}_modules.c
+
+ cat << END > $ngx_modules_c
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+END
+
+ for mod in $ngx_module_modules
+ do
+ echo "extern ngx_module_t $mod;" >> $ngx_modules_c
+ done
+
+ echo >> $ngx_modules_c
+ echo 'ngx_module_t *ngx_modules[] = {' >> $ngx_modules_c
+
+ for mod in $ngx_module_modules
+ do
+ echo " &$mod," >> $ngx_modules_c
+ done
+
+ cat << END >> $ngx_modules_c
+ NULL
+};
+
+END
+
+ echo 'char *ngx_module_names[] = {' >> $ngx_modules_c
+
+ for mod in $ngx_module_modules
+ do
+ echo " \"$mod\"," >> $ngx_modules_c
+ done
+
+ cat << END >> $ngx_modules_c
+ NULL
+};
+
+END
+
+ echo 'char *ngx_module_order[] = {' >> $ngx_modules_c
+
+ for mod in $ngx_module_order
+ do
+ echo " \"$mod\"," >> $ngx_modules_c
+ done
+
+ cat << END >> $ngx_modules_c
+ NULL
+};
+
+END
+
+ ngx_modules_c=`echo $ngx_modules_c | sed -e "s/\//$ngx_regex_dirsep/g"`
+
+ ngx_modules_obj=`echo $ngx_modules_c \
+ | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
+
+ ngx_module_objs=
+ for ngx_src in $ngx_module_srcs
+ do
+ case "$ngx_src" in
+ src/*)
+ ngx_obj=$ngx_src
+ ;;
+ *)
+ ngx_obj="addon/`basename \`dirname $ngx_src\``"
+ mkdir -p $NGX_OBJS/$ngx_obj
+ ngx_obj="$ngx_obj/`basename $ngx_src`"
+ ;;
+ esac
+
+ ngx_module_objs="$ngx_module_objs $ngx_obj"
+ done
+
+ ngx_module_objs=`echo $ngx_module_objs \
+ | sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \
+ -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
+ -e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \
+ -e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`
+
+ ngx_deps=`echo $ngx_module_objs $ngx_modules_obj $LINK_DEPS \
+ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
+ -e "s/\//$ngx_regex_dirsep/g"`
+
+ ngx_objs=`echo $ngx_module_objs $ngx_modules_obj \
+ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
+ -e "s/\//$ngx_regex_dirsep/g"`
+
+ ngx_obj=$NGX_OBJS${ngx_dirsep}${ngx_module}${ngx_modext}
+
+ NGX_MODULES="$NGX_MODULES $ngx_obj"
+
+ if [ "$NGX_PLATFORM" = win32 ]; then
+ ngx_module_libs="$CORE_LIBS $ngx_module_libs"
+ fi
+
+ ngx_libs=
+ if test -n "$NGX_LD_OPT$ngx_module_libs"; then
+ ngx_libs=`echo $NGX_LD_OPT $ngx_module_libs \
+ | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
+ fi
+
+ ngx_link=${CORE_LINK:+`echo $CORE_LINK \
+ | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
+
+ ngx_module_link=${MODULE_LINK:+`echo $MODULE_LINK \
+ | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
+
+
+ cat << END >> $NGX_MAKEFILE
+
+modules: $ngx_obj
+
+$ngx_obj: $ngx_deps$ngx_spacer
+ \$(LINK) $ngx_long_start$ngx_binout$ngx_obj$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_module_link
+$ngx_long_end
+
+$ngx_modules_obj: \$(CORE_DEPS)$ngx_cont$ngx_modules_c
+ $ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUX
+
+END
+
+ for ngx_src in $ngx_module_srcs
+ do
+ case "$ngx_src" in
+ src/*)
+ ngx_obj=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
+ ;;
+ *)
+ ngx_obj="addon/`basename \`dirname $ngx_src\``"
+ ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
+ | sed -e "s/\//$ngx_regex_dirsep/g"`
+ ;;
+ esac
+
+ ngx_obj=`echo $ngx_obj \
+ | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
+ -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
+ -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
+ -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
+
+ ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
+
+ cat << END >> $NGX_MAKEFILE
+
+$ngx_obj: $ngx_obj_deps$ngx_cont$ngx_src
+ $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
+
+END
+
+ done
+done
|
[-]
[+]
|
Added |
nginx-1.9.11.tar.bz2/auto/module
^
|
@@ -0,0 +1,122 @@
+
+# Copyright (C) Ruslan Ermilov
+# Copyright (C) Nginx, Inc.
+
+
+case $ngx_module_type in
+ HTTP_*) ngx_var=HTTP ;;
+ *) ngx_var=$ngx_module_type ;;
+esac
+
+
+if [ "$ngx_module_link" = DYNAMIC ]; then
+
+ for ngx_module in $ngx_module_name; do
+ # extract the first name
+ break
+ done
+
+ DYNAMIC_MODULES="$DYNAMIC_MODULES $ngx_module"
+ eval ${ngx_module}_SRCS=\"$ngx_module_srcs\"
+
+ eval ${ngx_module}_MODULES=\"$ngx_module_name\"
+
+ if [ -z "$ngx_module_order" -a \
+ \( "$ngx_module_type" = "HTTP_FILTER" \
+ -o "$ngx_module_type" = "HTTP_AUX_FILTER" \) ]
+ then
+ eval ${ngx_module}_ORDER=\"$ngx_module_name \
+ ngx_http_copy_filter_module\"
+ else
+ eval ${ngx_module}_ORDER=\"$ngx_module_order\"
+ fi
+
+ if test -n "$ngx_module_incs"; then
+ CORE_INCS="$CORE_INCS $ngx_module_incs"
+ fi
+
+ libs=
+ for lib in $ngx_module_libs
+ do
+ case $lib in
+
+ LIBXSLT | LIBGD | GEOIP)
+ libs="$libs \$NGX_LIB_$lib"
+
+ if eval [ "\$USE_${lib}" = NO ] ; then
+ eval USE_${lib}=DYNAMIC
+ fi
+ ;;
+
+ PCRE | OPENSSL | MD5 | SHA1 | ZLIB | PERL)
+ eval USE_${lib}=YES
+ ;;
+
+ *)
+ libs="$libs $lib"
+ ;;
+
+ esac
+ done
+ eval ${ngx_module}_LIBS=\'$libs\'
+
+elif [ "$ngx_module_link" = YES ]; then
+
+ eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \
+ $ngx_module_name\"
+
+ eval ${ngx_var}_SRCS=\"\$${ngx_var}_SRCS $ngx_module_srcs\"
+
+ if test -n "$ngx_module_incs"; then
+ eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\"
+ fi
+
+ if test -n "$ngx_module_deps"; then
+ eval ${ngx_var}_DEPS=\"\$${ngx_var}_DEPS $ngx_module_deps\"
+ fi
+
+ for lib in $ngx_module_libs
+ do
+ case $lib in
+
+ PCRE | OPENSSL | MD5 | SHA1 | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP)
+ eval USE_${lib}=YES
+ ;;
+
+ *)
+ CORE_LIBS="$CORE_LIBS $lib"
+ ;;
+
+ esac
+ done
+
+elif [ "$ngx_module_link" = ADDON ]; then
+
+ eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \
+ $ngx_module_name\"
+
+ NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_module_srcs"
+
+ if test -n "$ngx_module_incs"; then
+ eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\"
+ fi
+
+ if test -n "$ngx_module_deps"; then
+ NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_module_deps"
+ fi
+
+ for lib in $ngx_module_libs
+ do
+ case $lib in
+
+ PCRE | OPENSSL | MD5 | SHA1 | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP)
+ eval USE_${lib}=YES
+ ;;
+
+ *)
+ CORE_LIBS="$CORE_LIBS $lib"
+ ;;
+
+ esac
+ done
+fi
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/modules
^
|
@@ -55,6 +55,45 @@
fi
+HTTP_MODULES=
+HTTP_DEPS=
+HTTP_INCS=
+
+ngx_module_type=HTTP
+
+if :; then
+ ngx_module_name="ngx_http_module \
+ ngx_http_core_module \
+ ngx_http_log_module \
+ ngx_http_upstream_module"
+ ngx_module_incs="src/http src/http/modules"
+ ngx_module_deps="src/http/ngx_http.h \
+ src/http/ngx_http_request.h \
+ src/http/ngx_http_config.h \
+ src/http/ngx_http_core_module.h \
+ src/http/ngx_http_cache.h \
+ src/http/ngx_http_variables.h \
+ src/http/ngx_http_script.h \
+ src/http/ngx_http_upstream.h \
+ src/http/ngx_http_upstream_round_robin.h"
+ ngx_module_srcs="src/http/ngx_http.c \
+ src/http/ngx_http_core_module.c \
+ src/http/ngx_http_special_response.c \
+ src/http/ngx_http_request.c \
+ src/http/ngx_http_parse.c \
+ src/http/modules/ngx_http_log_module.c \
+ src/http/ngx_http_request_body.c \
+ src/http/ngx_http_variables.c \
+ src/http/ngx_http_script.c \
+ src/http/ngx_http_upstream.c \
+ src/http/ngx_http_upstream_round_robin.c"
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
+fi
+
+
if [ $HTTP != YES ]; then
have=NGX_CRYPT . auto/nohave
CRYPT_LIB=
@@ -117,297 +156,903 @@
# ngx_http_not_modified_filter
# ngx_http_slice_filter
-HTTP_FILTER_MODULES="$HTTP_WRITE_FILTER_MODULE \
- $HTTP_HEADER_FILTER_MODULE \
- $HTTP_CHUNKED_FILTER_MODULE"
+ngx_module_type=HTTP_FILTER
+HTTP_FILTER_MODULES=
-if [ $HTTP_V2 = YES ]; then
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_V2_FILTER_MODULE"
+ngx_module_order="ngx_http_static_module \
+ ngx_http_gzip_static_module \
+ ngx_http_dav_module \
+ ngx_http_autoindex_module \
+ ngx_http_index_module \
+ ngx_http_random_index_module \
+ ngx_http_access_module \
+ ngx_http_realip_module \
+ ngx_http_write_filter_module \
+ ngx_http_header_filter_module \
+ ngx_http_chunked_filter_module \
+ ngx_http_v2_filter_module \
+ ngx_http_range_header_filter_module \
+ ngx_http_gzip_filter_module \
+ ngx_http_postpone_filter_module \
+ ngx_http_ssi_filter_module \
+ ngx_http_charset_filter_module \
+ ngx_http_xslt_filter_module \
+ ngx_http_image_filter_module \
+ ngx_http_sub_filter_module \
+ ngx_http_addition_filter_module \
+ ngx_http_gunzip_filter_module \
+ ngx_http_userid_filter_module \
+ ngx_http_headers_filter_module \
+ ngx_http_copy_filter_module \
+ ngx_http_range_body_filter_module \
+ ngx_http_not_modified_filter_module \
+ ngx_http_slice_filter_module"
+
+if :; then
+ ngx_module_name=ngx_http_write_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/ngx_http_write_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
+fi
+
+if :; then
+ ngx_module_name=ngx_http_header_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/ngx_http_header_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
+fi
+
+if :; then
+ ngx_module_name=ngx_http_chunked_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_chunked_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
fi
-HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_RANGE_HEADER_FILTER_MODULE"
+if [ $HTTP_V2 = YES ]; then
+ ngx_module_name=ngx_http_v2_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/v2/ngx_http_v2_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_V2
+
+ . auto/module
+fi
+
+if :; then
+ ngx_module_name=ngx_http_range_header_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_range_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
+fi
if [ $HTTP_GZIP = YES ]; then
have=NGX_HTTP_GZIP . auto/have
USE_ZLIB=YES
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_GZIP_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_GZIP_SRCS"
+
+ ngx_module_name=ngx_http_gzip_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_gzip_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_GZIP
+
+ . auto/module
fi
if [ $HTTP_POSTPONE = YES ]; then
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_POSTPONE_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_POSTPONE_FILTER_SRCS"
+ ngx_module_name=ngx_http_postpone_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/ngx_http_postpone_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_POSTPONE
+
+ . auto/module
fi
if [ $HTTP_SSI = YES ]; then
have=NGX_HTTP_SSI . auto/have
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SSI_FILTER_MODULE"
- HTTP_DEPS="$HTTP_DEPS $HTTP_SSI_DEPS"
- HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS"
-fi
-if [ $HTTP_CHARSET = YES ]; then
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_CHARSET_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_CHARSET_SRCS"
-fi
+ ngx_module_name=ngx_http_ssi_filter_module
+ ngx_module_incs=
+ ngx_module_deps=src/http/modules/ngx_http_ssi_filter_module.h
+ ngx_module_srcs=src/http/modules/ngx_http_ssi_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_SSI
-if [ $HTTP_XSLT = YES ]; then
- USE_LIBXSLT=YES
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_XSLT_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_XSLT_SRCS"
+ . auto/module
fi
-if [ $HTTP_IMAGE_FILTER = YES ]; then
- USE_LIBGD=YES
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_IMAGE_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_IMAGE_SRCS"
+if [ $HTTP_CHARSET = YES ]; then
+ ngx_module_name=ngx_http_charset_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_charset_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_CHARSET
+
+ . auto/module
+fi
+
+if [ $HTTP_XSLT != NO ]; then
+ ngx_module_name=ngx_http_xslt_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_xslt_filter_module.c
+ ngx_module_libs=LIBXSLT
+ ngx_module_link=$HTTP_XSLT
+
+ . auto/module
+fi
+
+if [ $HTTP_IMAGE_FILTER != NO ]; then
+ ngx_module_name=ngx_http_image_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_image_filter_module.c
+ ngx_module_libs=LIBGD
+ ngx_module_link=$HTTP_IMAGE_FILTER
+
+ . auto/module
fi
if [ $HTTP_SUB = YES ]; then
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SUB_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_SUB_SRCS"
+ ngx_module_name=ngx_http_sub_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_sub_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_SUB
+
+ . auto/module
fi
if [ $HTTP_ADDITION = YES ]; then
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_ADDITION_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_ADDITION_SRCS"
+ ngx_module_name=ngx_http_addition_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_addition_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_ADDITION
+
+ . auto/module
fi
if [ $HTTP_GUNZIP = YES ]; then
have=NGX_HTTP_GZIP . auto/have
USE_ZLIB=YES
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_GUNZIP_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_GUNZIP_SRCS"
+
+ ngx_module_name=ngx_http_gunzip_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_gunzip_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_GUNZIP
+
+ . auto/module
fi
if [ $HTTP_USERID = YES ]; then
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_USERID_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_USERID_SRCS"
+ ngx_module_name=ngx_http_userid_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_userid_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_USERID
+
+ . auto/module
+fi
+
+if :; then
+ ngx_module_name=ngx_http_headers_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_headers_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
+fi
+
+
+ngx_module_type=HTTP_INIT_FILTER
+HTTP_INIT_FILTER_MODULES=
+
+if :; then
+ ngx_module_name=ngx_http_copy_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/ngx_http_copy_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
+fi
+
+if :; then
+ ngx_module_name=ngx_http_range_body_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
+fi
+
+if :; then
+ ngx_module_name=ngx_http_not_modified_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_not_modified_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
fi
if [ $HTTP_SLICE = YES ]; then
- HTTP_SRCS="$HTTP_SRCS $HTTP_SLICE_SRCS"
-else
- HTTP_SLICE_FILTER_MODULE=""
+ ngx_module_name=ngx_http_slice_filter_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_slice_filter_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_SLICE
+
+ . auto/module
fi
+ngx_module_type=HTTP
+
if [ $HTTP_V2 = YES ]; then
have=NGX_HTTP_V2 . auto/have
- HTTP_MODULES="$HTTP_MODULES $HTTP_V2_MODULE"
- HTTP_INCS="$HTTP_INCS $HTTP_V2_INCS"
- HTTP_DEPS="$HTTP_DEPS $HTTP_V2_DEPS"
- HTTP_SRCS="$HTTP_SRCS $HTTP_V2_SRCS"
-fi
-HTTP_MODULES="$HTTP_MODULES $HTTP_STATIC_MODULE"
+ ngx_module_name=ngx_http_v2_module
+ ngx_module_incs=src/http/v2
+ ngx_module_deps="src/http/v2/ngx_http_v2.h src/http/v2/ngx_http_v2_module.h"
+ ngx_module_srcs="src/http/v2/ngx_http_v2.c \
+ src/http/v2/ngx_http_v2_table.c \
+ src/http/v2/ngx_http_v2_huff_decode.c \
+ src/http/v2/ngx_http_v2_huff_encode.c \
+ src/http/v2/ngx_http_v2_module.c"
+ ngx_module_libs=
+ ngx_module_link=$HTTP_V2
+
+ . auto/module
+fi
+
+if :; then
+ ngx_module_name=ngx_http_static_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_static_module.c
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ . auto/module
+fi
if [ $HTTP_GZIP_STATIC = YES ]; then
have=NGX_HTTP_GZIP . auto/have
- HTTP_MODULES="$HTTP_MODULES $HTTP_GZIP_STATIC_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_GZIP_STATIC_SRCS"
+
+ ngx_module_name=ngx_http_gzip_static_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_gzip_static_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_GZIP_STATIC
+
+ . auto/module
fi
if [ $HTTP_DAV = YES ]; then
have=NGX_HTTP_DAV . auto/have
- HTTP_MODULES="$HTTP_MODULES $HTTP_DAV_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_DAV_SRCS"
+
+ ngx_module_name=ngx_http_dav_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_dav_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_DAV
+
+ . auto/module
fi
if [ $HTTP_AUTOINDEX = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_AUTOINDEX_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_AUTOINDEX_SRCS"
-fi
+ ngx_module_name=ngx_http_autoindex_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_autoindex_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_AUTOINDEX
+
+ . auto/module
+fi
+
+if :; then
+ ngx_module_name=ngx_http_index_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_index_module.c
+ ngx_module_libs=
+ ngx_module_link=YES
-HTTP_MODULES="$HTTP_MODULES $HTTP_INDEX_MODULE"
+ . auto/module
+fi
if [ $HTTP_RANDOM_INDEX = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_RANDOM_INDEX_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_RANDOM_INDEX_SRCS"
+ ngx_module_name=ngx_http_random_index_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_random_index_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_RANDOM_INDEX
+
+ . auto/module
fi
if [ $HTTP_AUTH_REQUEST = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_AUTH_REQUEST_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_AUTH_REQUEST_SRCS"
+ ngx_module_name=ngx_http_auth_request_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_auth_request_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_AUTH_REQUEST
+
+ . auto/module
fi
if [ $HTTP_AUTH_BASIC = YES ]; then
USE_MD5=YES
USE_SHA1=YES
have=NGX_CRYPT . auto/have
- HTTP_MODULES="$HTTP_MODULES $HTTP_AUTH_BASIC_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_AUTH_BASIC_SRCS"
+
+ ngx_module_name=ngx_http_auth_basic_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_auth_basic_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_AUTH_BASIC
+
+ . auto/module
CORE_LIBS="$CORE_LIBS $CRYPT_LIB"
fi
if [ $HTTP_ACCESS = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_ACCESS_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_ACCESS_SRCS"
+ ngx_module_name=ngx_http_access_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_access_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_ACCESS
+
+ . auto/module
fi
if [ $HTTP_LIMIT_CONN = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_LIMIT_CONN_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_LIMIT_CONN_SRCS"
+ ngx_module_name=ngx_http_limit_conn_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_limit_conn_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_LIMIT_CONN
+
+ . auto/module
fi
if [ $HTTP_LIMIT_REQ = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_LIMIT_REQ_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_LIMIT_REQ_SRCS"
+ ngx_module_name=ngx_http_limit_req_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_limit_req_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_LIMIT_REQ
+
+ . auto/module
fi
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"
+
+ ngx_module_name=ngx_http_realip_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_realip_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_REALIP
+
+ . auto/module
fi
if [ $HTTP_STATUS = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_STATUS_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_STATUS_SRCS"
+ ngx_module_name=ngx_http_status_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_status_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_STATUS
+
+ . auto/module
fi
if [ $HTTP_GEO = YES ]; then
have=NGX_HTTP_X_FORWARDED_FOR . auto/have
- HTTP_MODULES="$HTTP_MODULES $HTTP_GEO_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_GEO_SRCS"
+
+ ngx_module_name=ngx_http_geo_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_geo_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_GEO
+
+ . auto/module
fi
-if [ $HTTP_GEOIP = YES ]; then
+if [ $HTTP_GEOIP != NO ]; then
have=NGX_HTTP_X_FORWARDED_FOR . auto/have
- HTTP_MODULES="$HTTP_MODULES $HTTP_GEOIP_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_GEOIP_SRCS"
+
+ ngx_module_name=ngx_http_geoip_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_geoip_module.c
+ ngx_module_libs=GEOIP
+ ngx_module_link=$HTTP_GEOIP
+
+ . auto/module
fi
if [ $HTTP_MAP = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_MAP_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_MAP_SRCS"
+ ngx_module_name=ngx_http_map_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_map_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_MAP
+
+ . auto/module
fi
if [ $HTTP_SPLIT_CLIENTS = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_SPLIT_CLIENTS_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_SPLIT_CLIENTS_SRCS"
+ ngx_module_name=ngx_http_split_clients_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_split_clients_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_SPLIT_CLIENTS
+
+ . auto/module
fi
if [ $HTTP_REFERER = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_REFERER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_REFERER_SRCS"
+ ngx_module_name=ngx_http_referer_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_referer_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_REFERER
+
+ . auto/module
fi
if [ $HTTP_REWRITE = YES -a $USE_PCRE != DISABLED ]; then
USE_PCRE=YES
- HTTP_MODULES="$HTTP_MODULES $HTTP_REWRITE_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_REWRITE_SRCS"
+
+ ngx_module_name=ngx_http_rewrite_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_rewrite_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_REWRITE
+
+ . auto/module
fi
if [ $HTTP_SSL = YES ]; then
USE_OPENSSL=YES
have=NGX_HTTP_SSL . auto/have
- HTTP_MODULES="$HTTP_MODULES $HTTP_SSL_MODULE"
- HTTP_DEPS="$HTTP_DEPS $HTTP_SSL_DEPS"
- HTTP_SRCS="$HTTP_SRCS $HTTP_SSL_SRCS"
+
+ ngx_module_name=ngx_http_ssl_module
+ ngx_module_incs=
+ ngx_module_deps=src/http/modules/ngx_http_ssl_module.h
+ ngx_module_srcs=src/http/modules/ngx_http_ssl_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_SSL
+
+ . auto/module
fi
if [ $HTTP_PROXY = YES ]; then
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"
- HTTP_SRCS="$HTTP_SRCS $HTTP_PROXY_SRCS"
+
+ ngx_module_name=ngx_http_proxy_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_proxy_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_PROXY
+
+ . auto/module
fi
if [ $HTTP_FASTCGI = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_FASTCGI_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_FASTCGI_SRCS"
+ ngx_module_name=ngx_http_fastcgi_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_fastcgi_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_FASTCGI
+
+ . auto/module
fi
if [ $HTTP_UWSGI = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_UWSGI_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_UWSGI_SRCS"
+ ngx_module_name=ngx_http_uwsgi_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_uwsgi_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_UWSGI
+
+ . auto/module
fi
if [ $HTTP_SCGI = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_SCGI_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_SCGI_SRCS"
+ ngx_module_name=ngx_http_scgi_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_scgi_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_SCGI
+
+ . auto/module
fi
if [ $HTTP_PERL = YES ]; then
USE_PERL=YES
- HTTP_MODULES="$HTTP_MODULES $HTTP_PERL_MODULE"
- HTTP_INCS="$HTTP_INCS $HTTP_PERL_INCS"
- HTTP_DEPS="$HTTP_DEPS $HTTP_PERL_DEPS"
- HTTP_SRCS="$HTTP_SRCS $HTTP_PERL_SRCS"
+
+ ngx_module_name=ngx_http_perl_module
+ ngx_module_incs=src/http/modules/perl
+ ngx_module_deps=src/http/modules/perl/ngx_http_perl_module.h
+ ngx_module_srcs=src/http/modules/perl/ngx_http_perl_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_PERL
+
+ . auto/module
fi
if [ $HTTP_MEMCACHED = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_MEMCACHED_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_MEMCACHED_SRCS"
+ ngx_module_name=ngx_http_memcached_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_memcached_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_MEMCACHED
+
+ . auto/module
fi
if [ $HTTP_EMPTY_GIF = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_EMPTY_GIF_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_EMPTY_GIF_SRCS"
+ ngx_module_name=ngx_http_empty_gif_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_empty_gif_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_EMPTY_GIF
+
+ . auto/module
fi
if [ $HTTP_BROWSER = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_BROWSER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_BROWSER_SRCS"
+ ngx_module_name=ngx_http_browser_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_browser_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_BROWSER
+
+ . auto/module
fi
if [ $HTTP_SECURE_LINK = YES ]; then
USE_MD5=YES
- HTTP_MODULES="$HTTP_MODULES $HTTP_SECURE_LINK_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_SECURE_LINK_SRCS"
+
+ ngx_module_name=ngx_http_secure_link_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_secure_link_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_SECURE_LINK
+
+ . auto/module
fi
if [ $HTTP_DEGRADATION = YES ]; then
have=NGX_HTTP_DEGRADATION . auto/have
- HTTP_MODULES="$HTTP_MODULES $HTTP_DEGRADATION_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_DEGRADATION_SRCS"
+
+ ngx_module_name=ngx_http_degradation_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_degradation_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_DEGRADATION
+
+ . auto/module
fi
if [ $HTTP_FLV = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_FLV_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_FLV_SRCS"
+ ngx_module_name=ngx_http_flv_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_flv_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_FLV
+
+ . auto/module
fi
if [ $HTTP_MP4 = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_MP4_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_MP4_SRCS"
+ ngx_module_name=ngx_http_mp4_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_mp4_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_MP4
+
+ . auto/module
fi
if [ $HTTP_UPSTREAM_HASH = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_HASH_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_HASH_SRCS"
+ ngx_module_name=ngx_http_upstream_hash_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_upstream_hash_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_UPSTREAM_HASH
+
+ . auto/module
fi
if [ $HTTP_UPSTREAM_IP_HASH = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_IP_HASH_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_IP_HASH_SRCS"
+ ngx_module_name=ngx_http_upstream_ip_hash_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_upstream_ip_hash_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_UPSTREAM_IP_HASH
+
+ . auto/module
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"
+ ngx_module_name=ngx_http_upstream_least_conn_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_upstream_least_conn_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_UPSTREAM_LEAST_CONN
+
+ . auto/module
fi
if [ $HTTP_UPSTREAM_KEEPALIVE = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_KEEPALIVE_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_KEEPALIVE_SRCS"
+ ngx_module_name=ngx_http_upstream_keepalive_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_upstream_keepalive_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_UPSTREAM_KEEPALIVE
+
+ . auto/module
fi
if [ $HTTP_UPSTREAM_ZONE = YES ]; then
have=NGX_HTTP_UPSTREAM_ZONE . auto/have
- HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_ZONE_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_ZONE_SRCS"
+
+ ngx_module_name=ngx_http_upstream_zone_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_upstream_zone_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_UPSTREAM_ZONE
+
+ . auto/module
fi
if [ $HTTP_STUB_STATUS = YES ]; then
have=NGX_STAT_STUB . auto/have
- HTTP_MODULES="$HTTP_MODULES ngx_http_stub_status_module"
- HTTP_SRCS="$HTTP_SRCS src/http/modules/ngx_http_stub_status_module.c"
+
+ ngx_module_name=ngx_http_stub_status_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_stub_status_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_STUB_STATUS
+
+ . auto/module
+fi
+
+
+if [ $MAIL != NO ]; then
+ MAIL_MODULES=
+ MAIL_DEPS=
+ MAIL_INCS=
+
+ ngx_module_type=MAIL
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ ngx_module_order=
+
+ ngx_module_name="ngx_mail_module ngx_mail_core_module"
+ ngx_module_incs="src/mail"
+ ngx_module_deps="src/mail/ngx_mail.h"
+ ngx_module_srcs="src/mail/ngx_mail.c \
+ src/mail/ngx_mail_core_module.c \
+ src/mail/ngx_mail_handler.c \
+ src/mail/ngx_mail_parse.c"
+
+ . auto/module
+
+ ngx_module_incs=
+
+ if [ $MAIL_SSL = YES ]; then
+ USE_OPENSSL=YES
+ have=NGX_MAIL_SSL . auto/have
+
+ ngx_module_name=ngx_mail_ssl_module
+ ngx_module_deps=src/mail/ngx_mail_ssl_module.h
+ ngx_module_srcs=src/mail/ngx_mail_ssl_module.c
+
+ . auto/module
+ fi
+
+ if [ $MAIL_POP3 = YES ]; then
+ ngx_module_name=ngx_mail_pop3_module
+ ngx_module_deps=src/mail/ngx_mail_pop3_module.h
+ ngx_module_srcs="src/mail/ngx_mail_pop3_module.c \
+ src/mail/ngx_mail_pop3_handler.c"
+
+ . auto/module
+ fi
+
+ if [ $MAIL_IMAP = YES ]; then
+ ngx_module_name=ngx_mail_imap_module
+ ngx_module_deps=src/mail/ngx_mail_imap_module.h
+ ngx_module_srcs="src/mail/ngx_mail_imap_module.c \
+ src/mail/ngx_mail_imap_handler.c"
+
+ . auto/module
+ fi
+
+ if [ $MAIL_SMTP = YES ]; then
+ ngx_module_name=ngx_mail_smtp_module
+ ngx_module_deps=src/mail/ngx_mail_smtp_module.h
+ ngx_module_srcs="src/mail/ngx_mail_smtp_module.c \
+ src/mail/ngx_mail_smtp_handler.c"
+
+ . auto/module
+ fi
+
+ ngx_module_name=ngx_mail_auth_http_module
+ ngx_module_deps=
+ ngx_module_srcs=src/mail/ngx_mail_auth_http_module.c
+
+ . auto/module
+
+ ngx_module_name=ngx_mail_proxy_module
+ ngx_module_deps=
+ ngx_module_srcs=src/mail/ngx_mail_proxy_module.c
+
+ . auto/module
fi
+
+if [ $STREAM != NO ]; then
+ STREAM_MODULES=
+ STREAM_DEPS=
+ STREAM_INCS=
+
+ ngx_module_type=STREAM
+ ngx_module_libs=
+ ngx_module_link=YES
+
+ ngx_module_order=
+
+ ngx_module_name="ngx_stream_module \
+ ngx_stream_core_module \
+ ngx_stream_proxy_module \
+ ngx_stream_upstream_module"
+ ngx_module_incs="src/stream"
+ ngx_module_deps="src/stream/ngx_stream.h \
+ src/stream/ngx_stream_upstream.h \
+ src/stream/ngx_stream_upstream_round_robin.h"
+ ngx_module_srcs="src/stream/ngx_stream.c \
+ src/stream/ngx_stream_handler.c \
+ src/stream/ngx_stream_core_module.c \
+ src/stream/ngx_stream_proxy_module.c \
+ src/stream/ngx_stream_upstream.c \
+ src/stream/ngx_stream_upstream_round_robin.c"
+
+ . auto/module
+
+ ngx_module_incs=
+
+ if [ $STREAM_SSL = YES ]; then
+ USE_OPENSSL=YES
+ have=NGX_STREAM_SSL . auto/have
+
+ ngx_module_name=ngx_stream_ssl_module
+ ngx_module_deps=src/stream/ngx_stream_ssl_module.h
+ ngx_module_srcs=src/stream/ngx_stream_ssl_module.c
+
+ . auto/module
+ fi
+
+ if [ $STREAM_LIMIT_CONN = YES ]; then
+ ngx_module_name=ngx_stream_limit_conn_module
+ ngx_module_deps=
+ ngx_module_srcs=src/stream/ngx_stream_limit_conn_module.c
+
+ . auto/module
+ fi
+
+ if [ $STREAM_ACCESS = YES ]; then
+ ngx_module_name=ngx_stream_access_module
+ ngx_module_deps=
+ ngx_module_srcs=src/stream/ngx_stream_access_module.c
+
+ . auto/module
+ fi
+
+ if [ $STREAM_UPSTREAM_HASH = YES ]; then
+ ngx_module_name=ngx_stream_upstream_hash_module
+ ngx_module_deps=
+ ngx_module_srcs=src/stream/ngx_stream_upstream_hash_module.c
+
+ . auto/module
+ fi
+
+ if [ $STREAM_UPSTREAM_LEAST_CONN = YES ]; then
+ ngx_module_name=ngx_stream_upstream_least_conn_module
+ ngx_module_deps=
+ ngx_module_srcs=src/stream/ngx_stream_upstream_least_conn_module.c
+
+ . auto/module
+ fi
+
+ if [ $STREAM_UPSTREAM_ZONE = YES ]; then
+ have=NGX_STREAM_UPSTREAM_ZONE . auto/have
+
+ ngx_module_name=ngx_stream_upstream_zone_module
+ ngx_module_deps=
+ ngx_module_srcs=src/stream/ngx_stream_upstream_zone_module.c
+
+ . auto/module
+ fi
+fi
+
+
#if [ -r $NGX_OBJS/auto ]; then
# . $NGX_OBJS/auto
#fi
@@ -421,6 +1066,15 @@
do
echo "adding module in $ngx_addon_dir"
+ ngx_module_type=
+ ngx_module_name=
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=
+ ngx_module_libs=
+ ngx_module_order=
+ ngx_module_link=ADDON
+
if test -f $ngx_addon_dir/config; then
. $ngx_addon_dir/config
@@ -434,140 +1088,149 @@
fi
-if [ $MAIL_SSL = YES ]; then
- have=NGX_MAIL_SSL . auto/have
- USE_OPENSSL=YES
-fi
+if test -n "$DYNAMIC_ADDONS"; then
+ echo configuring additional dynamic modules
-if [ $STREAM_SSL = YES ]; then
- have=NGX_STREAM_SSL . auto/have
- USE_OPENSSL=YES
-fi
+ for ngx_addon_dir in $DYNAMIC_ADDONS
+ do
+ echo "adding module in $ngx_addon_dir"
+ ngx_module_type=
+ ngx_module_name=
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=
+ ngx_module_libs=
+ ngx_module_order=
+ ngx_module_link=DYNAMIC
-modules="$CORE_MODULES $EVENT_MODULES"
+ if test -f $ngx_addon_dir/config; then
+ . $ngx_addon_dir/config
+ echo " + $ngx_addon_name was configured"
-# thread pool module should be initialized after events
-if [ $USE_THREADS = YES ]; then
- modules="$modules $THREAD_POOL_MODULE"
+ else
+ echo "$0: error: no $ngx_addon_dir/config was found"
+ exit 1
+ fi
+ done
fi
if [ $USE_OPENSSL = YES ]; then
- modules="$modules $OPENSSL_MODULE"
- CORE_DEPS="$CORE_DEPS $OPENSSL_DEPS"
- CORE_SRCS="$CORE_SRCS $OPENSSL_SRCS"
+ ngx_module_type=CORE
+ ngx_module_name=ngx_openssl_module
+ ngx_module_incs=
+ ngx_module_deps=src/event/ngx_event_openssl.h
+ ngx_module_srcs="src/event/ngx_event_openssl.c
+ src/event/ngx_event_openssl_stapling.c"
+ ngx_module_libs=
+ ngx_module_link=YES
+ ngx_module_order=
+
+ . auto/module
fi
+
if [ $USE_PCRE = YES ]; then
- modules="$modules $REGEX_MODULE"
- CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
- CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
+ ngx_module_type=CORE
+ ngx_module_name=ngx_regex_module
+ ngx_module_incs=
+ ngx_module_deps=src/core/ngx_regex.h
+ ngx_module_srcs=src/core/ngx_regex.c
+ ngx_module_libs=
+ ngx_module_link=YES
+ ngx_module_order=
+
+ . auto/module
fi
+
+modules="$CORE_MODULES $EVENT_MODULES"
+
+
+# thread pool module should be initialized after events
+if [ $USE_THREADS = YES ]; then
+ modules="$modules $THREAD_POOL_MODULE"
+fi
+
+
if [ $HTTP = YES ]; then
modules="$modules $HTTP_MODULES $HTTP_FILTER_MODULES \
- $HTTP_HEADERS_FILTER_MODULE \
- $HTTP_AUX_FILTER_MODULES \
- $HTTP_COPY_FILTER_MODULE \
- $HTTP_RANGE_BODY_FILTER_MODULE \
- $HTTP_NOT_MODIFIED_FILTER_MODULE \
- $HTTP_SLICE_FILTER_MODULE"
+ $HTTP_AUX_FILTER_MODULES $HTTP_INIT_FILTER_MODULES"
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(HTTP_DEPS)"
fi
-if [ $MAIL = YES ]; then
- modules="$modules $MAIL_MODULES"
+if [ $MAIL != NO ]; then
- if [ $MAIL_SSL = YES ]; then
- modules="$modules $MAIL_SSL_MODULE"
- MAIL_DEPS="$MAIL_DEPS $MAIL_SSL_DEPS"
- MAIL_SRCS="$MAIL_SRCS $MAIL_SSL_SRCS"
- fi
-
- if [ $MAIL_POP3 = YES ]; then
- modules="$modules $MAIL_POP3_MODULE"
- MAIL_DEPS="$MAIL_DEPS $MAIL_POP3_DEPS"
- MAIL_SRCS="$MAIL_SRCS $MAIL_POP3_SRCS"
- fi
+ if [ $MAIL = YES ]; then
+ modules="$modules $MAIL_MODULES"
- if [ $MAIL_IMAP = YES ]; then
- modules="$modules $MAIL_IMAP_MODULE"
- MAIL_DEPS="$MAIL_DEPS $MAIL_IMAP_DEPS"
- MAIL_SRCS="$MAIL_SRCS $MAIL_IMAP_SRCS"
- fi
+ elif [ $MAIL = DYNAMIC ]; then
+ ngx_module_name=$MAIL_MODULES
+ ngx_module_incs=
+ ngx_module_deps=$MAIL_DEPS
+ ngx_module_srcs=$MAIL_SRCS
+ ngx_module_libs=
+ ngx_module_link=DYNAMIC
- if [ $MAIL_SMTP = YES ]; then
- modules="$modules $MAIL_SMTP_MODULE"
- MAIL_DEPS="$MAIL_DEPS $MAIL_SMTP_DEPS"
- MAIL_SRCS="$MAIL_SRCS $MAIL_SMTP_SRCS"
+ . auto/module
fi
- modules="$modules $MAIL_AUTH_HTTP_MODULE"
- MAIL_SRCS="$MAIL_SRCS $MAIL_AUTH_HTTP_SRCS"
-
- modules="$modules $MAIL_PROXY_MODULE"
- MAIL_SRCS="$MAIL_SRCS $MAIL_PROXY_SRCS"
-
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(MAIL_DEPS)"
fi
-if [ $STREAM = YES ]; then
- have=NGX_STREAM . auto/have
- modules="$modules $STREAM_MODULES"
+if [ $STREAM != NO ]; then
- if [ $STREAM_SSL = YES ]; then
- modules="$modules $STREAM_SSL_MODULE"
- STREAM_DEPS="$STREAM_DEPS $STREAM_SSL_DEPS"
- STREAM_SRCS="$STREAM_SRCS $STREAM_SSL_SRCS"
- fi
-
- if [ $STREAM_LIMIT_CONN = YES ]; then
- modules="$modules $STREAM_LIMIT_CONN_MODULE"
- STREAM_SRCS="$STREAM_SRCS $STREAM_LIMIT_CONN_SRCS"
- fi
-
- if [ $STREAM_ACCESS = YES ]; then
- modules="$modules $STREAM_ACCESS_MODULE"
- STREAM_SRCS="$STREAM_SRCS $STREAM_ACCESS_SRCS"
- fi
+ if [ $STREAM = YES ]; then
+ modules="$modules $STREAM_MODULES"
- if [ $STREAM_UPSTREAM_HASH = YES ]; then
- modules="$modules $STREAM_UPSTREAM_HASH_MODULE"
- STREAM_SRCS="$STREAM_SRCS $STREAM_UPSTREAM_HASH_SRCS"
- fi
+ elif [ $STREAM = DYNAMIC ]; then
+ ngx_module_name=$STREAM_MODULES
+ ngx_module_incs=
+ ngx_module_deps=$STREAM_DEPS
+ ngx_module_srcs=$STREAM_SRCS
+ ngx_module_libs=
+ ngx_module_link=DYNAMIC
- if [ $STREAM_UPSTREAM_LEAST_CONN = YES ]; then
- modules="$modules $STREAM_UPSTREAM_LEAST_CONN_MODULE"
- STREAM_SRCS="$STREAM_SRCS $STREAM_UPSTREAM_LEAST_CONN_SRCS"
- fi
-
- if [ $STREAM_UPSTREAM_ZONE = YES ]; then
- have=NGX_STREAM_UPSTREAM_ZONE . auto/have
- modules="$modules $STREAM_UPSTREAM_ZONE_MODULE"
- STREAM_SRCS="$STREAM_SRCS $STREAM_UPSTREAM_ZONE_SRCS"
+ . auto/module
fi
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(STREAM_DEPS)"
fi
+ngx_module_type=MISC
+MISC_MODULES=
+
if [ $NGX_GOOGLE_PERFTOOLS = YES ]; then
- modules="$modules $NGX_GOOGLE_PERFTOOLS_MODULE"
- NGX_MISC_SRCS="$NGX_MISC_SRCS $NGX_GOOGLE_PERFTOOLS_SRCS"
-fi
+ ngx_module_name=ngx_google_perftools_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/misc/ngx_google_perftools_module.c
+ ngx_module_libs=
+ ngx_module_link=$NGX_GOOGLE_PERFTOOLS
+ . auto/module
+fi
if [ $NGX_CPP_TEST = YES ]; then
- NGX_MISC_SRCS="$NGX_MISC_SRCS $NGX_CPP_TEST_SRCS"
- CORE_LIBS="$CORE_LIBS -lstdc++"
+ ngx_module_name=
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/misc/ngx_cpp_test_module.cpp
+ ngx_module_libs=-lstdc++
+ ngx_module_link=$NGX_CPP_TEST
+
+ . auto/module
fi
+modules="$modules $MISC_MODULES"
+
cat << END > $NGX_MODULES_C
@@ -592,6 +1255,19 @@
done
cat << END >> $NGX_MODULES_C
+ NULL
+};
+
+END
+
+echo 'char *ngx_module_names[] = {' >> $NGX_MODULES_C
+
+for mod in $modules
+do
+ echo " \"$mod\"," >> $NGX_MODULES_C
+done
+
+cat << END >> $NGX_MODULES_C
NULL
};
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/options
^
|
@@ -7,6 +7,7 @@
NGX_PREFIX=
NGX_SBIN_PATH=
+NGX_MODULES_PATH=
NGX_CONF_PREFIX=
NGX_CONF_PATH=
NGX_ERROR_LOG_PATH=
@@ -120,7 +121,11 @@
STREAM_UPSTREAM_LEAST_CONN=YES
STREAM_UPSTREAM_ZONE=YES
+DYNAMIC_MODULES=
+
NGX_ADDONS=
+NGX_ADDON_DEPS=
+DYNAMIC_ADDONS=
USE_PCRE=NO
PCRE=NONE
@@ -151,6 +156,7 @@
USE_LIBXSLT=NO
USE_LIBGD=NO
+USE_GEOIP=NO
NGX_GOOGLE_PERFTOOLS=NO
NGX_CPP_TEST=NO
@@ -178,6 +184,7 @@
--prefix=) NGX_PREFIX="!" ;;
--prefix=*) NGX_PREFIX="$value" ;;
--sbin-path=*) NGX_SBIN_PATH="$value" ;;
+ --modules-path=*) NGX_MODULES_PATH="$value" ;;
--conf-path=*) NGX_CONF_PATH="$value" ;;
--error-log-path=*) NGX_ERROR_LOG_PATH="$value";;
--pid-path=*) NGX_PID_PATH="$value" ;;
@@ -215,8 +222,13 @@
--with-http_realip_module) HTTP_REALIP=YES ;;
--with-http_addition_module) HTTP_ADDITION=YES ;;
--with-http_xslt_module) HTTP_XSLT=YES ;;
+ --with-http_xslt_module=dynamic) HTTP_XSLT=DYNAMIC ;;
--with-http_image_filter_module) HTTP_IMAGE_FILTER=YES ;;
+ --with-http_image_filter_module=dynamic)
+ HTTP_IMAGE_FILTER=DYNAMIC ;;
--with-http_geoip_module) HTTP_GEOIP=YES ;;
+ --with-http_geoip_module=dynamic)
+ HTTP_GEOIP=DYNAMIC ;;
--with-http_sub_module) HTTP_SUB=YES ;;
--with-http_dav_module) HTTP_DAV=YES ;;
--with-http_flv_module) HTTP_FLV=YES ;;
@@ -266,6 +278,7 @@
--with-http_stub_status_module) HTTP_STUB_STATUS=YES ;;
--with-mail) MAIL=YES ;;
+ --with-mail=dynamic) MAIL=DYNAMIC ;;
--with-mail_ssl_module) MAIL_SSL=YES ;;
# STUB
--with-imap)
@@ -285,6 +298,7 @@
--without-mail_smtp_module) MAIL_SMTP=NO ;;
--with-stream) STREAM=YES ;;
+ --with-stream=dynamic) STREAM=DYNAMIC ;;
--with-stream_ssl_module) STREAM_SSL=YES ;;
--without-stream_limit_conn_module)
STREAM_LIMIT_CONN=NO ;;
@@ -300,6 +314,7 @@
--with-cpp_test_module) NGX_CPP_TEST=YES ;;
--add-module=*) NGX_ADDONS="$NGX_ADDONS $value" ;;
+ --add-dynamic-module=*) DYNAMIC_ADDONS="$DYNAMIC_ADDONS $value" ;;
--with-cc=*) CC="$value" ;;
--with-cpp=*) CPP="$value" ;;
@@ -356,6 +371,7 @@
--prefix=PATH set installation prefix
--sbin-path=PATH set nginx binary pathname
+ --modules-path=PATH set modules path
--conf-path=PATH set nginx.conf pathname
--error-log-path=PATH set error log pathname
--pid-path=PATH set nginx.pid pathname
@@ -384,8 +400,12 @@
--with-http_realip_module enable ngx_http_realip_module
--with-http_addition_module enable ngx_http_addition_module
--with-http_xslt_module enable ngx_http_xslt_module
+ --with-http_xslt_module=dynamic enable dynamic ngx_http_xslt_module
--with-http_image_filter_module enable ngx_http_image_filter_module
+ --with-http_image_filter_module=dynamic
+ enable dynamic ngx_http_image_filter_module
--with-http_geoip_module enable ngx_http_geoip_module
+ --with-http_geoip_module=dynamic enable dynamic ngx_http_geoip_module
--with-http_sub_module enable ngx_http_sub_module
--with-http_dav_module enable ngx_http_dav_module
--with-http_flv_module enable ngx_http_flv_module
@@ -451,12 +471,14 @@
--without-http-cache disable HTTP cache
--with-mail enable POP3/IMAP4/SMTP proxy module
+ --with-mail=dynamic enable dynamic POP3/IMAP4/SMTP proxy module
--with-mail_ssl_module enable ngx_mail_ssl_module
--without-mail_pop3_module disable ngx_mail_pop3_module
--without-mail_imap_module disable ngx_mail_imap_module
--without-mail_smtp_module disable ngx_mail_smtp_module
--with-stream enable TCP proxy module
+ --with-stream=dynamic enable dynamic TCP proxy module
--with-stream_ssl_module enable ngx_stream_ssl_module
--without-stream_limit_conn_module disable ngx_stream_limit_conn_module
--without-stream_access_module disable ngx_stream_access_module
@@ -470,7 +492,8 @@
--with-google_perftools_module enable ngx_google_perftools_module
--with-cpp_test_module enable ngx_cpp_test_module
- --add-module=PATH enable an external module
+ --add-module=PATH enable external module
+ --add-dynamic-module=PATH enable dynamic external module
--with-cc=PATH set C compiler pathname
--with-cpp=PATH set C preprocessor pathname
@@ -533,6 +556,7 @@
NGX_SBIN_PATH=${NGX_SBIN_PATH:-sbin/nginx}
+NGX_MODULES_PATH=${NGX_MODULES_PATH:-modules}
NGX_CONF_PATH=${NGX_CONF_PATH:-conf/nginx.conf}
NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
NGX_PID_PATH=${NGX_PID_PATH:-logs/nginx.pid}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/os/darwin
^
|
@@ -14,6 +14,9 @@
ngx_spacer='
'
+MAIN_LINK=
+MODULE_LINK="-shared -Wl,-undefined,dynamic_lookup"
+
# kqueue
echo " + kqueue found"
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/os/win32
^
|
@@ -12,10 +12,15 @@
NGX_ICONS="$NGX_WIN32_ICONS"
SELECT_SRCS=$WIN32_SELECT_SRCS
+ngx_pic_opt=
+
case "$NGX_CC_NAME" in
gcc)
CORE_LIBS="$CORE_LIBS -ladvapi32 -lws2_32"
+ MAIN_LINK="$MAIN_LINK -Wl,--export-all-symbols"
+ MAIN_LINK="$MAIN_LINK -Wl,--out-implib=$NGX_OBJS/libnginx.a"
+ MODULE_LINK="-shared -L $NGX_OBJS -lnginx"
;;
*)
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/sources
^
|
@@ -36,6 +36,7 @@
src/core/ngx_connection.h \
src/core/ngx_cycle.h \
src/core/ngx_conf_file.h \
+ src/core/ngx_module.h \
src/core/ngx_resolver.h \
src/core/ngx_open_file_cache.h \
src/core/ngx_crypt.h \
@@ -71,6 +72,7 @@
src/core/ngx_rwlock.c \
src/core/ngx_cpuinfo.c \
src/core/ngx_conf_file.c \
+ src/core/ngx_module.c \
src/core/ngx_resolver.c \
src/core/ngx_open_file_cache.c \
src/core/ngx_crypt.c \
@@ -78,17 +80,6 @@
src/core/ngx_syslog.c"
-REGEX_MODULE=ngx_regex_module
-REGEX_DEPS=src/core/ngx_regex.h
-REGEX_SRCS=src/core/ngx_regex.c
-
-
-OPENSSL_MODULE=ngx_openssl_module
-OPENSSL_DEPS=src/event/ngx_event_openssl.h
-OPENSSL_SRCS="src/event/ngx_event_openssl.c \
- src/event/ngx_event_openssl_stapling.c"
-
-
EVENT_MODULES="ngx_events_module ngx_event_core_module"
EVENT_INCS="src/event src/event/modules"
@@ -150,6 +141,7 @@
src/os/unix/ngx_socket.h \
src/os/unix/ngx_os.h \
src/os/unix/ngx_user.h \
+ src/os/unix/ngx_dlopen.h \
src/os/unix/ngx_process_cycle.h"
# add to UNIX_DEPS
@@ -181,6 +173,7 @@
src/os/unix/ngx_setproctitle.c \
src/os/unix/ngx_posix_init.c \
src/os/unix/ngx_user.c \
+ src/os/unix/ngx_dlopen.c \
src/os/unix/ngx_process_cycle.c"
POSIX_DEPS=src/os/unix/ngx_posix_config.h
@@ -226,6 +219,7 @@
src/os/win32/ngx_socket.h \
src/os/win32/ngx_os.h \
src/os/win32/ngx_user.h \
+ src/os/win32/ngx_dlopen.h \
src/os/win32/ngx_process_cycle.h"
WIN32_CONFIG=src/os/win32/ngx_win32_config.h
@@ -246,6 +240,7 @@
src/os/win32/ngx_wsasend_chain.c \
src/os/win32/ngx_win32_init.c \
src/os/win32/ngx_user.c \
+ src/os/win32/ngx_dlopen.c \
src/os/win32/ngx_event_log.c \
src/os/win32/ngx_process_cycle.c \
src/event/ngx_event_acceptex.c"
@@ -254,343 +249,4 @@
NGX_WIN32_RC="src/os/win32/nginx.rc"
-HTTP_MODULES="ngx_http_module \
- ngx_http_core_module \
- ngx_http_log_module \
- ngx_http_upstream_module"
-
-HTTP_WRITE_FILTER_MODULE="ngx_http_write_filter_module"
-HTTP_HEADER_FILTER_MODULE="ngx_http_header_filter_module"
-
-HTTP_POSTPONE_FILTER_MODULE=ngx_http_postpone_filter_module
-HTTP_COPY_FILTER_MODULE=ngx_http_copy_filter_module
-
-HTTP_CHUNKED_FILTER_MODULE=ngx_http_chunked_filter_module
-HTTP_HEADERS_FILTER_MODULE=ngx_http_headers_filter_module
-
-HTTP_RANGE_HEADER_FILTER_MODULE=ngx_http_range_header_filter_module
-HTTP_RANGE_BODY_FILTER_MODULE=ngx_http_range_body_filter_module
-
-HTTP_NOT_MODIFIED_FILTER_MODULE=ngx_http_not_modified_filter_module
-
-HTTP_STATIC_MODULE=ngx_http_static_module
-HTTP_INDEX_MODULE=ngx_http_index_module
-
-HTTP_INCS="src/http src/http/modules"
-
-HTTP_DEPS="src/http/ngx_http.h \
- src/http/ngx_http_request.h \
- src/http/ngx_http_config.h \
- src/http/ngx_http_core_module.h \
- src/http/ngx_http_cache.h \
- src/http/ngx_http_variables.h \
- src/http/ngx_http_script.h \
- src/http/ngx_http_upstream.h \
- src/http/ngx_http_upstream_round_robin.h"
-
-HTTP_SRCS="src/http/ngx_http.c \
- src/http/ngx_http_core_module.c \
- src/http/ngx_http_special_response.c \
- src/http/ngx_http_request.c \
- src/http/ngx_http_parse.c \
- src/http/ngx_http_header_filter_module.c \
- src/http/ngx_http_write_filter_module.c \
- src/http/ngx_http_copy_filter_module.c \
- src/http/modules/ngx_http_log_module.c \
- src/http/ngx_http_request_body.c \
- src/http/ngx_http_variables.c \
- src/http/ngx_http_script.c \
- src/http/ngx_http_upstream.c \
- src/http/ngx_http_upstream_round_robin.c \
- src/http/modules/ngx_http_static_module.c \
- src/http/modules/ngx_http_index_module.c \
- src/http/modules/ngx_http_chunked_filter_module.c \
- src/http/modules/ngx_http_range_filter_module.c \
- src/http/modules/ngx_http_headers_filter_module.c \
- src/http/modules/ngx_http_not_modified_filter_module.c"
-
-HTTP_POSTPONE_FILTER_SRCS=src/http/ngx_http_postpone_filter_module.c
-
HTTP_FILE_CACHE_SRCS=src/http/ngx_http_file_cache.c
-
-
-HTTP_V2_MODULE=ngx_http_v2_module
-HTTP_V2_FILTER_MODULE=ngx_http_v2_filter_module
-HTTP_V2_INCS="src/http/v2"
-HTTP_V2_DEPS="src/http/v2/ngx_http_v2.h \
- src/http/v2/ngx_http_v2_module.h"
-HTTP_V2_SRCS="src/http/v2/ngx_http_v2.c \
- src/http/v2/ngx_http_v2_table.c \
- src/http/v2/ngx_http_v2_huff_decode.c \
- src/http/v2/ngx_http_v2_huff_encode.c \
- src/http/v2/ngx_http_v2_module.c \
- src/http/v2/ngx_http_v2_filter_module.c"
-
-
-HTTP_CHARSET_FILTER_MODULE=ngx_http_charset_filter_module
-HTTP_CHARSET_SRCS=src/http/modules/ngx_http_charset_filter_module.c
-
-
-HTTP_GZIP_FILTER_MODULE=ngx_http_gzip_filter_module
-HTTP_GZIP_SRCS=src/http/modules/ngx_http_gzip_filter_module.c
-
-
-HTTP_GUNZIP_FILTER_MODULE=ngx_http_gunzip_filter_module
-HTTP_GUNZIP_SRCS=src/http/modules/ngx_http_gunzip_filter_module.c
-
-
-HTTP_SSI_FILTER_MODULE=ngx_http_ssi_filter_module
-HTTP_SSI_DEPS=src/http/modules/ngx_http_ssi_filter_module.h
-HTTP_SSI_SRCS=src/http/modules/ngx_http_ssi_filter_module.c
-
-
-HTTP_XSLT_FILTER_MODULE=ngx_http_xslt_filter_module
-HTTP_XSLT_SRCS=src/http/modules/ngx_http_xslt_filter_module.c
-
-
-HTTP_IMAGE_FILTER_MODULE=ngx_http_image_filter_module
-HTTP_IMAGE_SRCS=src/http/modules/ngx_http_image_filter_module.c
-
-
-HTTP_SUB_FILTER_MODULE=ngx_http_sub_filter_module
-HTTP_SUB_SRCS=src/http/modules/ngx_http_sub_filter_module.c
-
-
-HTTP_USERID_FILTER_MODULE=ngx_http_userid_filter_module
-HTTP_USERID_SRCS=src/http/modules/ngx_http_userid_filter_module.c
-
-
-HTTP_SLICE_FILTER_MODULE=ngx_http_slice_filter_module
-HTTP_SLICE_SRCS=src/http/modules/ngx_http_slice_filter_module.c
-
-
-HTTP_REALIP_MODULE=ngx_http_realip_module
-HTTP_REALIP_SRCS=src/http/modules/ngx_http_realip_module.c
-
-
-HTTP_ADDITION_FILTER_MODULE=ngx_http_addition_filter_module
-HTTP_ADDITION_SRCS=src/http/modules/ngx_http_addition_filter_module.c
-
-
-HTTP_DAV_MODULE=ngx_http_dav_module
-HTTP_DAV_SRCS=src/http/modules/ngx_http_dav_module.c
-
-
-HTTP_ACCESS_MODULE=ngx_http_access_module
-HTTP_ACCESS_SRCS=src/http/modules/ngx_http_access_module.c
-
-
-HTTP_AUTH_BASIC_MODULE=ngx_http_auth_basic_module
-HTTP_AUTH_BASIC_SRCS=src/http/modules/ngx_http_auth_basic_module.c
-
-
-HTTP_AUTH_REQUEST_MODULE=ngx_http_auth_request_module
-HTTP_AUTH_REQUEST_SRCS=src/http/modules/ngx_http_auth_request_module.c
-
-
-HTTP_AUTOINDEX_MODULE=ngx_http_autoindex_module
-HTTP_AUTOINDEX_SRCS=src/http/modules/ngx_http_autoindex_module.c
-
-
-HTTP_RANDOM_INDEX_MODULE=ngx_http_random_index_module
-HTTP_RANDOM_INDEX_SRCS=src/http/modules/ngx_http_random_index_module.c
-
-
-HTTP_STATUS_MODULE=ngx_http_status_module
-HTTP_STATUS_SRCS=src/http/modules/ngx_http_status_module.c
-
-
-HTTP_GEO_MODULE=ngx_http_geo_module
-HTTP_GEO_SRCS=src/http/modules/ngx_http_geo_module.c
-
-
-HTTP_GEOIP_MODULE=ngx_http_geoip_module
-HTTP_GEOIP_SRCS=src/http/modules/ngx_http_geoip_module.c
-
-
-HTTP_MAP_MODULE=ngx_http_map_module
-HTTP_MAP_SRCS=src/http/modules/ngx_http_map_module.c
-
-
-HTTP_SPLIT_CLIENTS_MODULE=ngx_http_split_clients_module
-HTTP_SPLIT_CLIENTS_SRCS=src/http/modules/ngx_http_split_clients_module.c
-
-
-HTTP_REFERER_MODULE=ngx_http_referer_module
-HTTP_REFERER_SRCS=src/http/modules/ngx_http_referer_module.c
-
-
-HTTP_REWRITE_MODULE=ngx_http_rewrite_module
-HTTP_REWRITE_SRCS=src/http/modules/ngx_http_rewrite_module.c
-
-
-HTTP_SSL_MODULE=ngx_http_ssl_module
-HTTP_SSL_DEPS=src/http/modules/ngx_http_ssl_module.h
-HTTP_SSL_SRCS=src/http/modules/ngx_http_ssl_module.c
-
-
-HTTP_PROXY_MODULE=ngx_http_proxy_module
-HTTP_PROXY_SRCS=src/http/modules/ngx_http_proxy_module.c
-
-
-HTTP_FASTCGI_MODULE=ngx_http_fastcgi_module
-HTTP_FASTCGI_SRCS=src/http/modules/ngx_http_fastcgi_module.c
-
-
-HTTP_UWSGI_MODULE=ngx_http_uwsgi_module
-HTTP_UWSGI_SRCS=src/http/modules/ngx_http_uwsgi_module.c
-
-
-HTTP_SCGI_MODULE=ngx_http_scgi_module
-HTTP_SCGI_SRCS=src/http/modules/ngx_http_scgi_module.c
-
-
-HTTP_PERL_MODULE=ngx_http_perl_module
-HTTP_PERL_INCS=src/http/modules/perl
-HTTP_PERL_DEPS=src/http/modules/perl/ngx_http_perl_module.h
-HTTP_PERL_SRCS=src/http/modules/perl/ngx_http_perl_module.c
-
-
-HTTP_MEMCACHED_MODULE=ngx_http_memcached_module
-HTTP_MEMCACHED_SRCS=src/http/modules/ngx_http_memcached_module.c
-
-
-HTTP_LIMIT_CONN_MODULE=ngx_http_limit_conn_module
-HTTP_LIMIT_CONN_SRCS=src/http/modules/ngx_http_limit_conn_module.c
-
-
-HTTP_LIMIT_REQ_MODULE=ngx_http_limit_req_module
-HTTP_LIMIT_REQ_SRCS=src/http/modules/ngx_http_limit_req_module.c
-
-
-HTTP_EMPTY_GIF_MODULE=ngx_http_empty_gif_module
-HTTP_EMPTY_GIF_SRCS=src/http/modules/ngx_http_empty_gif_module.c
-
-
-HTTP_BROWSER_MODULE=ngx_http_browser_module
-HTTP_BROWSER_SRCS=src/http/modules/ngx_http_browser_module.c
-
-
-HTTP_SECURE_LINK_MODULE=ngx_http_secure_link_module
-HTTP_SECURE_LINK_SRCS=src/http/modules/ngx_http_secure_link_module.c
-
-
-HTTP_DEGRADATION_MODULE=ngx_http_degradation_module
-HTTP_DEGRADATION_SRCS=src/http/modules/ngx_http_degradation_module.c
-
-
-HTTP_FLV_MODULE=ngx_http_flv_module
-HTTP_FLV_SRCS=src/http/modules/ngx_http_flv_module.c
-
-
-HTTP_MP4_MODULE=ngx_http_mp4_module
-HTTP_MP4_SRCS=src/http/modules/ngx_http_mp4_module.c
-
-
-HTTP_GZIP_STATIC_MODULE=ngx_http_gzip_static_module
-HTTP_GZIP_STATIC_SRCS=src/http/modules/ngx_http_gzip_static_module.c
-
-
-HTTP_UPSTREAM_HASH_MODULE=ngx_http_upstream_hash_module
-HTTP_UPSTREAM_HASH_SRCS=src/http/modules/ngx_http_upstream_hash_module.c
-
-
-HTTP_UPSTREAM_IP_HASH_MODULE=ngx_http_upstream_ip_hash_module
-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"
-
-
-HTTP_UPSTREAM_ZONE_MODULE=ngx_http_upstream_zone_module
-HTTP_UPSTREAM_ZONE_SRCS=" \
- src/http/modules/ngx_http_upstream_zone_module.c"
-
-
-MAIL_INCS="src/mail"
-
-MAIL_DEPS="src/mail/ngx_mail.h"
-
-MAIL_MODULES="ngx_mail_module ngx_mail_core_module"
-
-MAIL_SRCS="src/mail/ngx_mail.c \
- src/mail/ngx_mail_core_module.c \
- src/mail/ngx_mail_handler.c \
- src/mail/ngx_mail_parse.c"
-
-MAIL_POP3_MODULE="ngx_mail_pop3_module"
-MAIL_POP3_DEPS="src/mail/ngx_mail_pop3_module.h"
-MAIL_POP3_SRCS="src/mail/ngx_mail_pop3_module.c \
- src/mail/ngx_mail_pop3_handler.c"
-
-MAIL_IMAP_MODULE="ngx_mail_imap_module"
-MAIL_IMAP_DEPS="src/mail/ngx_mail_imap_module.h"
-MAIL_IMAP_SRCS="src/mail/ngx_mail_imap_module.c \
- src/mail/ngx_mail_imap_handler.c"
-
-MAIL_SMTP_MODULE="ngx_mail_smtp_module"
-MAIL_SMTP_DEPS="src/mail/ngx_mail_smtp_module.h"
-MAIL_SMTP_SRCS="src/mail/ngx_mail_smtp_module.c \
- src/mail/ngx_mail_smtp_handler.c"
-
-MAIL_SSL_MODULE="ngx_mail_ssl_module"
-MAIL_SSL_DEPS="src/mail/ngx_mail_ssl_module.h"
-MAIL_SSL_SRCS="src/mail/ngx_mail_ssl_module.c"
-
-MAIL_AUTH_HTTP_MODULE="ngx_mail_auth_http_module"
-MAIL_AUTH_HTTP_SRCS="src/mail/ngx_mail_auth_http_module.c"
-
-MAIL_PROXY_MODULE="ngx_mail_proxy_module"
-MAIL_PROXY_SRCS="src/mail/ngx_mail_proxy_module.c"
-
-
-STREAM_INCS="src/stream"
-
-STREAM_DEPS="src/stream/ngx_stream.h \
- src/stream/ngx_stream_upstream.h \
- src/stream/ngx_stream_upstream_round_robin.h"
-
-STREAM_MODULES="ngx_stream_module \
- ngx_stream_core_module \
- ngx_stream_proxy_module \
- ngx_stream_upstream_module"
-
-STREAM_SRCS="src/stream/ngx_stream.c \
- src/stream/ngx_stream_handler.c \
- src/stream/ngx_stream_core_module.c \
- src/stream/ngx_stream_proxy_module.c \
- src/stream/ngx_stream_upstream.c \
- src/stream/ngx_stream_upstream_round_robin.c"
-
-STREAM_SSL_MODULE="ngx_stream_ssl_module"
-STREAM_SSL_DEPS="src/stream/ngx_stream_ssl_module.h"
-STREAM_SSL_SRCS="src/stream/ngx_stream_ssl_module.c"
-
-STREAM_LIMIT_CONN_MODULE=ngx_stream_limit_conn_module
-STREAM_LIMIT_CONN_SRCS=src/stream/ngx_stream_limit_conn_module.c
-
-STREAM_ACCESS_MODULE=ngx_stream_access_module
-STREAM_ACCESS_SRCS=src/stream/ngx_stream_access_module.c
-
-STREAM_UPSTREAM_HASH_MODULE=ngx_stream_upstream_hash_module
-STREAM_UPSTREAM_HASH_SRCS=src/stream/ngx_stream_upstream_hash_module.c
-
-STREAM_UPSTREAM_LEAST_CONN_MODULE=ngx_stream_upstream_least_conn_module
-STREAM_UPSTREAM_LEAST_CONN_SRCS=" \
- src/stream/ngx_stream_upstream_least_conn_module.c"
-
-STREAM_UPSTREAM_ZONE_MODULE=ngx_stream_upstream_zone_module
-STREAM_UPSTREAM_ZONE_SRCS=src/stream/ngx_stream_upstream_zone_module.c
-
-
-NGX_GOOGLE_PERFTOOLS_MODULE=ngx_google_perftools_module
-NGX_GOOGLE_PERFTOOLS_SRCS=src/misc/ngx_google_perftools_module.c
-
-NGX_CPP_TEST_SRCS=src/misc/ngx_cpp_test_module.cpp
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/summary
^
|
@@ -60,6 +60,7 @@
cat << END
nginx path prefix: "$NGX_PREFIX"
nginx binary file: "$NGX_SBIN_PATH"
+ nginx modules path: "$NGX_MODULES_PATH"
nginx configuration prefix: "$NGX_CONF_PREFIX"
nginx configuration file: "$NGX_CONF_PATH"
nginx pid file: "$NGX_PID_PATH"
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/auto/unix
^
|
@@ -255,12 +255,12 @@
ngx_feature="dlopen()"
-ngx_feature_name=
+ngx_feature_name="NGX_HAVE_DLOPEN"
ngx_feature_run=no
ngx_feature_incs="#include <dlfcn.h>"
ngx_feature_path=
ngx_feature_libs=
-ngx_feature_test="dlopen(NULL, 0)"
+ngx_feature_test="dlopen(NULL, 0); dlsym(NULL, NULL)"
. auto/feature
@@ -271,7 +271,7 @@
. auto/feature
if [ $ngx_found = yes ]; then
- NGX_LIBDL="-ldl"
+ CORE_LIBS="$CORE_LIBS -ldl"
fi
fi
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/core/nginx.c
^
|
@@ -24,6 +24,10 @@
void *conf);
static char *ngx_set_worker_processes(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
+static char *ngx_load_module(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
+#if (NGX_HAVE_DLOPEN)
+static void ngx_unload_module(void *data);
+#endif
static ngx_conf_enum_t ngx_debug_points[] = {
@@ -133,6 +137,13 @@
0,
NULL },
+ { ngx_string("load_module"),
+ NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
+ ngx_load_module,
+ 0,
+ 0,
+ NULL },
+
ngx_null_command
};
@@ -160,8 +171,6 @@
};
-ngx_uint_t ngx_max_module;
-
static ngx_uint_t ngx_show_help;
static ngx_uint_t ngx_show_version;
static ngx_uint_t ngx_show_configure;
@@ -260,9 +269,8 @@
return 1;
}
- ngx_max_module = 0;
- for (i = 0; ngx_modules[i]; i++) {
- ngx_modules[i]->index = ngx_max_module++;
+ if (ngx_preinit_modules() != NGX_OK) {
+ return 1;
}
cycle = ngx_init_cycle(&init_cycle);
@@ -1406,3 +1414,101 @@
return NGX_CONF_OK;
}
+
+
+static char *
+ngx_load_module(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+#if (NGX_HAVE_DLOPEN)
+ void *handle;
+ char **names, **order;
+ ngx_str_t *value, file;
+ ngx_uint_t i;
+ ngx_module_t *module, **modules;
+ ngx_pool_cleanup_t *cln;
+
+ if (cf->cycle->modules_used) {
+ return "is specified too late";
+ }
+
+ value = cf->args->elts;
+
+ file = value[1];
+
+ if (ngx_conf_full_name(cf->cycle, &file, 0) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+
+ cln = ngx_pool_cleanup_add(cf->cycle->pool, 0);
+ if (cln == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ handle = ngx_dlopen(file.data);
+ if (handle == NULL) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ ngx_dlopen_n " \"%s\" failed (%s)",
+ file.data, ngx_dlerror());
+ return NGX_CONF_ERROR;
+ }
+
+ cln->handler = ngx_unload_module;
+ cln->data = handle;
+
+ modules = ngx_dlsym(handle, "ngx_modules");
+ if (modules == NULL) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ ngx_dlsym_n " \"%V\", \"%s\" failed (%s)",
+ &value[1], "ngx_modules", ngx_dlerror());
+ return NGX_CONF_ERROR;
+ }
+
+ names = ngx_dlsym(handle, "ngx_module_names");
+ if (names == NULL) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ ngx_dlsym_n " \"%V\", \"%s\" failed (%s)",
+ &value[1], "ngx_module_names", ngx_dlerror());
+ return NGX_CONF_ERROR;
+ }
+
+ order = ngx_dlsym(handle, "ngx_module_order");
+
+ for (i = 0; modules[i]; i++) {
+ module = modules[i];
+ module->name = names[i];
+
+ if (ngx_add_module(cf, &file, module, order) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+
+ ngx_log_debug2(NGX_LOG_DEBUG_CORE, cf->log, 0, "module: %s i:%i",
+ module->name, module->index);
+ }
+
+ return NGX_CONF_OK;
+
+#else
+
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"load_module\" is not supported "
+ "on this platform");
+ return NGX_CONF_ERROR;
+
+#endif
+}
+
+
+#if (NGX_HAVE_DLOPEN)
+
+static void
+ngx_unload_module(void *data)
+{
+ void *handle = data;
+
+ if (ngx_dlclose(handle) != 0) {
+ ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
+ ngx_dlclose_n " failed (%s)", ngx_dlerror());
+ }
+}
+
+#endif
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/core/nginx.h
^
|
@@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1009010
-#define NGINX_VERSION "1.9.10"
+#define nginx_version 1009011
+#define NGINX_VERSION "1.9.11"
#define NGINX_VER "nginx/" NGINX_VERSION
#ifdef NGX_BUILD
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/core/ngx_conf_file.c
^
|
@@ -329,9 +329,9 @@
found = 0;
- for (i = 0; ngx_modules[i]; i++) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
- cmd = ngx_modules[i]->commands;
+ cmd = cf->cycle->modules[i]->commands;
if (cmd == NULL) {
continue;
}
@@ -348,8 +348,8 @@
found = 1;
- if (ngx_modules[i]->type != NGX_CONF_MODULE
- && ngx_modules[i]->type != cf->module_type)
+ if (cf->cycle->modules[i]->type != NGX_CONF_MODULE
+ && cf->cycle->modules[i]->type != cf->module_type)
{
continue;
}
@@ -411,16 +411,16 @@
conf = NULL;
if (cmd->type & NGX_DIRECT_CONF) {
- conf = ((void **) cf->ctx)[ngx_modules[i]->index];
+ conf = ((void **) cf->ctx)[cf->cycle->modules[i]->index];
} else if (cmd->type & NGX_MAIN_CONF) {
- conf = &(((void **) cf->ctx)[ngx_modules[i]->index]);
+ conf = &(((void **) cf->ctx)[cf->cycle->modules[i]->index]);
} else if (cf->ctx) {
confp = *(void **) ((char *) cf->ctx + cmd->conf);
if (confp) {
- conf = confp[ngx_modules[i]->ctx_index];
+ conf = confp[cf->cycle->modules[i]->ctx_index];
}
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/core/ngx_conf_file.h
^
|
@@ -96,53 +96,6 @@
};
-#define NGX_MODULE_V1 0, 0, 0, 0, 0, 0, 1
-#define NGX_MODULE_V1_PADDING 0, 0, 0, 0, 0, 0, 0, 0
-
-struct ngx_module_s {
- ngx_uint_t ctx_index;
- ngx_uint_t index;
-
- ngx_uint_t spare0;
- ngx_uint_t spare1;
- ngx_uint_t spare2;
- ngx_uint_t spare3;
-
- ngx_uint_t version;
-
- void *ctx;
- ngx_command_t *commands;
- ngx_uint_t type;
-
- ngx_int_t (*init_master)(ngx_log_t *log);
-
- ngx_int_t (*init_module)(ngx_cycle_t *cycle);
-
- ngx_int_t (*init_process)(ngx_cycle_t *cycle);
- ngx_int_t (*init_thread)(ngx_cycle_t *cycle);
- void (*exit_thread)(ngx_cycle_t *cycle);
- void (*exit_process)(ngx_cycle_t *cycle);
-
- void (*exit_master)(ngx_cycle_t *cycle);
-
- uintptr_t spare_hook0;
- uintptr_t spare_hook1;
- uintptr_t spare_hook2;
- uintptr_t spare_hook3;
- uintptr_t spare_hook4;
- uintptr_t spare_hook5;
- uintptr_t spare_hook6;
- uintptr_t spare_hook7;
-};
-
-
-typedef struct {
- ngx_str_t name;
- void *(*create_conf)(ngx_cycle_t *cycle);
- char *(*init_conf)(ngx_cycle_t *cycle, void *conf);
-} ngx_core_module_t;
-
-
typedef struct {
ngx_file_t file;
ngx_buf_t *buffer;
@@ -340,8 +293,4 @@
char *ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
-extern ngx_uint_t ngx_max_module;
-extern ngx_module_t *ngx_modules[];
-
-
#endif /* _NGX_CONF_FILE_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/core/ngx_core.h
^
|
@@ -53,6 +53,7 @@
#include <ngx_shmem.h>
#include <ngx_process.h>
#include <ngx_user.h>
+#include <ngx_dlopen.h>
#include <ngx_parse.h>
#include <ngx_parse_time.h>
#include <ngx_log.h>
@@ -83,6 +84,7 @@
#endif
#include <ngx_process_cycle.h>
#include <ngx_conf_file.h>
+#include <ngx_module.h>
#include <ngx_open_file_cache.h>
#include <ngx_os.h>
#include <ngx_connection.h>
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/core/ngx_cycle.c
^
|
@@ -212,12 +212,18 @@
ngx_strlow(cycle->hostname.data, (u_char *) hostname, cycle->hostname.len);
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_CORE_MODULE) {
+ if (ngx_cycle_modules(cycle) != NGX_OK) {
+ ngx_destroy_pool(pool);
+ return NULL;
+ }
+
+
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->type != NGX_CORE_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cycle->modules[i]->ctx;
if (module->create_conf) {
rv = module->create_conf(cycle);
@@ -225,7 +231,7 @@
ngx_destroy_pool(pool);
return NULL;
}
- cycle->conf_ctx[ngx_modules[i]->index] = rv;
+ cycle->conf_ctx[cycle->modules[i]->index] = rv;
}
}
@@ -276,15 +282,16 @@
cycle->conf_file.data);
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_CORE_MODULE) {
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->type != NGX_CORE_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cycle->modules[i]->ctx;
if (module->init_conf) {
- if (module->init_conf(cycle, cycle->conf_ctx[ngx_modules[i]->index])
+ if (module->init_conf(cycle,
+ cycle->conf_ctx[cycle->modules[i]->index])
== NGX_CONF_ERROR)
{
environ = senv;
@@ -612,13 +619,9 @@
pool->log = cycle->log;
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->init_module) {
- if (ngx_modules[i]->init_module(cycle) != NGX_OK) {
- /* fatal */
- exit(1);
- }
- }
+ if (ngx_init_modules(cycle) != NGX_OK) {
+ /* fatal */
+ exit(1);
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/core/ngx_cycle.h
^
|
@@ -48,6 +48,10 @@
ngx_connection_t *free_connections;
ngx_uint_t free_connection_n;
+ ngx_module_t **modules;
+ ngx_uint_t modules_n;
+ ngx_uint_t modules_used; /* unsigned modules_used:1; */
+
ngx_queue_t reusable_connections_queue;
ngx_array_t listening;
|
[-]
[+]
|
Added |
nginx-1.9.11.tar.bz2/src/core/ngx_module.c
^
|
@@ -0,0 +1,361 @@
+
+/*
+ * Copyright (C) Igor Sysoev
+ * Copyright (C) Maxim Dounin
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+#define NGX_MAX_DYNAMIC_MODULES 128
+
+
+static ngx_uint_t ngx_module_index(ngx_cycle_t *cycle);
+static ngx_uint_t ngx_module_ctx_index(ngx_cycle_t *cycle, ngx_uint_t type,
+ ngx_uint_t index);
+
+
+ngx_uint_t ngx_max_module;
+static ngx_uint_t ngx_modules_n;
+
+
+ngx_int_t
+ngx_preinit_modules()
+{
+ ngx_uint_t i;
+
+ ngx_max_module = 0;
+ for (i = 0; ngx_modules[i]; i++) {
+ ngx_modules[i]->index = i;
+ ngx_modules[i]->name = ngx_module_names[i];
+ }
+
+ ngx_modules_n = i;
+ ngx_max_module = ngx_modules_n + NGX_MAX_DYNAMIC_MODULES;
+
+ return NGX_OK;
+}
+
+
+ngx_int_t
+ngx_cycle_modules(ngx_cycle_t *cycle)
+{
+ /*
+ * create a list of modules to be used for this cycle,
+ * copy static modules to it
+ */
+
+ cycle->modules = ngx_pcalloc(cycle->pool, (ngx_max_module + 1)
+ * sizeof(ngx_module_t *));
+ if (cycle->modules == NULL) {
+ return NGX_ERROR;
+ }
+
+ ngx_memcpy(cycle->modules, ngx_modules,
+ ngx_modules_n * sizeof(ngx_module_t *));
+
+ cycle->modules_n = ngx_modules_n;
+
+ return NGX_OK;
+}
+
+
+ngx_int_t
+ngx_init_modules(ngx_cycle_t *cycle)
+{
+ ngx_uint_t i;
+
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->init_module) {
+ if (cycle->modules[i]->init_module(cycle) != NGX_OK) {
+ return NGX_ERROR;
+ }
+ }
+ }
+
+ return NGX_OK;
+}
+
+
+ngx_int_t
+ngx_count_modules(ngx_cycle_t *cycle, ngx_uint_t type)
+{
+ ngx_uint_t i, next, max;
+ ngx_module_t *module;
+
+ next = 0;
+ max = 0;
+
+ /* count appropriate modules, set up their indices */
+
+ for (i = 0; cycle->modules[i]; i++) {
+ module = cycle->modules[i];
+
+ if (module->type != type) {
+ continue;
+ }
+
+ if (module->ctx_index != NGX_MODULE_UNSET_INDEX) {
+
+ /* if ctx_index was assigned, preserve it */
+
+ if (module->ctx_index > max) {
+ max = module->ctx_index;
+ }
+
+ if (module->ctx_index == next) {
+ next++;
+ }
+
+ continue;
+ }
+
+ /* search for some free index */
+
+ module->ctx_index = ngx_module_ctx_index(cycle, type, next);
+
+ if (module->ctx_index > max) {
+ max = module->ctx_index;
+ }
+
+ next = module->ctx_index + 1;
+ }
+
+ /*
+ * make sure the number returned is big enough for previous
+ * cycle as well, else there will be problems if the number
+ * will be stored in a global variable (as it's used to be)
+ * and we'll have to roll back to the previous cycle
+ */
+
+ if (cycle->old_cycle && cycle->old_cycle->modules) {
+
+ for (i = 0; cycle->old_cycle->modules[i]; i++) {
+ module = cycle->old_cycle->modules[i];
+
+ if (module->type != type) {
+ continue;
+ }
+
+ if (module->ctx_index > max) {
+ max = module->ctx_index;
+ }
+ }
+ }
+
+ /* prevent loading of additional modules */
+
+ cycle->modules_used = 1;
+
+ return max + 1;
+}
+
+
+ngx_int_t
+ngx_add_module(ngx_conf_t *cf, ngx_str_t *file, ngx_module_t *module,
+ char **order)
+{
+ void *rv;
+ ngx_uint_t i, m, before;
+ ngx_core_module_t *core_module;
+
+ if (cf->cycle->modules_n >= ngx_max_module) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "too many modules loaded");
+ return NGX_ERROR;
+ }
+
+ if (module->version != nginx_version) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "module \"%V\" version %ui instead of %ui",
+ file, module->version, nginx_version);
+ return NGX_ERROR;
+ }
+
+ if (ngx_strcmp(module->signature, NGX_MODULE_SIGNATURE) != 0) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "module \"%V\" is not binary compatible",
+ file);
+ return NGX_ERROR;
+ }
+
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (ngx_strcmp(cf->cycle->modules[m]->name, module->name) == 0) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "module \"%s\" is already loaded",
+ module->name);
+ return NGX_ERROR;
+ }
+ }
+
+ /*
+ * if the module wasn't previously loaded, assign an index
+ */
+
+ if (module->index == NGX_MODULE_UNSET_INDEX) {
+ module->index = ngx_module_index(cf->cycle);
+
+ if (module->index >= ngx_max_module) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "too many modules loaded");
+ return NGX_ERROR;
+ }
+ }
+
+ /*
+ * put the module into the cycle->modules array
+ */
+
+ before = cf->cycle->modules_n;
+
+ if (order) {
+ for (i = 0; order[i]; i++) {
+ if (ngx_strcmp(order[i], module->name) == 0) {
+ i++;
+ break;
+ }
+ }
+
+ for ( /* void */ ; order[i]; i++) {
+
+#if 0
+ ngx_log_debug2(NGX_LOG_DEBUG_CORE, cf->log, 0,
+ "module: %s before %s",
+ module->name, order[i]);
+#endif
+
+ for (m = 0; m < before; m++) {
+ if (ngx_strcmp(cf->cycle->modules[m]->name, order[i]) == 0) {
+
+ ngx_log_debug3(NGX_LOG_DEBUG_CORE, cf->log, 0,
+ "module: %s before %s:%i",
+ module->name, order[i], m);
+
+ before = m;
+ break;
+ }
+ }
+ }
+ }
+
+ /* put the module before modules[before] */
+
+ if (before != cf->cycle->modules_n) {
+ ngx_memmove(&cf->cycle->modules[before + 1],
+ &cf->cycle->modules[before],
+ (cf->cycle->modules_n - before) * sizeof(ngx_module_t *));
+ }
+
+ cf->cycle->modules[before] = module;
+ cf->cycle->modules_n++;
+
+ if (module->type == NGX_CORE_MODULE) {
+
+ /*
+ * we are smart enough to initialize core modules;
+ * other modules are expected to be loaded before
+ * initialization - e.g., http modules must be loaded
+ * before http{} block
+ */
+
+ core_module = module->ctx;
+
+ if (core_module->create_conf) {
+ rv = core_module->create_conf(cf->cycle);
+ if (rv == NULL) {
+ return NGX_ERROR;
+ }
+
+ cf->cycle->conf_ctx[module->index] = rv;
+ }
+ }
+
+ return NGX_OK;
+}
+
+
+static ngx_uint_t
+ngx_module_index(ngx_cycle_t *cycle)
+{
+ ngx_uint_t i, index;
+ ngx_module_t *module;
+
+ index = 0;
+
+again:
+
+ /* find an unused index */
+
+ for (i = 0; cycle->modules[i]; i++) {
+ module = cycle->modules[i];
+
+ if (module->index == index) {
+ index++;
+ goto again;
+ }
+ }
+
+ /* check previous cycle */
+
+ if (cycle->old_cycle && cycle->old_cycle->modules) {
+
+ for (i = 0; cycle->old_cycle->modules[i]; i++) {
+ module = cycle->old_cycle->modules[i];
+
+ if (module->index == index) {
+ index++;
+ goto again;
+ }
+ }
+ }
+
+ return index;
+}
+
+
+static ngx_uint_t
+ngx_module_ctx_index(ngx_cycle_t *cycle, ngx_uint_t type, ngx_uint_t index)
+{
+ ngx_uint_t i;
+ ngx_module_t *module;
+
+again:
+
+ /* find an unused ctx_index */
+
+ for (i = 0; cycle->modules[i]; i++) {
+ module = cycle->modules[i];
+
+ if (module->type != type) {
+ continue;
+ }
+
+ if (module->ctx_index == index) {
+ index++;
+ goto again;
+ }
+ }
+
+ /* check previous cycle */
+
+ if (cycle->old_cycle && cycle->old_cycle->modules) {
+
+ for (i = 0; cycle->old_cycle->modules[i]; i++) {
+ module = cycle->old_cycle->modules[i];
+
+ if (module->type != type) {
+ continue;
+ }
+
+ if (module->ctx_index == index) {
+ index++;
+ goto again;
+ }
+ }
+ }
+
+ return index;
+}
|
[-]
[+]
|
Added |
nginx-1.9.11.tar.bz2/src/core/ngx_module.h
^
|
@@ -0,0 +1,307 @@
+
+/*
+ * Copyright (C) Igor Sysoev
+ * Copyright (C) Maxim Dounin
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#ifndef _NGX_MODULE_H_INCLUDED_
+#define _NGX_MODULE_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <nginx.h>
+
+
+#define NGX_MODULE_UNSET_INDEX (ngx_uint_t) -1
+
+
+#define NGX_MODULE_SIGNATURE_0 \
+ ngx_value(NGX_PTR_SIZE) "," \
+ ngx_value(NGX_SIG_ATOMIC_T_SIZE) "," \
+ ngx_value(NGX_TIME_T_SIZE) ","
+
+#if (NGX_HAVE_KQUEUE)
+#define NGX_MODULE_SIGNATURE_1 "1"
+#else
+#define NGX_MODULE_SIGNATURE_1 "0"
+#endif
+
+#if (NGX_HAVE_IOCP)
+#define NGX_MODULE_SIGNATURE_2 "1"
+#else
+#define NGX_MODULE_SIGNATURE_2 "0"
+#endif
+
+#if (NGX_HAVE_FILE_AIO)
+#define NGX_MODULE_SIGNATURE_3 "1"
+#else
+#define NGX_MODULE_SIGNATURE_3 "0"
+#endif
+
+#if (NGX_HAVE_AIO_SENDFILE)
+#define NGX_MODULE_SIGNATURE_4 "1"
+#else
+#define NGX_MODULE_SIGNATURE_4 "0"
+#endif
+
+#if (NGX_HAVE_EVENTFD)
+#define NGX_MODULE_SIGNATURE_5 "1"
+#else
+#define NGX_MODULE_SIGNATURE_5 "0"
+#endif
+
+#if (NGX_HAVE_EPOLL)
+#define NGX_MODULE_SIGNATURE_6 "1"
+#else
+#define NGX_MODULE_SIGNATURE_6 "0"
+#endif
+
+#if (NGX_HAVE_KEEPALIVE_TUNABLE)
+#define NGX_MODULE_SIGNATURE_7 "1"
+#else
+#define NGX_MODULE_SIGNATURE_7 "0"
+#endif
+
+#if (NGX_HAVE_INET6)
+#define NGX_MODULE_SIGNATURE_8 "1"
+#else
+#define NGX_MODULE_SIGNATURE_8 "0"
+#endif
+
+#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
+#define NGX_MODULE_SIGNATURE_9 "1"
+#else
+#define NGX_MODULE_SIGNATURE_9 "0"
+#endif
+
+#if (NGX_HAVE_REUSEPORT)
+#define NGX_MODULE_SIGNATURE_10 "1"
+#else
+#define NGX_MODULE_SIGNATURE_10 "0"
+#endif
+
+#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
+#define NGX_MODULE_SIGNATURE_11 "1"
+#else
+#define NGX_MODULE_SIGNATURE_11 "0"
+#endif
+
+#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
+#define NGX_MODULE_SIGNATURE_12 "1"
+#else
+#define NGX_MODULE_SIGNATURE_12 "0"
+#endif
+
+#if (NGX_HAVE_SETFIB)
+#define NGX_MODULE_SIGNATURE_13 "1"
+#else
+#define NGX_MODULE_SIGNATURE_13 "0"
+#endif
+
+#if (NGX_HAVE_TCP_FASTOPEN)
+#define NGX_MODULE_SIGNATURE_14 "1"
+#else
+#define NGX_MODULE_SIGNATURE_14 "0"
+#endif
+
+#if (NGX_HAVE_UNIX_DOMAIN)
+#define NGX_MODULE_SIGNATURE_15 "1"
+#else
+#define NGX_MODULE_SIGNATURE_15 "0"
+#endif
+
+#if (NGX_HAVE_VARIADIC_MACROS)
+#define NGX_MODULE_SIGNATURE_16 "1"
+#else
+#define NGX_MODULE_SIGNATURE_16 "0"
+#endif
+
+#if (NGX_HAVE_MD5)
+#define NGX_MODULE_SIGNATURE_17 "1"
+#else
+#define NGX_MODULE_SIGNATURE_17 "0"
+#endif
+
+#if (NGX_HAVE_SHA1)
+#define NGX_MODULE_SIGNATURE_18 "1"
+#else
+#define NGX_MODULE_SIGNATURE_18 "0"
+#endif
+
+#if (NGX_HAVE_OPENAT)
+#define NGX_MODULE_SIGNATURE_19 "1"
+#else
+#define NGX_MODULE_SIGNATURE_19 "0"
+#endif
+
+#if (NGX_HAVE_ATOMIC_OPS)
+#define NGX_MODULE_SIGNATURE_20 "1"
+#else
+#define NGX_MODULE_SIGNATURE_20 "0"
+#endif
+
+#if (NGX_HAVE_POSIX_SEM)
+#define NGX_MODULE_SIGNATURE_21 "1"
+#else
+#define NGX_MODULE_SIGNATURE_21 "0"
+#endif
+
+#if (NGX_THREADS)
+#define NGX_MODULE_SIGNATURE_22 "1"
+#else
+#define NGX_MODULE_SIGNATURE_22 "0"
+#endif
+
+#if (NGX_PCRE)
+#define NGX_MODULE_SIGNATURE_23 "1"
+#else
+#define NGX_MODULE_SIGNATURE_23 "0"
+#endif
+
+#if (NGX_HTTP_SSL)
+#define NGX_MODULE_SIGNATURE_24 "1"
+#else
+#define NGX_MODULE_SIGNATURE_24 "0"
+#endif
+
+#if (NGX_HTTP_V2)
+#define NGX_MODULE_SIGNATURE_25 "1"
+#else
+#define NGX_MODULE_SIGNATURE_25 "0"
+#endif
+
+#if (NGX_HTTP_GZIP)
+#define NGX_MODULE_SIGNATURE_26 "1"
+#else
+#define NGX_MODULE_SIGNATURE_26 "0"
+#endif
+
+#if (NGX_HTTP_DEGRADATION)
+#define NGX_MODULE_SIGNATURE_27 "1"
+#else
+#define NGX_MODULE_SIGNATURE_27 "0"
+#endif
+
+#if (NGX_HTTP_X_FORWARDED_FOR)
+#define NGX_MODULE_SIGNATURE_28 "1"
+#else
+#define NGX_MODULE_SIGNATURE_28 "0"
+#endif
+
+#if (NGX_HTTP_REALIP)
+#define NGX_MODULE_SIGNATURE_29 "1"
+#else
+#define NGX_MODULE_SIGNATURE_29 "0"
+#endif
+
+#if (NGX_HTTP_HEADERS)
+#define NGX_MODULE_SIGNATURE_30 "1"
+#else
+#define NGX_MODULE_SIGNATURE_30 "0"
+#endif
+
+#if (NGX_HTTP_DAV)
+#define NGX_MODULE_SIGNATURE_31 "1"
+#else
+#define NGX_MODULE_SIGNATURE_31 "0"
+#endif
+
+#if (NGX_HTTP_CACHE)
+#define NGX_MODULE_SIGNATURE_32 "1"
+#else
+#define NGX_MODULE_SIGNATURE_32 "0"
+#endif
+
+#if (NGX_HTTP_UPSTREAM_ZONE)
+#define NGX_MODULE_SIGNATURE_33 "1"
+#else
+#define NGX_MODULE_SIGNATURE_33 "0"
+#endif
+
+#define NGX_MODULE_SIGNATURE \
+ NGX_MODULE_SIGNATURE_0 NGX_MODULE_SIGNATURE_1 NGX_MODULE_SIGNATURE_2 \
+ NGX_MODULE_SIGNATURE_3 NGX_MODULE_SIGNATURE_4 NGX_MODULE_SIGNATURE_5 \
+ NGX_MODULE_SIGNATURE_6 NGX_MODULE_SIGNATURE_7 NGX_MODULE_SIGNATURE_8 \
+ NGX_MODULE_SIGNATURE_9 NGX_MODULE_SIGNATURE_10 NGX_MODULE_SIGNATURE_11 \
+ NGX_MODULE_SIGNATURE_12 NGX_MODULE_SIGNATURE_13 NGX_MODULE_SIGNATURE_14 \
+ NGX_MODULE_SIGNATURE_15 NGX_MODULE_SIGNATURE_16 NGX_MODULE_SIGNATURE_17 \
+ NGX_MODULE_SIGNATURE_18 NGX_MODULE_SIGNATURE_19 NGX_MODULE_SIGNATURE_20 \
+ NGX_MODULE_SIGNATURE_21 NGX_MODULE_SIGNATURE_22 NGX_MODULE_SIGNATURE_23 \
+ NGX_MODULE_SIGNATURE_24 NGX_MODULE_SIGNATURE_25 NGX_MODULE_SIGNATURE_26 \
+ NGX_MODULE_SIGNATURE_27 NGX_MODULE_SIGNATURE_28 NGX_MODULE_SIGNATURE_29 \
+ NGX_MODULE_SIGNATURE_30 NGX_MODULE_SIGNATURE_31 NGX_MODULE_SIGNATURE_32 \
+ NGX_MODULE_SIGNATURE_33
+
+
+#define NGX_MODULE_V1 \
+ NGX_MODULE_UNSET_INDEX, NGX_MODULE_UNSET_INDEX, \
+ NULL, 0, 0, nginx_version, NGX_MODULE_SIGNATURE
+
+#define NGX_MODULE_V1_PADDING 0, 0, 0, 0, 0, 0, 0, 0
+
+
+struct ngx_module_s {
+ ngx_uint_t ctx_index;
+ ngx_uint_t index;
+
+ char *name;
+
+ ngx_uint_t spare0;
+ ngx_uint_t spare1;
+
+ ngx_uint_t version;
+ char *signature;
+
+ void *ctx;
+ ngx_command_t *commands;
+ ngx_uint_t type;
+
+ ngx_int_t (*init_master)(ngx_log_t *log);
+
+ ngx_int_t (*init_module)(ngx_cycle_t *cycle);
+
+ ngx_int_t (*init_process)(ngx_cycle_t *cycle);
+ ngx_int_t (*init_thread)(ngx_cycle_t *cycle);
+ void (*exit_thread)(ngx_cycle_t *cycle);
+ void (*exit_process)(ngx_cycle_t *cycle);
+
+ void (*exit_master)(ngx_cycle_t *cycle);
+
+ uintptr_t spare_hook0;
+ uintptr_t spare_hook1;
+ uintptr_t spare_hook2;
+ uintptr_t spare_hook3;
+ uintptr_t spare_hook4;
+ uintptr_t spare_hook5;
+ uintptr_t spare_hook6;
+ uintptr_t spare_hook7;
+};
+
+
+typedef struct {
+ ngx_str_t name;
+ void *(*create_conf)(ngx_cycle_t *cycle);
+ char *(*init_conf)(ngx_cycle_t *cycle, void *conf);
+} ngx_core_module_t;
+
+
+ngx_int_t ngx_preinit_modules();
+ngx_int_t ngx_cycle_modules(ngx_cycle_t *cycle);
+ngx_int_t ngx_init_modules(ngx_cycle_t *cycle);
+ngx_int_t ngx_count_modules(ngx_cycle_t *cycle, ngx_uint_t type);
+
+
+ngx_int_t ngx_add_module(ngx_conf_t *cf, ngx_str_t *file,
+ ngx_module_t *module, char **order);
+
+
+extern ngx_module_t *ngx_modules[];
+extern ngx_uint_t ngx_max_module;
+
+extern char *ngx_module_names[];
+
+
+#endif /* _NGX_MODULE_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/core/ngx_resolver.c
^
|
@@ -12,6 +12,9 @@
#define NGX_RESOLVER_UDP_SIZE 4096
+#define NGX_RESOLVER_TCP_RSIZE (2 + 65535)
+#define NGX_RESOLVER_TCP_WSIZE 8192
+
typedef struct {
u_char ident_hi;
@@ -53,7 +56,8 @@
((u_char *) (n) - offsetof(ngx_resolver_node_t, node))
-ngx_int_t ngx_udp_connect(ngx_udp_connection_t *uc);
+ngx_int_t ngx_udp_connect(ngx_resolver_connection_t *rec);
+ngx_int_t ngx_tcp_connect(ngx_resolver_connection_t *rec);
static void ngx_resolver_cleanup(void *data);
@@ -64,6 +68,10 @@
ngx_queue_t *queue);
static ngx_int_t ngx_resolver_send_query(ngx_resolver_t *r,
ngx_resolver_node_t *rn);
+static ngx_int_t ngx_resolver_send_udp_query(ngx_resolver_t *r,
+ ngx_resolver_connection_t *rec, u_char *query, u_short qlen);
+static ngx_int_t ngx_resolver_send_tcp_query(ngx_resolver_t *r,
+ ngx_resolver_connection_t *rec, u_char *query, u_short qlen);
static ngx_int_t ngx_resolver_create_name_query(ngx_resolver_t *r,
ngx_resolver_node_t *rn, ngx_str_t *name);
static ngx_int_t ngx_resolver_create_addr_query(ngx_resolver_t *r,
@@ -72,12 +80,14 @@
static time_t ngx_resolver_resend(ngx_resolver_t *r, ngx_rbtree_t *tree,
ngx_queue_t *queue);
static ngx_uint_t ngx_resolver_resend_empty(ngx_resolver_t *r);
-static void ngx_resolver_read_response(ngx_event_t *rev);
+static void ngx_resolver_udp_read(ngx_event_t *rev);
+static void ngx_resolver_tcp_write(ngx_event_t *wev);
+static void ngx_resolver_tcp_read(ngx_event_t *rev);
static void ngx_resolver_process_response(ngx_resolver_t *r, u_char *buf,
- size_t n);
+ size_t n, ngx_uint_t tcp);
static void ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t n,
ngx_uint_t ident, ngx_uint_t code, ngx_uint_t qtype,
- ngx_uint_t nan, ngx_uint_t ans);
+ ngx_uint_t nan, ngx_uint_t trunc, ngx_uint_t ans);
static void ngx_resolver_process_ptr(ngx_resolver_t *r, u_char *buf, size_t n,
ngx_uint_t ident, ngx_uint_t code, ngx_uint_t nan);
static ngx_resolver_node_t *ngx_resolver_lookup_name(ngx_resolver_t *r,
@@ -110,12 +120,12 @@
ngx_resolver_t *
ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
{
- ngx_str_t s;
- ngx_url_t u;
- ngx_uint_t i, j;
- ngx_resolver_t *r;
- ngx_pool_cleanup_t *cln;
- ngx_udp_connection_t *uc;
+ ngx_str_t s;
+ ngx_url_t u;
+ ngx_uint_t i, j;
+ ngx_resolver_t *r;
+ ngx_pool_cleanup_t *cln;
+ ngx_resolver_connection_t *rec;
cln = ngx_pool_cleanup_add(cf->pool, 0);
if (cln == NULL) {
@@ -165,6 +175,7 @@
r->ident = -1;
r->resend_timeout = 5;
+ r->tcp_timeout = 5;
r->expire = 30;
r->valid = 0;
@@ -172,8 +183,8 @@
r->log_level = NGX_LOG_ERR;
if (n) {
- if (ngx_array_init(&r->udp_connections, cf->pool, n,
- sizeof(ngx_udp_connection_t))
+ if (ngx_array_init(&r->connections, cf->pool, n,
+ sizeof(ngx_resolver_connection_t))
!= NGX_OK)
{
return NULL;
@@ -230,17 +241,18 @@
return NULL;
}
- uc = ngx_array_push_n(&r->udp_connections, u.naddrs);
- if (uc == NULL) {
+ rec = ngx_array_push_n(&r->connections, u.naddrs);
+ if (rec == NULL) {
return NULL;
}
- ngx_memzero(uc, u.naddrs * sizeof(ngx_udp_connection_t));
+ ngx_memzero(rec, u.naddrs * sizeof(ngx_resolver_connection_t));
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;
+ rec[j].sockaddr = u.addrs[j].sockaddr;
+ rec[j].socklen = u.addrs[j].socklen;
+ rec[j].server = u.addrs[j].name;
+ rec[j].resolver = r;
}
}
@@ -253,8 +265,8 @@
{
ngx_resolver_t *r = data;
- ngx_uint_t i;
- ngx_udp_connection_t *uc;
+ ngx_uint_t i;
+ ngx_resolver_connection_t *rec;
if (r) {
ngx_log_debug0(NGX_LOG_DEBUG_CORE, ngx_cycle->log, 0,
@@ -273,11 +285,25 @@
}
- uc = r->udp_connections.elts;
+ rec = r->connections.elts;
+
+ for (i = 0; i < r->connections.nelts; i++) {
+ if (rec[i].udp) {
+ ngx_close_connection(rec[i].udp);
+ }
+
+ if (rec[i].tcp) {
+ ngx_close_connection(rec[i].tcp);
+ }
+
+ if (rec[i].read_buf) {
+ ngx_resolver_free(r, rec[i].read_buf->start);
+ ngx_resolver_free(r, rec[i].read_buf);
+ }
- for (i = 0; i < r->udp_connections.nelts; i++) {
- if (uc[i].connection) {
- ngx_close_connection(uc[i].connection);
+ if (rec[i].write_buf) {
+ ngx_resolver_free(r, rec[i].write_buf->start);
+ ngx_resolver_free(r, rec[i].write_buf);
}
}
@@ -340,7 +366,7 @@
}
}
- if (r->udp_connections.nelts == 0) {
+ if (r->connections.nelts == 0) {
return NGX_NO_RESOLVER;
}
@@ -685,9 +711,16 @@
return NGX_OK;
}
+ rn->last_connection = r->last_connection++;
+ if (r->last_connection == r->connections.nelts) {
+ r->last_connection = 0;
+ }
+
rn->naddrs = (u_short) -1;
+ rn->tcp = 0;
#if (NGX_HAVE_INET6)
rn->naddrs6 = r->ipv6 ? (u_short) -1 : 0;
+ rn->tcp6 = 0;
#endif
if (ngx_resolver_send_query(r, rn) != NGX_OK) {
@@ -897,9 +930,16 @@
goto failed;
}
+ rn->last_connection = r->last_connection++;
+ if (r->last_connection == r->connections.nelts) {
+ r->last_connection = 0;
+ }
+
rn->naddrs = (u_short) -1;
+ rn->tcp = 0;
#if (NGX_HAVE_INET6)
rn->naddrs6 = (u_short) -1;
+ rn->tcp6 = 0;
#endif
if (ngx_resolver_send_query(r, rn) != NGX_OK) {
@@ -1094,59 +1134,158 @@
static ngx_int_t
ngx_resolver_send_query(ngx_resolver_t *r, ngx_resolver_node_t *rn)
{
- ssize_t n;
- ngx_udp_connection_t *uc;
+ ngx_int_t rc;
+ ngx_resolver_connection_t *rec;
- uc = r->udp_connections.elts;
+ rec = r->connections.elts;
+ rec = &rec[rn->last_connection];
- uc = &uc[r->last_connection++];
- if (r->last_connection == r->udp_connections.nelts) {
- r->last_connection = 0;
+ if (rec->log.handler == NULL) {
+ rec->log = *r->log;
+ rec->log.handler = ngx_resolver_log_error;
+ rec->log.data = rec;
+ rec->log.action = "resolving";
}
- if (uc->connection == NULL) {
-
- uc->log = *r->log;
- uc->log.handler = ngx_resolver_log_error;
- uc->log.data = uc;
- uc->log.action = "resolving";
+ if (rn->naddrs == (u_short) -1) {
+ rc = rn->tcp ? ngx_resolver_send_tcp_query(r, rec, rn->query, rn->qlen)
+ : ngx_resolver_send_udp_query(r, rec, rn->query, rn->qlen);
- if (ngx_udp_connect(uc) != NGX_OK) {
- return NGX_ERROR;
+ if (rc != NGX_OK) {
+ return rc;
}
-
- uc->connection->data = r;
- uc->connection->read->handler = ngx_resolver_read_response;
- uc->connection->read->resolver = 1;
}
- if (rn->naddrs == (u_short) -1) {
- n = ngx_send(uc->connection, rn->query, rn->qlen);
+#if (NGX_HAVE_INET6)
- if (n == -1) {
- return NGX_ERROR;
+ if (rn->query6 && rn->naddrs6 == (u_short) -1) {
+ rc = rn->tcp6
+ ? ngx_resolver_send_tcp_query(r, rec, rn->query6, rn->qlen)
+ : ngx_resolver_send_udp_query(r, rec, rn->query6, rn->qlen);
+
+ if (rc != NGX_OK) {
+ return rc;
}
+ }
+
+#endif
+
+ return NGX_OK;
+}
- if ((size_t) n != (size_t) rn->qlen) {
- ngx_log_error(NGX_LOG_CRIT, &uc->log, 0, "send() incomplete");
+
+static ngx_int_t
+ngx_resolver_send_udp_query(ngx_resolver_t *r, ngx_resolver_connection_t *rec,
+ u_char *query, u_short qlen)
+{
+ ssize_t n;
+
+ if (rec->udp == NULL) {
+ if (ngx_udp_connect(rec) != NGX_OK) {
return NGX_ERROR;
}
+
+ rec->udp->data = rec;
+ rec->udp->read->handler = ngx_resolver_udp_read;
+ rec->udp->read->resolver = 1;
}
-#if (NGX_HAVE_INET6)
- if (rn->query6 && rn->naddrs6 == (u_short) -1) {
- n = ngx_send(uc->connection, rn->query6, rn->qlen);
+ n = ngx_send(rec->udp, query, qlen);
- if (n == -1) {
- return NGX_ERROR;
+ if (n == -1) {
+ return NGX_ERROR;
+ }
+
+ if ((size_t) n != (size_t) qlen) {
+ ngx_log_error(NGX_LOG_CRIT, &rec->log, 0, "send() incomplete");
+ return NGX_ERROR;
+ }
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
+ngx_resolver_send_tcp_query(ngx_resolver_t *r, ngx_resolver_connection_t *rec,
+ u_char *query, u_short qlen)
+{
+ ngx_buf_t *b;
+ ngx_int_t rc;
+
+ rc = NGX_OK;
+
+ if (rec->tcp == NULL) {
+ b = rec->read_buf;
+
+ if (b == NULL) {
+ b = ngx_resolver_calloc(r, sizeof(ngx_buf_t));
+ if (b == NULL) {
+ return NGX_ERROR;
+ }
+
+ b->start = ngx_resolver_alloc(r, NGX_RESOLVER_TCP_RSIZE);
+ if (b->start == NULL) {
+ ngx_resolver_free(r, b);
+ return NGX_ERROR;
+ }
+
+ b->end = b->start + NGX_RESOLVER_TCP_RSIZE;
+
+ rec->read_buf = b;
}
- if ((size_t) n != (size_t) rn->qlen) {
- ngx_log_error(NGX_LOG_CRIT, &uc->log, 0, "send() incomplete");
+ b->pos = b->start;
+ b->last = b->start;
+
+ b = rec->write_buf;
+
+ if (b == NULL) {
+ b = ngx_resolver_calloc(r, sizeof(ngx_buf_t));
+ if (b == NULL) {
+ return NGX_ERROR;
+ }
+
+ b->start = ngx_resolver_alloc(r, NGX_RESOLVER_TCP_WSIZE);
+ if (b->start == NULL) {
+ ngx_resolver_free(r, b);
+ return NGX_ERROR;
+ }
+
+ b->end = b->start + NGX_RESOLVER_TCP_WSIZE;
+
+ rec->write_buf = b;
+ }
+
+ b->pos = b->start;
+ b->last = b->start;
+
+ rc = ngx_tcp_connect(rec);
+ if (rc == NGX_ERROR) {
return NGX_ERROR;
}
+
+ rec->tcp->data = rec;
+ rec->tcp->write->handler = ngx_resolver_tcp_write;
+ rec->tcp->read->handler = ngx_resolver_tcp_read;
+ rec->tcp->read->resolver = 1;
+
+ ngx_add_timer(rec->tcp->write, (ngx_msec_t) (r->tcp_timeout * 1000));
+ }
+
+ b = rec->write_buf;
+
+ if (b->end - b->last < 2 + qlen) {
+ ngx_log_error(NGX_LOG_CRIT, &rec->log, 0, "buffer overflow");
+ return NGX_ERROR;
+ }
+
+ *b->last++ = (u_char) (qlen >> 8);
+ *b->last++ = (u_char) qlen;
+ b->last = ngx_cpymem(b->last, query, qlen);
+
+ if (rc == NGX_OK) {
+ ngx_resolver_tcp_write(rec->tcp->write);
}
-#endif
return NGX_OK;
}
@@ -1244,6 +1383,10 @@
if (rn->waiting) {
+ if (++rn->last_connection == r->connections.nelts) {
+ rn->last_connection = 0;
+ }
+
(void) ngx_resolver_send_query(r, rn);
rn->expire = now + r->resend_timeout;
@@ -1272,13 +1415,15 @@
static void
-ngx_resolver_read_response(ngx_event_t *rev)
+ngx_resolver_udp_read(ngx_event_t *rev)
{
- ssize_t n;
- ngx_connection_t *c;
- u_char buf[NGX_RESOLVER_UDP_SIZE];
+ ssize_t n;
+ ngx_connection_t *c;
+ ngx_resolver_connection_t *rec;
+ u_char buf[NGX_RESOLVER_UDP_SIZE];
c = rev->data;
+ rec = c->data;
do {
n = ngx_udp_recv(c, buf, NGX_RESOLVER_UDP_SIZE);
@@ -1287,17 +1432,144 @@
return;
}
- ngx_resolver_process_response(c->data, buf, n);
+ ngx_resolver_process_response(rec->resolver, buf, n, 0);
} while (rev->ready);
}
static void
-ngx_resolver_process_response(ngx_resolver_t *r, u_char *buf, size_t n)
+ngx_resolver_tcp_write(ngx_event_t *wev)
+{
+ off_t sent;
+ ssize_t n;
+ ngx_buf_t *b;
+ ngx_resolver_t *r;
+ ngx_connection_t *c;
+ ngx_resolver_connection_t *rec;
+
+ c = wev->data;
+ rec = c->data;
+ b = rec->write_buf;
+ r = rec->resolver;
+
+ if (wev->timedout) {
+ goto failed;
+ }
+
+ sent = c->sent;
+
+ while (wev->ready && b->pos < b->last) {
+ n = ngx_send(c, b->pos, b->last - b->pos);
+
+ if (n == NGX_AGAIN) {
+ break;
+ }
+
+ if (n == NGX_ERROR) {
+ goto failed;
+ }
+
+ b->pos += n;
+ }
+
+ if (b->pos != b->start) {
+ b->last = ngx_movemem(b->start, b->pos, b->last - b->pos);
+ b->pos = b->start;
+ }
+
+ if (c->sent != sent) {
+ ngx_add_timer(wev, (ngx_msec_t) (r->tcp_timeout * 1000));
+ }
+
+ if (ngx_handle_write_event(wev, 0) != NGX_OK) {
+ goto failed;
+ }
+
+ return;
+
+failed:
+
+ ngx_close_connection(c);
+ rec->tcp = NULL;
+}
+
+
+static void
+ngx_resolver_tcp_read(ngx_event_t *rev)
+{
+ u_char *p;
+ size_t size;
+ ssize_t n;
+ u_short qlen;
+ ngx_buf_t *b;
+ ngx_resolver_t *r;
+ ngx_connection_t *c;
+ ngx_resolver_connection_t *rec;
+
+ c = rev->data;
+ rec = c->data;
+ b = rec->read_buf;
+ r = rec->resolver;
+
+ while (rev->ready) {
+ n = ngx_recv(c, b->last, b->end - b->last);
+
+ if (n == NGX_AGAIN) {
+ break;
+ }
+
+ if (n == NGX_ERROR || n == 0) {
+ goto failed;
+ }
+
+ b->last += n;
+
+ for ( ;; ) {
+ p = b->pos;
+ size = b->last - p;
+
+ if (size < 2) {
+ break;
+ }
+
+ qlen = (u_short) *p++ << 8;
+ qlen += *p++;
+
+ if (size < (size_t) (2 + qlen)) {
+ break;
+ }
+
+ ngx_resolver_process_response(r, p, qlen, 1);
+
+ b->pos += 2 + qlen;
+ }
+
+ if (b->pos != b->start) {
+ b->last = ngx_movemem(b->start, b->pos, b->last - b->pos);
+ b->pos = b->start;
+ }
+ }
+
+ if (ngx_handle_read_event(rev, 0) != NGX_OK) {
+ goto failed;
+ }
+
+ return;
+
+failed:
+
+ ngx_close_connection(c);
+ rec->tcp = NULL;
+}
+
+
+static void
+ngx_resolver_process_response(ngx_resolver_t *r, u_char *buf, size_t n,
+ ngx_uint_t tcp)
{
char *err;
- ngx_uint_t i, times, ident, qident, flags, code, nqs, nan,
+ ngx_uint_t i, times, ident, qident, flags, code, nqs, nan, trunc,
qtype, qclass;
#if (NGX_HAVE_INET6)
ngx_uint_t qident6;
@@ -1317,6 +1589,7 @@
flags = (response->flags_hi << 8) + response->flags_lo;
nqs = (response->nqs_hi << 8) + response->nqs_lo;
nan = (response->nan_hi << 8) + response->nan_lo;
+ trunc = flags & 0x0200;
ngx_log_debug6(NGX_LOG_DEBUG_CORE, r->log, 0,
"resolver DNS response %ui fl:%04Xui %ui/%ui/%ud/%ud",
@@ -1325,9 +1598,10 @@
(response->nar_hi << 8) + response->nar_lo);
/* response to a standard query */
- if ((flags & 0xf870) != 0x8000) {
+ if ((flags & 0xf870) != 0x8000 || (trunc && tcp)) {
ngx_log_error(r->log_level, r->log, 0,
- "invalid DNS response %ui fl:%04Xui", ident, flags);
+ "invalid %s DNS response %ui fl:%04Xui",
+ tcp ? "TCP" : "UDP", ident, flags);
return;
}
@@ -1417,7 +1691,7 @@
case NGX_RESOLVE_AAAA:
#endif
- ngx_resolver_process_a(r, buf, n, ident, code, qtype, nan,
+ ngx_resolver_process_a(r, buf, n, ident, code, qtype, nan, trunc,
i + sizeof(ngx_resolver_qs_t));
break;
@@ -1464,28 +1738,29 @@
static void
-ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
+ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t n,
ngx_uint_t ident, ngx_uint_t code, ngx_uint_t qtype,
- ngx_uint_t nan, ngx_uint_t ans)
+ ngx_uint_t nan, ngx_uint_t trunc, ngx_uint_t ans)
{
- char *err;
- u_char *cname;
- size_t len;
- int32_t ttl;
- uint32_t hash;
- in_addr_t *addr;
- ngx_str_t name;
- ngx_addr_t *addrs;
- ngx_uint_t type, class, qident, naddrs, a, i, n, start;
-#if (NGX_HAVE_INET6)
- struct in6_addr *addr6;
-#endif
- ngx_resolver_an_t *an;
- ngx_resolver_ctx_t *ctx, *next;
- ngx_resolver_node_t *rn;
+ char *err;
+ u_char *cname;
+ size_t len;
+ int32_t ttl;
+ uint32_t hash;
+ in_addr_t *addr;
+ ngx_str_t name;
+ ngx_addr_t *addrs;
+ ngx_uint_t type, class, qident, naddrs, a, i, j, start;
+#if (NGX_HAVE_INET6)
+ struct in6_addr *addr6;
+#endif
+ ngx_resolver_an_t *an;
+ ngx_resolver_ctx_t *ctx, *next;
+ ngx_resolver_node_t *rn;
+ ngx_resolver_connection_t *rec;
if (ngx_resolver_copy(r, &name, buf,
- buf + sizeof(ngx_resolver_hdr_t), buf + last)
+ buf + sizeof(ngx_resolver_hdr_t), buf + n)
!= NGX_OK)
{
return;
@@ -1518,6 +1793,11 @@
goto failed;
}
+ if (trunc && rn->tcp6) {
+ ngx_resolver_free(r, name.data);
+ goto failed;
+ }
+
qident = (rn->query6[0] << 8) + rn->query6[1];
break;
@@ -1532,6 +1812,11 @@
goto failed;
}
+ if (trunc && rn->tcp) {
+ ngx_resolver_free(r, name.data);
+ goto failed;
+ }
+
qident = (rn->query[0] << 8) + rn->query[1];
}
@@ -1545,6 +1830,45 @@
ngx_resolver_free(r, name.data);
+ if (trunc) {
+
+ ngx_queue_remove(&rn->queue);
+
+ if (rn->waiting == NULL) {
+ ngx_rbtree_delete(&r->name_rbtree, &rn->node);
+ ngx_resolver_free_node(r, rn);
+ goto next;
+ }
+
+ rec = r->connections.elts;
+ rec = &rec[rn->last_connection];
+
+ switch (qtype) {
+
+#if (NGX_HAVE_INET6)
+ case NGX_RESOLVE_AAAA:
+
+ rn->tcp6 = 1;
+
+ (void) ngx_resolver_send_tcp_query(r, rec, rn->query6, rn->qlen);
+
+ break;
+#endif
+
+ default: /* NGX_RESOLVE_A */
+
+ rn->tcp = 1;
+
+ (void) ngx_resolver_send_tcp_query(r, rec, rn->query, rn->qlen);
+ }
+
+ rn->expire = ngx_time() + r->resend_timeout;
+
+ ngx_queue_insert_head(&r->name_resend_queue, &rn->queue);
+
+ goto next;
+ }
+
if (code == 0 && rn->code) {
code = rn->code;
}
@@ -1642,7 +1966,7 @@
start = i;
- while (i < last) {
+ while (i < n) {
if (buf[i] & 0xc0) {
i += 2;
@@ -1668,7 +1992,7 @@
found:
- if (i + sizeof(ngx_resolver_an_t) >= last) {
+ if (i + sizeof(ngx_resolver_an_t) >= n) {
goto short_response;
}
@@ -1708,7 +2032,7 @@
goto invalid;
}
- if (i + 4 > last) {
+ if (i + 4 > n) {
goto short_response;
}
@@ -1729,7 +2053,7 @@
goto invalid;
}
- if (i + 16 > last) {
+ if (i + 16 > n) {
goto short_response;
}
@@ -1810,7 +2134,7 @@
#endif
}
- n = 0;
+ j = 0;
i = ans;
for (a = 0; a < nan; a++) {
@@ -1839,10 +2163,10 @@
if (type == NGX_RESOLVE_A) {
- addr[n] = htonl((buf[i] << 24) + (buf[i + 1] << 16)
+ addr[j] = htonl((buf[i] << 24) + (buf[i + 1] << 16)
+ (buf[i + 2] << 8) + (buf[i + 3]));
- if (++n == naddrs) {
+ if (++j == naddrs) {
#if (NGX_HAVE_INET6)
if (rn->naddrs6 == (u_short) -1) {
@@ -1857,9 +2181,9 @@
#if (NGX_HAVE_INET6)
else if (type == NGX_RESOLVE_AAAA) {
- ngx_memcpy(addr6[n].s6_addr, &buf[i], 16);
+ ngx_memcpy(addr6[j].s6_addr, &buf[i], 16);
- if (++n == naddrs) {
+ if (++j == naddrs) {
if (rn->naddrs == (u_short) -1) {
goto next;
@@ -1984,7 +2308,7 @@
goto next;
}
- if (ngx_resolver_copy(r, &name, buf, cname, buf + last) != NGX_OK) {
+ if (ngx_resolver_copy(r, &name, buf, cname, buf + n) != NGX_OK) {
goto failed;
}
@@ -2072,12 +2396,11 @@
{
char *err;
size_t len;
- u_char text[NGX_SOCKADDR_STRLEN];
in_addr_t addr;
int32_t ttl;
ngx_int_t octet;
ngx_str_t name;
- ngx_uint_t i, mask, qident, class;
+ ngx_uint_t mask, type, class, qident, a, i, start;
ngx_queue_t *expire_queue;
ngx_rbtree_t *tree;
ngx_resolver_an_t *an;
@@ -2089,13 +2412,15 @@
struct in6_addr addr6;
#endif
- if (ngx_resolver_copy(r, NULL, buf,
+ if (ngx_resolver_copy(r, &name, buf,
buf + sizeof(ngx_resolver_hdr_t), buf + n)
!= NGX_OK)
{
return;
}
+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, r->log, 0, "resolver qs:%V", &name);
+
/* AF_INET */
addr = 0;
@@ -2123,10 +2448,6 @@
tree = &r->addr_rbtree;
expire_queue = &r->addr_expire_queue;
- addr = htonl(addr);
- name.len = ngx_inet_ntop(AF_INET, &addr, text, NGX_SOCKADDR_STRLEN);
- name.data = text;
-
goto valid;
}
@@ -2171,9 +2492,6 @@
tree = &r->addr6_rbtree;
expire_queue = &r->addr6_expire_queue;
- name.len = ngx_inet6_ntop(addr6.s6_addr, text, NGX_SOCKADDR_STRLEN);
- name.data = text;
-
goto valid;
}
@@ -2182,6 +2500,7 @@
ngx_log_error(r->log_level, r->log, 0,
"invalid in-addr.arpa or ip6.arpa name in DNS response");
+ ngx_resolver_free(r, name.data);
return;
valid:
@@ -2189,6 +2508,7 @@
if (rn == NULL || rn->query == NULL) {
ngx_log_error(r->log_level, r->log, 0,
"unexpected response for %V", &name);
+ ngx_resolver_free(r, name.data);
goto failed;
}
@@ -2198,9 +2518,12 @@
ngx_log_error(r->log_level, r->log, 0,
"wrong ident %ui response for %V, expect %ui",
ident, &name, qident);
+ ngx_resolver_free(r, name.data);
goto failed;
}
+ ngx_resolver_free(r, name.data);
+
if (code == 0 && nan == 0) {
code = NGX_RESOLVE_NXDOMAIN;
}
@@ -2230,45 +2553,91 @@
i += sizeof(ngx_resolver_qs_t);
- if (i + 2 + sizeof(ngx_resolver_an_t) >= n) {
+ for (a = 0; a < nan; a++) {
+
+ start = i;
+
+ while (i < n) {
+
+ if (buf[i] & 0xc0) {
+ i += 2;
+ goto found;
+ }
+
+ if (buf[i] == 0) {
+ i++;
+ goto test_length;
+ }
+
+ i += 1 + buf[i];
+ }
+
goto short_response;
- }
- /* compression pointer to *.arpa */
+ test_length:
- if (buf[i] != 0xc0 || buf[i + 1] != sizeof(ngx_resolver_hdr_t)) {
- err = "invalid in-addr.arpa or ip6.arpa name in DNS response";
- goto invalid;
- }
+ if (i - start < 2) {
+ err = "invalid name in DNS response";
+ goto invalid;
+ }
- an = (ngx_resolver_an_t *) &buf[i + 2];
+ found:
- class = (an->class_hi << 8) + an->class_lo;
- len = (an->len_hi << 8) + an->len_lo;
- ttl = (an->ttl[0] << 24) + (an->ttl[1] << 16)
- + (an->ttl[2] << 8) + (an->ttl[3]);
+ if (i + sizeof(ngx_resolver_an_t) >= n) {
+ goto short_response;
+ }
- if (class != 1) {
- ngx_log_error(r->log_level, r->log, 0,
- "unexpected RR class %ui", class);
- goto failed;
- }
+ an = (ngx_resolver_an_t *) &buf[i];
- if (ttl < 0) {
- ttl = 0;
- }
+ type = (an->type_hi << 8) + an->type_lo;
+ class = (an->class_hi << 8) + an->class_lo;
+ len = (an->len_hi << 8) + an->len_lo;
+ ttl = (an->ttl[0] << 24) + (an->ttl[1] << 16)
+ + (an->ttl[2] << 8) + (an->ttl[3]);
- ngx_log_debug3(NGX_LOG_DEBUG_CORE, r->log, 0,
- "resolver qt:%ui cl:%ui len:%uz",
- (an->type_hi << 8) + an->type_lo,
- class, len);
+ if (class != 1) {
+ ngx_log_error(r->log_level, r->log, 0,
+ "unexpected RR class %ui", class);
+ goto failed;
+ }
- i += 2 + sizeof(ngx_resolver_an_t);
+ if (ttl < 0) {
+ ttl = 0;
+ }
- if (i + len > n) {
- goto short_response;
+ ngx_log_debug3(NGX_LOG_DEBUG_CORE, r->log, 0,
+ "resolver qt:%ui cl:%ui len:%uz",
+ type, class, len);
+
+ i += sizeof(ngx_resolver_an_t);
+
+ switch (type) {
+
+ case NGX_RESOLVE_PTR:
+
+ goto ptr;
+
+ case NGX_RESOLVE_CNAME:
+
+ break;
+
+ default:
+
+ ngx_log_error(r->log_level, r->log, 0,
+ "unexpected RR type %ui", type);
+ }
+
+ i += len;
}
+ /* unlock addr mutex */
+
+ ngx_log_error(r->log_level, r->log, 0,
+ "no PTR type in DNS response");
+ return;
+
+ptr:
+
if (ngx_resolver_copy(r, &name, buf, buf + i, buf + n) != NGX_OK) {
goto failed;
}
@@ -3074,8 +3443,8 @@
static u_char *
ngx_resolver_log_error(ngx_log_t *log, u_char *buf, size_t len)
{
- u_char *p;
- ngx_udp_connection_t *uc;
+ u_char *p;
+ ngx_resolver_connection_t *rec;
p = buf;
@@ -3084,10 +3453,10 @@
len -= p - buf;
}
- uc = log->data;
+ rec = log->data;
- if (uc) {
- p = ngx_snprintf(p, len, ", resolver: %V", &uc->server);
+ if (rec) {
+ p = ngx_snprintf(p, len, ", resolver: %V", &rec->server);
}
return p;
@@ -3095,7 +3464,7 @@
ngx_int_t
-ngx_udp_connect(ngx_udp_connection_t *uc)
+ngx_udp_connect(ngx_resolver_connection_t *rec)
{
int rc;
ngx_int_t event;
@@ -3103,21 +3472,21 @@
ngx_socket_t s;
ngx_connection_t *c;
- s = ngx_socket(uc->sockaddr->sa_family, SOCK_DGRAM, 0);
+ s = ngx_socket(rec->sockaddr->sa_family, SOCK_DGRAM, 0);
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &uc->log, 0, "UDP socket %d", s);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &rec->log, 0, "UDP socket %d", s);
if (s == (ngx_socket_t) -1) {
- ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
+ ngx_log_error(NGX_LOG_ALERT, &rec->log, ngx_socket_errno,
ngx_socket_n " failed");
return NGX_ERROR;
}
- c = ngx_get_connection(s, &uc->log);
+ c = ngx_get_connection(s, &rec->log);
if (c == NULL) {
if (ngx_close_socket(s) == -1) {
- ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
+ ngx_log_error(NGX_LOG_ALERT, &rec->log, ngx_socket_errno,
ngx_close_socket_n "failed");
}
@@ -3125,7 +3494,7 @@
}
if (ngx_nonblocking(s) == -1) {
- ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
+ ngx_log_error(NGX_LOG_ALERT, &rec->log, ngx_socket_errno,
ngx_nonblocking_n " failed");
goto failed;
@@ -3134,22 +3503,22 @@
rev = c->read;
wev = c->write;
- rev->log = &uc->log;
- wev->log = &uc->log;
+ rev->log = &rec->log;
+ wev->log = &rec->log;
- uc->connection = c;
+ rec->udp = c;
c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1);
- ngx_log_debug3(NGX_LOG_DEBUG_EVENT, &uc->log, 0,
- "connect to %V, fd:%d #%uA", &uc->server, s, c->number);
+ ngx_log_debug3(NGX_LOG_DEBUG_EVENT, &rec->log, 0,
+ "connect to %V, fd:%d #%uA", &rec->server, s, c->number);
- rc = connect(s, uc->sockaddr, uc->socklen);
+ rc = connect(s, rec->sockaddr, rec->socklen);
/* TODO: iocp */
if (rc == -1) {
- ngx_log_error(NGX_LOG_CRIT, &uc->log, ngx_socket_errno,
+ ngx_log_error(NGX_LOG_CRIT, &rec->log, ngx_socket_errno,
"connect() failed");
goto failed;
@@ -3172,7 +3541,190 @@
failed:
ngx_close_connection(c);
- uc->connection = NULL;
+ rec->udp = NULL;
+
+ return NGX_ERROR;
+}
+
+
+ngx_int_t
+ngx_tcp_connect(ngx_resolver_connection_t *rec)
+{
+ int rc;
+ ngx_int_t event;
+ ngx_err_t err;
+ ngx_uint_t level;
+ ngx_socket_t s;
+ ngx_event_t *rev, *wev;
+ ngx_connection_t *c;
+
+ s = ngx_socket(rec->sockaddr->sa_family, SOCK_STREAM, 0);
+
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &rec->log, 0, "TCP socket %d", s);
+
+ if (s == (ngx_socket_t) -1) {
+ ngx_log_error(NGX_LOG_ALERT, &rec->log, ngx_socket_errno,
+ ngx_socket_n " failed");
+ return NGX_ERROR;
+ }
+
+ c = ngx_get_connection(s, &rec->log);
+
+ if (c == NULL) {
+ if (ngx_close_socket(s) == -1) {
+ ngx_log_error(NGX_LOG_ALERT, &rec->log, ngx_socket_errno,
+ ngx_close_socket_n "failed");
+ }
+
+ return NGX_ERROR;
+ }
+
+ if (ngx_nonblocking(s) == -1) {
+ ngx_log_error(NGX_LOG_ALERT, &rec->log, ngx_socket_errno,
+ ngx_nonblocking_n " failed");
+
+ goto failed;
+ }
+
+ rev = c->read;
+ wev = c->write;
+
+ rev->log = &rec->log;
+ wev->log = &rec->log;
+
+ rec->tcp = c;
+
+ c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1);
+
+ if (ngx_add_conn) {
+ if (ngx_add_conn(c) == NGX_ERROR) {
+ goto failed;
+ }
+ }
+
+ ngx_log_debug3(NGX_LOG_DEBUG_EVENT, &rec->log, 0,
+ "connect to %V, fd:%d #%uA", &rec->server, s, c->number);
+
+ rc = connect(s, rec->sockaddr, rec->socklen);
+
+ if (rc == -1) {
+ err = ngx_socket_errno;
+
+
+ if (err != NGX_EINPROGRESS
+#if (NGX_WIN32)
+ /* Winsock returns WSAEWOULDBLOCK (NGX_EAGAIN) */
+ && err != NGX_EAGAIN
+#endif
+ )
+ {
+ if (err == NGX_ECONNREFUSED
+#if (NGX_LINUX)
+ /*
+ * Linux returns EAGAIN instead of ECONNREFUSED
+ * for unix sockets if listen queue is full
+ */
+ || err == NGX_EAGAIN
+#endif
+ || err == NGX_ECONNRESET
+ || err == NGX_ENETDOWN
+ || err == NGX_ENETUNREACH
+ || err == NGX_EHOSTDOWN
+ || err == NGX_EHOSTUNREACH)
+ {
+ level = NGX_LOG_ERR;
+
+ } else {
+ level = NGX_LOG_CRIT;
+ }
+
+ ngx_log_error(level, c->log, err, "connect() to %V failed",
+ &rec->server);
+
+ ngx_close_connection(c);
+ rec->tcp = NULL;
+
+ return NGX_ERROR;
+ }
+ }
+
+ if (ngx_add_conn) {
+ if (rc == -1) {
+
+ /* NGX_EINPROGRESS */
+
+ return NGX_AGAIN;
+ }
+
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, &rec->log, 0, "connected");
+
+ wev->ready = 1;
+
+ return NGX_OK;
+ }
+
+ if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
+
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &rec->log, ngx_socket_errno,
+ "connect(): %d", rc);
+
+ if (ngx_blocking(s) == -1) {
+ ngx_log_error(NGX_LOG_ALERT, &rec->log, ngx_socket_errno,
+ ngx_blocking_n " failed");
+ goto failed;
+ }
+
+ /*
+ * FreeBSD's aio allows to post an operation on non-connected socket.
+ * NT does not support it.
+ *
+ * TODO: check in Win32, etc. As workaround we can use NGX_ONESHOT_EVENT
+ */
+
+ rev->ready = 1;
+ wev->ready = 1;
+
+ return NGX_OK;
+ }
+
+ if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
+
+ /* kqueue */
+
+ event = NGX_CLEAR_EVENT;
+
+ } else {
+
+ /* select, poll, /dev/poll */
+
+ event = NGX_LEVEL_EVENT;
+ }
+
+ if (ngx_add_event(rev, NGX_READ_EVENT, event) != NGX_OK) {
+ goto failed;
+ }
+
+ if (rc == -1) {
+
+ /* NGX_EINPROGRESS */
+
+ if (ngx_add_event(wev, NGX_WRITE_EVENT, event) != NGX_OK) {
+ goto failed;
+ }
+
+ return NGX_AGAIN;
+ }
+
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, &rec->log, 0, "connected");
+
+ wev->ready = 1;
+
+ return NGX_OK;
+
+failed:
+
+ ngx_close_connection(c);
+ rec->tcp = NULL;
return NGX_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/core/ngx_resolver.h
^
|
@@ -36,13 +36,20 @@
#define NGX_RESOLVER_MAX_RECURSION 50
+typedef struct ngx_resolver_s ngx_resolver_t;
+
+
typedef struct {
- ngx_connection_t *connection;
+ ngx_connection_t *udp;
+ ngx_connection_t *tcp;
struct sockaddr *sockaddr;
socklen_t socklen;
ngx_str_t server;
ngx_log_t log;
-} ngx_udp_connection_t;
+ ngx_buf_t *read_buf;
+ ngx_buf_t *write_buf;
+ ngx_resolver_t *resolver;
+} ngx_resolver_connection_t;
typedef struct ngx_resolver_ctx_s ngx_resolver_ctx_t;
@@ -93,11 +100,18 @@
time_t valid;
uint32_t ttl;
+ unsigned tcp:1;
+#if (NGX_HAVE_INET6)
+ unsigned tcp6:1;
+#endif
+
+ ngx_uint_t last_connection;
+
ngx_resolver_ctx_t *waiting;
} ngx_resolver_node_t;
-typedef struct {
+struct ngx_resolver_s {
/* has to be pointer because of "incomplete type" */
ngx_event_t *event;
void *dummy;
@@ -107,7 +121,7 @@
ngx_int_t ident;
/* simple round robin DNS peers balancer */
- ngx_array_t udp_connections;
+ ngx_array_t connections;
ngx_uint_t last_connection;
ngx_rbtree_t name_rbtree;
@@ -131,17 +145,18 @@
#endif
time_t resend_timeout;
+ time_t tcp_timeout;
time_t expire;
time_t valid;
ngx_uint_t log_level;
-} ngx_resolver_t;
+};
struct ngx_resolver_ctx_s {
ngx_resolver_ctx_t *next;
ngx_resolver_t *resolver;
- ngx_udp_connection_t *udp_connection;
+ ngx_resolver_node_t *node;
/* event ident must be after 3 pointers as in ngx_connection_t */
ngx_int_t ident;
@@ -161,8 +176,6 @@
ngx_uint_t quick; /* unsigned quick:1; */
ngx_uint_t recursion;
ngx_event_t *event;
-
- ngx_resolver_node_t *node;
};
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/event/ngx_event.c
^
|
@@ -606,16 +606,16 @@
return NGX_ERROR;
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
+ for (m = 0; cycle->modules[m]; m++) {
+ if (cycle->modules[m]->type != NGX_EVENT_MODULE) {
continue;
}
- if (ngx_modules[m]->ctx_index != ecf->use) {
+ if (cycle->modules[m]->ctx_index != ecf->use) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cycle->modules[m]->ctx;
if (module->actions.init(cycle, ngx_timer_resolution) != NGX_OK) {
/* fatal */
@@ -891,14 +891,7 @@
/* count the number of the event modules and set up their indices */
- ngx_event_max_module = 0;
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
- continue;
- }
-
- ngx_modules[i]->ctx_index = ngx_event_max_module++;
- }
+ ngx_event_max_module = ngx_count_modules(cf->cycle, NGX_EVENT_MODULE);
ctx = ngx_pcalloc(cf->pool, sizeof(void *));
if (ctx == NULL) {
@@ -912,16 +905,17 @@
*(void **) conf = ctx;
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) {
continue;
}
- m = ngx_modules[i]->ctx;
+ m = cf->cycle->modules[i]->ctx;
if (m->create_conf) {
- (*ctx)[ngx_modules[i]->ctx_index] = m->create_conf(cf->cycle);
- if ((*ctx)[ngx_modules[i]->ctx_index] == NULL) {
+ (*ctx)[cf->cycle->modules[i]->ctx_index] =
+ m->create_conf(cf->cycle);
+ if ((*ctx)[cf->cycle->modules[i]->ctx_index] == NULL) {
return NGX_CONF_ERROR;
}
}
@@ -940,15 +934,16 @@
return rv;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) {
continue;
}
- m = ngx_modules[i]->ctx;
+ m = cf->cycle->modules[i]->ctx;
if (m->init_conf) {
- rv = m->init_conf(cf->cycle, (*ctx)[ngx_modules[i]->ctx_index]);
+ rv = m->init_conf(cf->cycle,
+ (*ctx)[cf->cycle->modules[i]->ctx_index]);
if (rv != NGX_CONF_OK) {
return rv;
}
@@ -1009,15 +1004,15 @@
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_EVENT_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->name->len == value[1].len) {
if (ngx_strcmp(module->name->data, value[1].data) == 0) {
- ecf->use = ngx_modules[m]->ctx_index;
+ ecf->use = cf->cycle->modules[m]->ctx_index;
ecf->name = module->name->data;
if (ngx_process == NGX_PROCESS_SINGLE
@@ -1232,20 +1227,20 @@
#endif
if (module == NULL) {
- for (i = 0; ngx_modules[i]; i++) {
+ for (i = 0; cycle->modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
+ if (cycle->modules[i]->type != NGX_EVENT_MODULE) {
continue;
}
- event_module = ngx_modules[i]->ctx;
+ event_module = cycle->modules[i]->ctx;
if (ngx_strcmp(event_module->name->data, event_core_name.data) == 0)
{
continue;
}
- module = ngx_modules[i];
+ module = cycle->modules[i];
break;
}
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/http/modules/ngx_http_rewrite_module.c
^
|
@@ -560,12 +560,12 @@
return NGX_CONF_ERROR;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cf->cycle->modules[i]->ctx;
if (module->create_loc_conf) {
@@ -574,7 +574,7 @@
return NGX_CONF_ERROR;
}
- ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
}
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/http/ngx_http.c
^
|
@@ -144,14 +144,7 @@
/* count the number of the http modules and set up their indices */
- ngx_http_max_module = 0;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
- continue;
- }
-
- ngx_modules[m]->ctx_index = ngx_http_max_module++;
- }
+ ngx_http_max_module = ngx_count_modules(cf->cycle, NGX_HTTP_MODULE);
/* the http main_conf context, it is the same in the all http contexts */
@@ -190,13 +183,13 @@
* of the all http modules
*/
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
if (module->create_main_conf) {
ctx->main_conf[mi] = module->create_main_conf(cf);
@@ -223,12 +216,12 @@
pcf = *cf;
cf->ctx = ctx;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->preconfiguration) {
if (module->preconfiguration(cf) != NGX_OK) {
@@ -255,13 +248,13 @@
cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
cscfp = cmcf->servers.elts;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
/* init http{} main_conf's */
@@ -304,12 +297,12 @@
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->postconfiguration) {
if (module->postconfiguration(cf) != NGX_OK) {
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/http/ngx_http_core_module.c
^
|
@@ -2968,12 +2968,12 @@
return NGX_CONF_ERROR;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cf->cycle->modules[i]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
@@ -2981,7 +2981,7 @@
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[i]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[i]->ctx_index] = mconf;
}
if (module->create_loc_conf) {
@@ -2990,7 +2990,7 @@
return NGX_CONF_ERROR;
}
- ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
}
}
@@ -3086,17 +3086,17 @@
return NGX_CONF_ERROR;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cf->cycle->modules[i]->ctx;
if (module->create_loc_conf) {
- ctx->loc_conf[ngx_modules[i]->ctx_index] =
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] =
module->create_loc_conf(cf);
- if (ctx->loc_conf[ngx_modules[i]->ctx_index] == NULL) {
+ if (ctx->loc_conf[cf->cycle->modules[i]->ctx_index] == NULL) {
return NGX_CONF_ERROR;
}
}
@@ -4607,12 +4607,12 @@
return NGX_CONF_ERROR;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cf->cycle->modules[i]->ctx;
if (module->create_loc_conf) {
@@ -4621,7 +4621,7 @@
return NGX_CONF_ERROR;
}
- ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
}
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/http/ngx_http_upstream.c
^
|
@@ -5331,12 +5331,12 @@
return NGX_CONF_ERROR;
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
@@ -5344,7 +5344,7 @@
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
if (module->create_loc_conf) {
@@ -5353,7 +5353,7 @@
return NGX_CONF_ERROR;
}
- ctx->loc_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->loc_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/http/v2/ngx_http_v2.c
^
|
@@ -251,7 +251,7 @@
return;
}
- cln = ngx_pool_cleanup_add(c->pool, sizeof(ngx_pool_cleanup_file_t));
+ cln = ngx_pool_cleanup_add(c->pool, 0);
if (cln == NULL) {
ngx_http_close_connection(c);
return;
@@ -1185,6 +1185,8 @@
return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR);
}
+ stream->request->request_length = h2c->state.length;
+
stream->in_closed = h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG;
stream->node = node;
@@ -1731,11 +1733,21 @@
u_char *end, ngx_http_v2_handler_pt handler)
{
u_char *p;
- size_t len;
+ size_t len, skip;
uint32_t head;
len = h2c->state.length;
+ if (h2c->state.padding && (size_t) (end - pos) > len) {
+ skip = ngx_min(h2c->state.padding, (end - pos) - len);
+
+ h2c->state.padding -= skip;
+
+ p = pos;
+ pos += skip;
+ ngx_memmove(pos, p, len);
+ }
+
if ((size_t) (end - pos) < len + NGX_HTTP_V2_FRAME_HEADER_SIZE) {
return ngx_http_v2_state_save(h2c, pos, end, handler);
}
@@ -1751,7 +1763,6 @@
return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR);
}
- h2c->state.length += ngx_http_v2_parse_length(head);
h2c->state.flags |= p[4];
if (h2c->state.sid != ngx_http_v2_parse_sid(&p[5])) {
@@ -1766,6 +1777,14 @@
ngx_memcpy(pos, p, len);
+ len = ngx_http_v2_parse_length(head);
+
+ h2c->state.length += len;
+
+ if (h2c->state.stream) {
+ h2c->state.stream->request->request_length += len;
+ }
+
h2c->state.handler = handler;
return pos;
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/http/v2/ngx_http_v2.h
^
|
@@ -167,7 +167,6 @@
ngx_http_v2_connection_t *connection;
ngx_http_v2_node_t *node;
- ngx_uint_t header_buffers;
ngx_uint_t queued;
/*
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/http/v2/ngx_http_v2_filter_module.c
^
|
@@ -215,8 +215,8 @@
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (r->headers_out.server == NULL) {
- len += 1 + clcf->server_tokens ? ngx_http_v2_literal_size(NGINX_VER)
- : ngx_http_v2_literal_size("nginx");
+ len += 1 + (clcf->server_tokens ? ngx_http_v2_literal_size(NGINX_VER)
+ : ngx_http_v2_literal_size("nginx"));
}
if (r->headers_out.date == NULL) {
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/mail/ngx_mail.c
^
|
@@ -91,14 +91,7 @@
/* count the number of the mail modules and set up their indices */
- ngx_mail_max_module = 0;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
- continue;
- }
-
- ngx_modules[m]->ctx_index = ngx_mail_max_module++;
- }
+ ngx_mail_max_module = ngx_count_modules(cf->cycle, NGX_MAIL_MODULE);
/* the mail main_conf context, it is the same in the all mail contexts */
@@ -125,13 +118,13 @@
* create the main_conf's and the null srv_conf's of the all mail modules
*/
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
if (module->create_main_conf) {
ctx->main_conf[mi] = module->create_main_conf(cf);
@@ -169,13 +162,13 @@
cmcf = ctx->main_conf[ngx_mail_core_module.ctx_index];
cscfp = cmcf->servers.elts;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
/* init mail{} main_conf's */
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/mail/ngx_mail_core_module.c
^
|
@@ -237,12 +237,12 @@
return NGX_CONF_ERROR;
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
@@ -250,7 +250,7 @@
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
}
@@ -392,12 +392,12 @@
#endif
if (cscf->protocol == NULL) {
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->protocol == NULL) {
continue;
@@ -595,12 +595,12 @@
value = cf->args->elts;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->protocol
&& ngx_strcmp(module->protocol->name.data, value[1].data) == 0)
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/os/unix/ngx_darwin_config.h
^
|
@@ -48,6 +48,8 @@
#include <sys/sysctl.h>
#include <xlocale.h>
+#include <dlfcn.h>
+
#ifndef IOV_MAX
#define IOV_MAX 64
|
[-]
[+]
|
Added |
nginx-1.9.11.tar.bz2/src/os/unix/ngx_dlopen.c
^
|
@@ -0,0 +1,28 @@
+
+/*
+ * Copyright (C) Maxim Dounin
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+#if (NGX_HAVE_DLOPEN)
+
+char *
+ngx_dlerror(void)
+{
+ char *err;
+
+ err = (char *) dlerror();
+
+ if (err == NULL) {
+ return "";
+ }
+
+ return err;
+}
+
+#endif
|
[-]
[+]
|
Added |
nginx-1.9.11.tar.bz2/src/os/unix/ngx_dlopen.h
^
|
@@ -0,0 +1,31 @@
+
+/*
+ * Copyright (C) Maxim Dounin
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#ifndef _NGX_DLOPEN_H_INCLUDED_
+#define _NGX_DLOPEN_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+#define ngx_dlopen(path) dlopen((char *) path, RTLD_NOW | RTLD_GLOBAL)
+#define ngx_dlopen_n "dlopen()"
+
+#define ngx_dlsym(handle, symbol) dlsym(handle, symbol)
+#define ngx_dlsym_n "dlsym()"
+
+#define ngx_dlclose(handle) dlclose(handle)
+#define ngx_dlclose_n "dlclose()"
+
+
+#if (NGX_HAVE_DLOPEN)
+char *ngx_dlerror(void);
+#endif
+
+
+#endif /* _NGX_DLOPEN_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/os/unix/ngx_freebsd_config.h
^
|
@@ -49,6 +49,8 @@
#include <osreldate.h>
#include <sys/sysctl.h>
+#include <dlfcn.h>
+
#if __FreeBSD_version < 400017
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/os/unix/ngx_linux_config.h
^
|
@@ -55,6 +55,8 @@
#include <crypt.h>
#include <sys/utsname.h> /* uname() */
+#include <dlfcn.h>
+
#include <ngx_auto_config.h>
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/os/unix/ngx_posix_config.h
^
|
@@ -108,6 +108,11 @@
#include <ngx_auto_config.h>
+#if (NGX_HAVE_DLOPEN)
+#include <dlfcn.h>
+#endif
+
+
#if (NGX_HAVE_POSIX_SEM)
#include <semaphore.h>
#endif
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/os/unix/ngx_process_cycle.c
^
|
@@ -294,9 +294,9 @@
exit(2);
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->init_process) {
- if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->init_process) {
+ if (cycle->modules[i]->init_process(cycle) == NGX_ERROR) {
/* fatal */
exit(2);
}
@@ -310,9 +310,9 @@
if (ngx_terminate || ngx_quit) {
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->exit_process) {
- ngx_modules[i]->exit_process(cycle);
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->exit_process) {
+ cycle->modules[i]->exit_process(cycle);
}
}
@@ -689,9 +689,9 @@
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exit");
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->exit_master) {
- ngx_modules[i]->exit_master(cycle);
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->exit_master) {
+ cycle->modules[i]->exit_master(cycle);
}
}
@@ -895,9 +895,9 @@
ls[i].previous = NULL;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->init_process) {
- if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->init_process) {
+ if (cycle->modules[i]->init_process(cycle) == NGX_ERROR) {
/* fatal */
exit(2);
}
@@ -949,9 +949,9 @@
ngx_uint_t i;
ngx_connection_t *c;
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->exit_process) {
- ngx_modules[i]->exit_process(cycle);
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->exit_process) {
+ cycle->modules[i]->exit_process(cycle);
}
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/os/unix/ngx_solaris_config.h
^
|
@@ -55,6 +55,8 @@
#include <inttypes.h>
#include <crypt.h>
+#include <dlfcn.h>
+
#define NGX_ALIGNMENT _MAX_ALIGNMENT
#include <ngx_auto_config.h>
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/stream/ngx_stream.c
^
|
@@ -91,14 +91,7 @@
/* count the number of the stream modules and set up their indices */
- ngx_stream_max_module = 0;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
- continue;
- }
-
- ngx_modules[m]->ctx_index = ngx_stream_max_module++;
- }
+ ngx_stream_max_module = ngx_count_modules(cf->cycle, NGX_STREAM_MODULE);
/* the stream main_conf context, it's the same in the all stream contexts */
@@ -126,13 +119,13 @@
* create the main_conf's and the null srv_conf's of the all stream modules
*/
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
if (module->create_main_conf) {
ctx->main_conf[mi] = module->create_main_conf(cf);
@@ -170,13 +163,13 @@
cmcf = ctx->main_conf[ngx_stream_core_module.ctx_index];
cscfp = cmcf->servers.elts;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
/* init stream{} main_conf's */
@@ -208,12 +201,12 @@
}
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->postconfiguration) {
if (module->postconfiguration(cf) != NGX_OK) {
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/stream/ngx_stream_core_module.c
^
|
@@ -199,12 +199,12 @@
return NGX_CONF_ERROR;
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
@@ -212,7 +212,7 @@
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
}
|
[-]
[+]
|
Changed |
nginx-1.9.11.tar.bz2/src/stream/ngx_stream_upstream.c
^
|
@@ -116,12 +116,12 @@
uscf->srv_conf = ctx->srv_conf;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
@@ -129,7 +129,7 @@
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
}
|