nginx-0.1.9-RELEASE import

*) Bugfix: the proxied request was sent without arguments if the
       request contains "//", "/./", "/../" or "%XX".

    *) Bugfix: the large compressed responses may be transferred not
       completely.

    *) Bugfix: the files bigger than 2G was not transferred on Linux that
       does not support sendfile64().

    *) Bugfix: while the build configuration on Linux the
       --with-poll_module parameter was required; the bug had appeared in
       0.1.8.
This commit is contained in:
Igor Sysoev 2004-11-25 16:17:31 +00:00
parent 865a7de474
commit f69060481e
97 changed files with 573 additions and 478 deletions

View File

@ -34,10 +34,10 @@ CFLAGS="$CFLAGS -q"
# precompiled headers # precompiled headers
CORE_DEPS="$CORE_DEPS $OBJS/ngx_config.csm" CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.csm"
NGX_PCH="$OBJS/ngx_config.csm" NGX_PCH="$NGX_OBJS/ngx_config.csm"
NGX_BUILD_PCH="-H=$OBJS/ngx_config.csm" NGX_BUILD_PCH="-H=$NGX_OBJS/ngx_config.csm"
NGX_USE_PCH="-Hu -H=$OBJS/ngx_config.csm" NGX_USE_PCH="-Hu -H=$NGX_OBJS/ngx_config.csm"
# Win32 GUI mode application # Win32 GUI mode application
@ -45,11 +45,11 @@ LINK="\$(CC) -laa"
# the resource file # the resource file
NGX_RES="$OBJS/nginx.res" NGX_RES="$NGX_OBJS/nginx.res"
NGX_RCC="brcc32 -fo$OBJS/nginx.res \$(CORE_INCS) $NGX_WIN32_RC" NGX_RCC="brcc32 -fo$NGX_OBJS/nginx.res \$(CORE_INCS) $NGX_WIN32_RC"
# the pragma allows to link the resource file using bcc32 and # the pragma allows to link the resource file using bcc32 and
# to avoid the direct ilink32 calling and the c0w32.obj's WinMain/main problem # to avoid the direct ilink32 calling and the c0w32.obj's WinMain/main problem
NGX_PRAGMA="#pragma resource \"$OBJS/nginx.res\"" NGX_PRAGMA="#pragma resource \"$NGX_OBJS/nginx.res\""
ngx_include_opt="-I" ngx_include_opt="-I"

View File

@ -92,11 +92,11 @@ fi
CFLAGS="$CFLAGS $NGX_CC_OPT" CFLAGS="$CFLAGS $NGX_CC_OPT"
if [ "$PLATFORM" != win32 ]; then if [ "$NGX_PLATFORM" != win32 ]; then
if test -n "$NGX_LD_OPT"; then if test -n "$NGX_LD_OPT"; then
ngx_feature=--with-ld-opt=\"$NGX_LD_OPT\" ngx_feature=--with-ld-opt=\"$NGX_LD_OPT\"
ngx_feature_name="DUMMY" ngx_feature_name=
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs= ngx_feature_incs=
ngx_feature_libs= ngx_feature_libs=
@ -111,7 +111,7 @@ if [ "$PLATFORM" != win32 ]; then
fi fi
ngx_feature="gcc variadic macros" ngx_feature="gcc variadic macros"
ngx_feature_name="HAVE_GCC_VARIADIC_MACROS" ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
ngx_feature_run=yes ngx_feature_run=yes
ngx_feature_incs="#include <stdio.h> ngx_feature_incs="#include <stdio.h>
#define var(dummy, args...) sprintf(args)" #define var(dummy, args...) sprintf(args)"
@ -123,7 +123,7 @@ if [ "$PLATFORM" != win32 ]; then
ngx_feature="C99 variadic macros" ngx_feature="C99 variadic macros"
ngx_feature_name="HAVE_C99_VARIADIC_MACROS" ngx_feature_name="NGX_HAVE_C99_VARIADIC_MACROS"
ngx_feature_run=yes ngx_feature_run=yes
ngx_feature_incs="#include <stdio.h> ngx_feature_incs="#include <stdio.h>
#define var(dummy, ...) sprintf(__VA_ARGS__)" #define var(dummy, ...) sprintf(__VA_ARGS__)"
@ -135,7 +135,7 @@ if [ "$PLATFORM" != win32 ]; then
# ngx_feature="inline" # ngx_feature="inline"
# ngx_feature_name="DUMMY" # ngx_feature_name=
# ngx_feature_run=no # ngx_feature_run=no
# ngx_feature_incs="int inline f(void) { return 1 }" # ngx_feature_incs="int inline f(void) { return 1 }"
# ngx_feature_libs= # ngx_feature_libs=

View File

@ -18,7 +18,7 @@ CFLAGS="$CFLAGS -Ob2"
IPO="-ipo -ipo_obj" IPO="-ipo -ipo_obj"
CFLAGS="$CFLAGS $IPO" CFLAGS="$CFLAGS $IPO"
CORE_LINK="$CORE_LINK $IPO" CORE_LINK="$CORE_LINK $IPO"
CORE_LINK="$CORE_LINK -opt_report_file=$OBJS/opt_report_file" CORE_LINK="$CORE_LINK -opt_report_file=$NGX_OBJS/opt_report_file"
case $CPU in case $CPU in
pentium) pentium)

View File

@ -77,15 +77,15 @@ CORE_LINK="$CORE_LINK -debug -debugtype:coff"
# precompiled headers # precompiled headers
if [ $NGX_CC_NAME != msvc7 ]; then if [ $NGX_CC_NAME != msvc7 ]; then
CORE_DEPS="$CORE_DEPS $OBJS/ngx_config.pch" CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch"
NGX_PCH="$OBJS/ngx_config.pch" NGX_PCH="$NGX_OBJS/ngx_config.pch"
NGX_BUILD_PCH="-Ycngx_config.h -Fp$OBJS/ngx_config.pch" NGX_BUILD_PCH="-Ycngx_config.h -Fp$NGX_OBJS/ngx_config.pch"
NGX_USE_PCH="-Yungx_config.h -Fp$OBJS/ngx_config.pch" NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch"
fi fi
# the resource file # the resource file
NGX_RES="$OBJS/nginx.res" NGX_RES="$NGX_OBJS/nginx.res"
NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC" NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC"
CORE_LINK="$NGX_RES $CORE_LINK" CORE_LINK="$NGX_RES $CORE_LINK"

View File

@ -63,10 +63,10 @@ CFLAGS="$CFLAGS -zq"
# the precompiled headers # the precompiled headers
CORE_DEPS="$CORE_DEPS $OBJS/ngx_config.pch" CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch"
NGX_PCH="$OBJS/ngx_config.pch" NGX_PCH="$NGX_OBJS/ngx_config.pch"
NGX_BUILD_PCH="-fhq=$OBJS/ngx_config.pch" NGX_BUILD_PCH="-fhq=$NGX_OBJS/ngx_config.pch"
NGX_USE_PCH="-fh=$OBJS/ngx_config.pch" NGX_USE_PCH="-fh=$NGX_OBJS/ngx_config.pch"
LINK="\$(CC)" LINK="\$(CC)"
@ -76,7 +76,8 @@ CORE_LINK="$CORE_LINK -l=nt_win"
# the resource file # the resource file
NGX_RCC="wrc \$(CORE_INCS) -fo=$OBJS/nginx.res $NGX_WIN32_RC $OBJS/nginx.exe" NGX_RCC="wrc \$(CORE_INCS) -fo=$NGX_OBJS/nginx.res "
NGX_RCC="$NGX_RCC $NGX_WIN32_RC $NGX_OBJS/nginx.exe"
ngx_include_opt="-i=" ngx_include_opt="-i="

24
auto/configure vendored
View File

@ -7,26 +7,26 @@
. auto/init . auto/init
. auto/sources . auto/sources
test -d $OBJS || mkdir $OBJS test -d $NGX_OBJS || mkdir $NGX_OBJS
echo > $NGX_AUTO_HEADERS_H echo > $NGX_AUTO_HEADERS_H
echo > $NGX_AUTO_CONFIG_H echo > $NGX_AUTO_CONFIG_H
echo > $NGX_AUTOCONF_ERR echo > $NGX_AUTOCONF_ERR
if [ $DEBUG = YES ]; then if [ $NGX_DEBUG = YES ]; then
have=NGX_DEBUG . auto/have have=NGX_DEBUG . auto/have
fi fi
if [ "$PLATFORM" != win32 ]; then if [ "$NGX_PLATFORM" != win32 ]; then
. auto/headers . auto/headers
fi fi
. auto/cc/conf . auto/cc/conf
. auto/os/conf . auto/os/conf
if [ "$PLATFORM" != win32 ]; then if [ "$NGX_PLATFORM" != win32 ]; then
. auto/threads . auto/threads
fi fi
@ -37,21 +37,21 @@ fi
. auto/lib/make . auto/lib/make
. auto/install . auto/install
if [ "$PLATFORM" != win32 ]; then if [ "$NGX_PLATFORM" != win32 ]; then
. auto/unix . auto/unix
fi fi
# STUB # STUB
. auto/stubs . auto/stubs
have=NGX_PREFIX value="\"$PREFIX/\"" . auto/define have=NGX_PREFIX value="\"$NGX_PREFIX/\"" . auto/define
have=NGX_SBIN_PATH value="\"$SBIN_PATH\"" . auto/define have=NGX_SBIN_PATH value="\"$NGX_SBIN_PATH\"" . auto/define
have=NGX_CONF_PATH value="\"$CONF_PATH\"" . auto/define have=NGX_CONF_PATH value="\"$NGX_CONF_PATH\"" . auto/define
have=NGX_PID_PATH value="\"$PID_PATH\"" . auto/define have=NGX_PID_PATH value="\"$NGX_PID_PATH\"" . auto/define
if [ ".$ERROR_LOG_PATH" != "." ]; then if test -n "$NGX_ERROR_LOG_PATH"; then
have=NGX_ERROR_LOG_PATH value="\"$ERROR_LOG_PATH\"" . auto/define have=NGX_ERROR_LOG_PATH value="\"$NGX_ERROR_LOG_PATH\"" . auto/define
fi fi
have=NGX_HTTP_LOG_PATH value="\"$HTTP_LOG_PATH\"" . auto/define have=NGX_HTTP_LOG_PATH value="\"$NGX_HTTP_LOG_PATH\"" . auto/define
have=NGX_USER value="\"$NGX_USER\"" . auto/define have=NGX_USER value="\"$NGX_USER\"" . auto/define
have=NGX_GROUP value="\"$NGX_GROUP\"" . auto/define have=NGX_GROUP value="\"$NGX_GROUP\"" . auto/define

View File

@ -25,7 +25,7 @@ eval "${CC} -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then if [ -x $NGX_AUTOTEST ]; then
if $NGX_AUTOTEST 2>&1 > /dev/null; then if $NGX_AUTOTEST 2>&1 > /dev/null; then
echo " little endianess" echo " little endianess"
have=HAVE_LITTLE_ENDIAN . auto/have have=NGX_HAVE_LITTLE_ENDIAN . auto/have
else else
echo " big endianess" echo " big endianess"
fi fi

View File

@ -14,9 +14,7 @@ END
ngx_found=no ngx_found=no
if test -n "$ngx_feature_name"; then if test -n "$ngx_feature_name"; then
ngx_have_feature=`echo NGX_$ngx_feature_name | tr '[a-z]' '[A-Z]'` ngx_have_feature=`echo $ngx_feature_name | tr '[a-z]' '[A-Z]'`
# STUB
ngx_have_feature0=`echo HAVE_$ngx_feature_name | tr '[a-z]' '[A-Z]'`
fi fi
cat << END > $NGX_AUTOTEST.c cat << END > $NGX_AUTOTEST.c
@ -51,11 +49,6 @@ if [ -x $NGX_AUTOTEST ]; then
have=$ngx_have_feature . auto/have have=$ngx_have_feature . auto/have
fi fi
#STUB
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature0 . auto/have
fi
else else
echo " found but is not working" echo " found but is not working"
fi fi
@ -68,11 +61,6 @@ if [ -x $NGX_AUTOTEST ]; then
have=$ngx_have_feature . auto/have have=$ngx_have_feature . auto/have
fi fi
#STUB
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature0 . auto/have
fi
fi fi
else else

View File

@ -1,43 +0,0 @@
# Copyright (C) Igor Sysoev
echo $ngx_n "checking for $ngx_func ..." $ngx_c
echo >> $NGX_ERR
echo "checking for $ngx_func" >> $NGX_ERR
ngx_found=no
func=`echo $ngx_func | sed -e 's/()$//' | tr '[a-z]' '[A-Z]'`
cat << END > $NGX_AUTOTEST.c
#include <sys/types.h>
$NGX_UNISTD_H
$ngx_func_inc
int main() {
$ngx_func_test;
return 0;
}
END
test="$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_func_libs"
eval "$test >> $NGX_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
echo " found"
have=HAVE_$func . auto/have
ngx_found=yes
else
echo " not found"
echo "---------" >> $NGX_ERR
cat $NGX_AUTOTEST.c >> $NGX_ERR
echo "---------" >> $NGX_ERR
echo $test >> $NGX_ERR
echo "---------" >> $NGX_ERR
fi
rm $NGX_AUTOTEST*

View File

@ -12,9 +12,8 @@ NGX_AUTOTEST=$NGX_OBJS/autotest
NGX_AUTOCONF_ERR=$NGX_OBJS/autoconf.err NGX_AUTOCONF_ERR=$NGX_OBJS/autoconf.err
# STUBs # STUBs
OBJS=$NGX_OBJS NGX_ERR=$NGX_OBJS/autoconf.err
NGX_ERR=$OBJS/autoconf.err MAKEFILE=$NGX_OBJS/Makefile
MAKEFILE=$OBJS/Makefile
NGX_PCH= NGX_PCH=
@ -54,9 +53,9 @@ clean:
rm -rf Makefile $NGX_OBJS rm -rf Makefile $NGX_OBJS
upgrade: upgrade:
$SBIN_PATH -t $NGX_SBIN_PATH -t
kill -USR2 \`cat $PID_PATH\` kill -USR2 \`cat $NGX_PID_PATH\`
sleep 1 sleep 1
test -f $PID_PATH.newbin test -f $NGX_PID_PATH.newbin
kill -WINCH \`cat $PID_PATH\` kill -WINCH \`cat $NGX_PID_PATH\`
END END

View File

@ -2,40 +2,40 @@
# Copyright (C) Igor Sysoev # Copyright (C) Igor Sysoev
cat << END >> $MAKEFILE cat << END >> $NGX_MAKEFILE
install: install:
test -d $PREFIX || mkdir -p $PREFIX test -d $NGX_PREFIX || mkdir -p $NGX_PREFIX
test -d `dirname $SBIN_PATH` || mkdir -p `dirname $SBIN_PATH` test -d `dirname $NGX_SBIN_PATH` || mkdir -p `dirname $NGX_SBIN_PATH`
test ! -f $SBIN_PATH || mv $SBIN_PATH $SBIN_PATH.old test ! -f $NGX_SBIN_PATH || mv $NGX_SBIN_PATH $NGX_SBIN_PATH.old
cp $OBJS/nginx $SBIN_PATH cp $NGX_OBJS/nginx $NGX_SBIN_PATH
test -d `dirname $CONF_PATH` || mkdir -p `dirname $CONF_PATH` test -d `dirname $NGX_CONF_PATH` || mkdir -p `dirname $NGX_CONF_PATH`
cp conf/koi-win `dirname $CONF_PATH` cp conf/koi-win `dirname $NGX_CONF_PATH`
test -f `dirname $CONF_PATH`/mime.types || \ test -f `dirname $NGX_CONF_PATH`/mime.types || \
cp conf/mime.types `dirname $CONF_PATH`/mime.types cp conf/mime.types `dirname $NGX_CONF_PATH`/mime.types
cp conf/mime.types `dirname $CONF_PATH`/mime.types.default cp conf/mime.types `dirname $NGX_CONF_PATH`/mime.types.default
test -f $CONF_PATH || cp conf/nginx.conf $CONF_PATH test -f $NGX_CONF_PATH || cp conf/nginx.conf $NGX_CONF_PATH
cp conf/nginx.conf `dirname $CONF_PATH`/nginx.conf.default cp conf/nginx.conf `dirname $NGX_CONF_PATH`/nginx.conf.default
test -d `dirname $PID_PATH` || mkdir -p `dirname $PID_PATH` test -d `dirname $NGX_PID_PATH` || mkdir -p `dirname $NGX_PID_PATH`
test -d `dirname $HTTP_LOG_PATH` || mkdir -p `dirname $HTTP_LOG_PATH` test -d `dirname $NGX_HTTP_LOG_PATH` || \
mkdir -p `dirname $NGX_HTTP_LOG_PATH`
test -d $PREFIX/html || cp -r html $PREFIX test -d $NGX_PREFIX/html || cp -r html $NGX_PREFIX
#test -d $PREFIX/temp || mkdir -p $PREFIX/temp
END END
if [ ".$ERROR_LOG_PATH" != "." ]; then if test -n "$NGX_ERROR_LOG_PATH"; then
cat << END >> $MAKEFILE cat << END >> $NGX_MAKEFILE
test -d `dirname $ERROR_LOG_PATH` || mkdir -p `dirname $ERROR_LOG_PATH` test -d `dirname $NGX_ERROR_LOG_PATH` || \
mkdir -p `dirname $NGX_ERROR_LOG_PATH`
END END
fi fi

View File

@ -7,7 +7,7 @@ if [ $MD5 != NONE ]; then
if grep MD5_Init $MD5/md5.h >/dev/null; then if grep MD5_Init $MD5/md5.h >/dev/null; then
# OpenSSL md5 # OpenSSL md5
OPENSSL_MD5=YES OPENSSL_MD5=YES
have=HAVE_OPENSSL_MD5 . auto/have have=NGX_HAVE_OPENSSL_MD5 . auto/have
else else
# rsaref md5 # rsaref md5
OPENSSL_MD5=NO OPENSSL_MD5=NO
@ -43,13 +43,13 @@ if [ $MD5 != NONE ]; then
else else
if [ $PLATFORM != win32 ]; then if [ $NGX_PLATFORM != win32 ]; then
MD5=NO MD5=NO
# Solaris 8/9 # Solaris 8/9
ngx_feature="rsaref md5 library" ngx_feature="rsaref md5 library"
ngx_feature_name="rsaref_md5" ngx_feature_name=
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <md5.h>" ngx_feature_incs="#include <md5.h>"
ngx_feature_libs="-lmd5" ngx_feature_libs="-lmd5"
@ -66,7 +66,7 @@ else
# FreeBSD # FreeBSD
ngx_feature="rsaref md library" ngx_feature="rsaref md library"
ngx_feature_name="rsaref_md5" ngx_feature_name=
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <md5.h>" ngx_feature_incs="#include <md5.h>"
ngx_feature_libs="-lmd" ngx_feature_libs="-lmd"
@ -87,7 +87,7 @@ else
# OpenSSL crypto library # OpenSSL crypto library
ngx_feature="OpenSSL md5 crypto library" ngx_feature="OpenSSL md5 crypto library"
ngx_feature_name="OpenSSL_md5" ngx_feature_name="NGX_OPENSSL_MD5"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <openssl/md5.h>" ngx_feature_incs="#include <openssl/md5.h>"
ngx_feature_libs="-lcrypto" ngx_feature_libs="-lcrypto"
@ -98,7 +98,7 @@ else
if [ $ngx_found = yes ]; then if [ $ngx_found = yes ]; then
have=HAVE_OPENSSL_MD5_H . auto/have have=NGX_HAVE_OPENSSL_MD5_H . auto/have
CORE_LIBS="$CORE_LIBS $ngx_feature_libs" CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
MD5=YES MD5=YES
MD5_LIB=crypto MD5_LIB=crypto

View File

@ -25,7 +25,7 @@ esac
done=NO done=NO
case $PLATFORM in case $NGX_PLATFORM in
win32) win32)
cp auto/lib/md5/$ngx_makefile $MD5 cp auto/lib/md5/$ngx_makefile $MD5

View File

@ -18,11 +18,11 @@ if [ $OPENSSL != NONE ]; then
else else
if [ $PLATFORM != win32 ]; then if [ $NGX_PLATFORM != win32 ]; then
OPENSSL=NO OPENSSL=NO
ngx_feature="OpenSSL library" ngx_feature="OpenSSL library"
ngx_feature_name="OpenSSL" ngx_feature_name="NGX_OPENSSL"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <openssl/ssl.h>" ngx_feature_incs="#include <openssl/ssl.h>"
ngx_feature_libs="-lssl -lcrypto" ngx_feature_libs="-lssl -lcrypto"
@ -30,7 +30,6 @@ else
. auto/feature . auto/feature
if [ $ngx_found = yes ]; then if [ $ngx_found = yes ]; then
have=NGX_OPENSSL . auto/have
CORE_DEPS="$CORE_DEPS $OPENSSL_DEPS" CORE_DEPS="$CORE_DEPS $OPENSSL_DEPS"
CORE_SRCS="$CORE_SRCS $OPENSSL_SRCS" CORE_SRCS="$CORE_SRCS $OPENSSL_SRCS"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs" CORE_LIBS="$CORE_LIBS $ngx_feature_libs"

View File

@ -2,7 +2,7 @@
# Copyright (C) Igor Sysoev # Copyright (C) Igor Sysoev
case $PLATFORM in case $NGX_PLATFORM in
*) *)
echo "$OPENSSL/libssl.a:" >> $MAKEFILE echo "$OPENSSL/libssl.a:" >> $MAKEFILE
echo " cd $OPENSSL \\" >> $MAKEFILE echo " cd $OPENSSL \\" >> $MAKEFILE

View File

@ -42,14 +42,14 @@ if [ $PCRE != NONE ]; then
else else
if [ $PLATFORM != win32 ]; then if [ $NGX_PLATFORM != win32 ]; then
PCRE=NO PCRE=NO
# FreeBSD PCRE port requires --with-cc-opt="-I /usr/local/include" # FreeBSD PCRE port requires --with-cc-opt="-I /usr/local/include"
# --with-ld-opt="-L /usr/local/lib" # --with-ld-opt="-L /usr/local/lib"
ngx_feature="PCRE library" ngx_feature="PCRE library"
ngx_feature_name="PCRE" ngx_feature_name="NGX_PCRE"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <pcre.h>" ngx_feature_incs="#include <pcre.h>"
ngx_feature_libs="-lpcre" ngx_feature_libs="-lpcre"

View File

@ -22,7 +22,7 @@ case "$NGX_CC_NAME" in
esac esac
case $PLATFORM in case $NGX_PLATFORM in
win32) win32)
cp auto/lib/pcre/patch.pcre.in $PCRE cp auto/lib/pcre/patch.pcre.in $PCRE

View File

@ -37,13 +37,13 @@ if [ $ZLIB != NONE ]; then
else else
if [ $PLATFORM != win32 ]; then if [ $NGX_PLATFORM != win32 ]; then
ZLIB=NO ZLIB=NO
# FreeBSD, Solaris, Linux # FreeBSD, Solaris, Linux
ngx_feature="zlib library" ngx_feature="zlib library"
ngx_feature_name="zlib" ngx_feature_name=
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <zlib.h>" ngx_feature_incs="#include <zlib.h>"
ngx_feature_libs="-lz" ngx_feature_libs="-lz"

View File

@ -26,7 +26,7 @@ esac
done=NO done=NO
case $PLATFORM in case $NGX_PLATFORM in
win32) win32)
cp auto/lib/zlib/$ngx_makefile $ZLIB cp auto/lib/zlib/$ngx_makefile $ZLIB

View File

@ -2,10 +2,11 @@
# Copyright (C) Igor Sysoev # Copyright (C) Igor Sysoev
mkdir -p $OBJS/src/core $OBJS/src/event $OBJS/src/event/modules \ mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \
$OBJS/src/os/unix $OBJS/src/os/win32 \ $NGX_OBJS/src/os/unix $NGX_OBJS/src/os/win32 \
$OBJS/src/http $OBJS/src/http/modules $OBJS/src/http/modules/proxy \ $NGX_OBJS/src/http $NGX_OBJS/src/http/modules \
$OBJS/src/imap $NGX_OBJS/src/http/modules/proxy \
$NGX_OBJS/src/imap
ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
@ -33,7 +34,7 @@ fi
# ALL_INCS, required by OpenWatcom C precompiled headers # ALL_INCS, required by OpenWatcom C precompiled headers
ngx_incs=`echo $CORE_INCS $OBJS $HTTP_INCS $IMAP_INCS\ ngx_incs=`echo $CORE_INCS $NGX_OBJS $HTTP_INCS $IMAP_INCS\
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
-e "s/\//$ngx_regex_dirsep/g"` -e "s/\//$ngx_regex_dirsep/g"`
@ -53,7 +54,7 @@ ngx_deps=`echo $CORE_DEPS $NGX_AUTO_CONFIG_H $NGX_PCH \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
-e "s/\//$ngx_regex_dirsep/g"` -e "s/\//$ngx_regex_dirsep/g"`
ngx_incs=`echo $CORE_INCS $OBJS \ ngx_incs=`echo $CORE_INCS $NGX_OBJS \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
-e "s/\//$ngx_regex_dirsep/g"` -e "s/\//$ngx_regex_dirsep/g"`
@ -287,13 +288,13 @@ fi
# the precompiled headers # the precompiled headers
if test -n "$NGX_PCH"; then if test -n "$NGX_PCH"; then
echo "#include <ngx_config.h>" > $OBJS/ngx_pch.c echo "#include <ngx_config.h>" > $NGX_OBJS/ngx_pch.c
ngx_pch="src/core/ngx_config.h $OS_CONFIG $OBJS/ngx_auto_config.h" ngx_pch="src/core/ngx_config.h $OS_CONFIG $NGX_OBJS/ngx_auto_config.h"
ngx_pch=`echo "$NGX_PCH: $ngx_pch" | sed -e "s/\//$ngx_regex_dirsep/g"` ngx_pch=`echo "$NGX_PCH: $ngx_pch" | sed -e "s/\//$ngx_regex_dirsep/g"`
ngx_src="\$(CC) \$(CFLAGS) $NGX_BUILD_PCH $ngx_compile_opt \$(ALL_INCS)" ngx_src="\$(CC) \$(CFLAGS) $NGX_BUILD_PCH $ngx_compile_opt \$(ALL_INCS)"
ngx_src="$ngx_src $ngx_objout$OBJS/ngx_pch.obj $OBJS/ngx_pch.c" ngx_src="$ngx_src $ngx_objout$NGX_OBJS/ngx_pch.obj $NGX_OBJS/ngx_pch.c"
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"` ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
cat << END >> $NGX_MAKEFILE cat << END >> $NGX_MAKEFILE

View File

@ -7,7 +7,7 @@ if [ $EVENT_SELECT = NO -a $EVENT_FOUND = NO ]; then
fi fi
if [ $EVENT_SELECT = YES ]; then if [ $EVENT_SELECT = YES ]; then
have=HAVE_SELECT . auto/have have=NGX_HAVE_SELECT . auto/have
CORE_SRCS="$CORE_SRCS $SELECT_SRCS" CORE_SRCS="$CORE_SRCS $SELECT_SRCS"
EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE" EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE"
fi fi
@ -18,29 +18,29 @@ if [ $EVENT_POLL = NO -a $EVENT_FOUND = NO ]; then
fi fi
if [ $EVENT_POLL = YES ]; then if [ $EVENT_POLL = YES ]; then
have=HAVE_POLL . auto/have have=NGX_HAVE_POLL . auto/have
CORE_SRCS="$CORE_SRCS $POLL_SRCS" CORE_SRCS="$CORE_SRCS $POLL_SRCS"
EVENT_MODULES="$EVENT_MODULES $POLL_MODULE" EVENT_MODULES="$EVENT_MODULES $POLL_MODULE"
fi fi
if [ $TEST_BUILD_DEVPOLL = YES ]; then if [ $NGX_TEST_BUILD_DEVPOLL = YES ]; then
have=HAVE_DEVPOLL . auto/have have=NGX_HAVE_DEVPOLL . auto/have
have=TEST_BUILD_DEVPOLL . auto/have have=NGX_TEST_BUILD_DEVPOLL . auto/have
EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE" EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS" CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS"
fi fi
if [ $TEST_BUILD_EPOLL = YES ]; then if [ $NGX_TEST_BUILD_EPOLL = YES ]; then
have=HAVE_EPOLL . auto/have have=NGX_HAVE_EPOLL . auto/have
have=TEST_BUILD_EPOLL . auto/have have=NGX_TEST_BUILD_EPOLL . auto/have
EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE" EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE"
CORE_SRCS="$CORE_SRCS $EPOLL_SRCS" CORE_SRCS="$CORE_SRCS $EPOLL_SRCS"
fi fi
if [ $TEST_BUILD_RTSIG = YES ]; then if [ $NGX_TEST_BUILD_RTSIG = YES ]; then
have=HAVE_RTSIG . auto/have have=NGX_HAVE_RTSIG . auto/have
have=TEST_BUILD_RTSIG . auto/have have=NGX_TEST_BUILD_RTSIG . auto/have
EVENT_MODULES="$EVENT_MODULES $RTSIG_MODULE" EVENT_MODULES="$EVENT_MODULES $RTSIG_MODULE"
CORE_SRCS="$CORE_SRCS $RTSIG_SRCS" CORE_SRCS="$CORE_SRCS $RTSIG_SRCS"
fi fi
@ -135,8 +135,11 @@ if [ $HTTP_PROXY = YES ]; then
HTTP_SRCS="$HTTP_SRCS $HTTP_PROXY_SRCS" HTTP_SRCS="$HTTP_SRCS $HTTP_PROXY_SRCS"
fi fi
if [ -r $OBJS/auto ]; then # STUB
. $OBJS/auto #HTTP_SRCS="$HTTP_SRCS $HTPP_FILE_CACHE_SRCS"
if [ -r $NGX_OBJS/auto ]; then
. $NGX_OBJS/auto
fi fi
modules="$CORE_MODULES $EVENT_MODULES" modules="$CORE_MODULES $EVENT_MODULES"

View File

@ -4,29 +4,29 @@
help=no help=no
PREFIX= NGX_PREFIX=
SBIN_PATH= NGX_SBIN_PATH=
CONF_PATH= NGX_CONF_PATH=
ERROR_LOG_PATH= NGX_ERROR_LOG_PATH=
PID_PATH= NGX_PID_PATH=
NGX_USER= NGX_USER=
NGX_GROUP= NGX_GROUP=
HTTP_LOG_PATH= NGX_HTTP_LOG_PATH=
CC=${CC:-gcc} CC=${CC:-gcc}
CPP= CPP=
NGX_OBJS=objs NGX_OBJS=objs
DEBUG=NO NGX_DEBUG=NO
NGX_CC_OPT= NGX_CC_OPT=
NGX_LD_OPT= NGX_LD_OPT=
CPU=NO CPU=NO
TEST_BUILD_DEVPOLL=NO NGX_TEST_BUILD_DEVPOLL=NO
TEST_BUILD_EPOLL=NO NGX_TEST_BUILD_EPOLL=NO
TEST_BUILD_RTSIG=NO NGX_TEST_BUILD_RTSIG=NO
PLATFORM= NGX_PLATFORM=
NGX_WINE= NGX_WINE=
EVENT_FOUND=NO EVENT_FOUND=NO
@ -52,7 +52,7 @@ HTTP_PROXY=YES
IMAP=NO IMAP=NO
MODULES= NGX_MODULES=
USE_PCRE=NO USE_PCRE=NO
PCRE=NONE PCRE=NONE
@ -82,15 +82,15 @@ do
case "$option" in case "$option" in
--help) help=yes ;; --help) help=yes ;;
--prefix=*) PREFIX="$value" ;; --prefix=*) NGX_PREFIX="$value" ;;
--sbin-path=*) SBIN_PATH="$value" ;; --sbin-path=*) NGX_SBIN_PATH="$value" ;;
--conf-path=*) CONF_PATH="$value" ;; --conf-path=*) NGX_CONF_PATH="$value" ;;
--error-log-path=*) ERROR_LOG_PATH="$value" ;; --error-log-path=*) NGX_ERROR_LOG_PATH="$value";;
--pid-path=*) PID_PATH="$value" ;; --pid-path=*) NGX_PID_PATH="$value" ;;
--user=*) NGX_USER="$value" ;; --user=*) NGX_USER="$value" ;;
--group=*) NGX_GROUP="$value" ;; --group=*) NGX_GROUP="$value" ;;
--crossbuild=*) PLATFORM="$value" ;; --crossbuild=*) NGX_PLATFORM="$value" ;;
--builddir=*) NGX_OBJS="$value" ;; --builddir=*) NGX_OBJS="$value" ;;
@ -105,7 +105,7 @@ do
--with-threads) USE_THREADS="pthreads" ;; --with-threads) USE_THREADS="pthreads" ;;
--without-http) HTTP=NO ;; --without-http) HTTP=NO ;;
--http-log-path=*) HTTP_LOG_PATH="$value" ;; --http-log-path=*) NGX_HTTP_LOG_PATH="$value" ;;
--with-http_ssl_module) HTTP_SSL=YES ;; --with-http_ssl_module) HTTP_SSL=YES ;;
--without-http_charset_module) HTTP_CHARSET=NO ;; --without-http_charset_module) HTTP_CHARSET=NO ;;
@ -127,7 +127,7 @@ do
--with-cc-opt=*) NGX_CC_OPT="$value" ;; --with-cc-opt=*) NGX_CC_OPT="$value" ;;
--with-ld-opt=*) NGX_LD_OPT="$value" ;; --with-ld-opt=*) NGX_LD_OPT="$value" ;;
--with-cpu-opt=*) CPU="$value" ;; --with-cpu-opt=*) CPU="$value" ;;
--with-debug) DEBUG=YES ;; --with-debug) NGX_DEBUG=YES ;;
--without-pcre) USE_PCRE=DISABLED ;; --without-pcre) USE_PCRE=DISABLED ;;
--with-pcre=*) PCRE="$value" ;; --with-pcre=*) PCRE="$value" ;;
@ -143,9 +143,9 @@ do
--with-zlib-opt=*) ZLIB_OPT="$value" ;; --with-zlib-opt=*) ZLIB_OPT="$value" ;;
--with-zlib-asm=*) ZLIB_ASM="$value" ;; --with-zlib-asm=*) ZLIB_ASM="$value" ;;
--test-build-devpoll) TEST_BUILD_DEVPOLL=YES ;; --test-build-devpoll) NGX_TEST_BUILD_DEVPOLL=YES ;;
--test-build-epoll) TEST_BUILD_EPOLL=YES ;; --test-build-epoll) NGX_TEST_BUILD_EPOLL=YES ;;
--test-build-rtsig) TEST_BUILD_RTSIG=YES ;; --test-build-rtsig) NGX_TEST_BUILD_RTSIG=YES ;;
*) *)
echo "$0: error: invalid option \"$option\"" echo "$0: error: invalid option \"$option\""
@ -202,13 +202,13 @@ if [ $HTTP = NO ]; then
fi fi
if [ ".$PLATFORM" = ".win32" ]; then if [ ".$NGX_PLATFORM" = ".win32" ]; then
NGX_WINE=$WINE NGX_WINE=$WINE
fi fi
if test -z "$PREFIX"; then if test -z "$NGX_PREFIX"; then
PREFIX=/usr/local/nginx NGX_PREFIX=/usr/local/nginx
fi fi
@ -217,75 +217,75 @@ if test -z "$NGX_GROUP"; then
fi fi
case ".$SBIN_PATH" in case ".$NGX_SBIN_PATH" in
./*) ./*)
;; ;;
.) .)
SBIN_PATH=$PREFIX/sbin/nginx NGX_SBIN_PATH=$NGX_PREFIX/sbin/nginx
;; ;;
*) *)
SBIN_PATH=$PREFIX/$SBIN_PATH NGX_SBIN_PATH=$NGX_PREFIX/$NGX_SBIN_PATH
;; ;;
esac esac
case ".$CONF_PATH" in case ".$NGX_CONF_PATH" in
./*) ./*)
;; ;;
.) .)
CONF_PATH=$PREFIX/conf/nginx.conf NGX_CONF_PATH=$NGX_PREFIX/conf/nginx.conf
;; ;;
*) *)
CONF_PATH=$PREFIX/$CONF_PATH NGX_CONF_PATH=$NGX_PREFIX/$NGX_CONF_PATH
;; ;;
esac esac
case ".$PID_PATH" in case ".$NGX_PID_PATH" in
./*) ./*)
;; ;;
.) .)
PID_PATH=$PREFIX/logs/nginx.pid NGX_PID_PATH=$NGX_PREFIX/logs/nginx.pid
;; ;;
*) *)
PID_PATH=$PREFIX/$PID_PATH NGX_PID_PATH=$NGX_PREFIX/$NGX_PID_PATH
;; ;;
esac esac
case ".$ERROR_LOG_PATH" in case ".$NGX_ERROR_LOG_PATH" in
./*) ./*)
;; ;;
.) .)
ERROR_LOG_PATH=$PREFIX/logs/error.log NGX_ERROR_LOG_PATH=$NGX_PREFIX/logs/error.log
;; ;;
.stderr) .stderr)
ERROR_LOG_PATH= NGX_ERROR_LOG_PATH=
;; ;;
*) *)
ERROR_LOG_PATH=$PREFIX/$ERROR_LOG_PATH NGX_ERROR_LOG_PATH=$NGX_PREFIX/$NGX_ERROR_LOG_PATH
;; ;;
esac esac
case ".$HTTP_LOG_PATH" in case ".$NGX_HTTP_LOG_PATH" in
./*) ./*)
;; ;;
.) .)
HTTP_LOG_PATH=$PREFIX/logs/access.log NGX_HTTP_LOG_PATH=$NGX_PREFIX/logs/access.log
;; ;;
*) *)
HTTP_LOG_PATH=$PREFIX/$HTTP_LOG_PATH NGX_HTTP_LOG_PATH=$NGX_PREFIX/$NGX_HTTP_LOG_PATH
;; ;;
esac esac

View File

@ -2,7 +2,7 @@
# Copyright (C) Igor Sysoev # Copyright (C) Igor Sysoev
if [ ".$PLATFORM" = "." ]; then if test -z "$NGX_PLATFORM"; then
echo "checking for OS" echo "checking for OS"
SYSTEM=`uname -s 2>/dev/null` SYSTEM=`uname -s 2>/dev/null`
@ -11,12 +11,12 @@ if [ ".$PLATFORM" = "." ]; then
echo " + $SYSTEM $RELEASE $MACHINE" echo " + $SYSTEM $RELEASE $MACHINE"
PLATFORM="$SYSTEM:$RELEASE:$MACHINE"; NGX_PLATFORM="$SYSTEM:$RELEASE:$MACHINE";
else else
echo "building for $PLATFORM" echo "building for $NGX_PLATFORM"
fi fi
case $PLATFORM in case $NGX_PLATFORM in
FreeBSD:* | DragonFly:*) FreeBSD:* | DragonFly:*)
. auto/os/freebsd . auto/os/freebsd
@ -43,7 +43,7 @@ case $PLATFORM in
esac esac
if [ $PLATFORM != win32 ]; then if [ $NGX_PLATFORM != win32 ]; then
if test -z "$NGX_USER"; then if test -z "$NGX_USER"; then
NGX_USER=nobody NGX_USER=nobody
@ -52,7 +52,7 @@ if [ $PLATFORM != win32 ]; then
ngx_feature="/dev/poll" ngx_feature="/dev/poll"
ngx_feature_name="devpoll" ngx_feature_name="NGX_HAVE_DEVPOLL"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sys/devpoll.h>" ngx_feature_incs="#include <sys/devpoll.h>"
ngx_feature_libs= ngx_feature_libs=
@ -65,7 +65,6 @@ if [ $PLATFORM != win32 ]; then
. auto/feature . auto/feature
if [ $ngx_found = yes ]; then if [ $ngx_found = yes ]; then
have=HAVE_DEVPOLL . auto/have
CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS" CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS"
EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE" EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
EVENT_FOUND=YES EVENT_FOUND=YES
@ -74,7 +73,7 @@ if [ $PLATFORM != win32 ]; then
if test -z "$NGX_KQUEUE_CHECKED"; then if test -z "$NGX_KQUEUE_CHECKED"; then
ngx_feature="kqueue" ngx_feature="kqueue"
ngx_feature_name="kqueue" ngx_feature_name="NGX_HAVE_KQUEUE"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sys/event.h>" ngx_feature_incs="#include <sys/event.h>"
ngx_feature_libs= ngx_feature_libs=
@ -83,14 +82,13 @@ if [ $PLATFORM != win32 ]; then
if [ $ngx_found = yes ]; then if [ $ngx_found = yes ]; then
have=HAVE_KQUEUE . auto/have have=NGX_HAVE_CLEAR_EVENT . auto/have
have=HAVE_CLEAR_EVENT . auto/have
EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE" EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS" CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
EVENT_FOUND=YES EVENT_FOUND=YES
ngx_feature="kqueue's NOTE_LOWAT" ngx_feature="kqueue's NOTE_LOWAT"
ngx_feature_name="HAVE_LOWAT_EVENT" ngx_feature_name="NGX_HAVE_LOWAT_EVENT"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sys/event.h>" ngx_feature_incs="#include <sys/event.h>"
ngx_feature_libs= ngx_feature_libs=

View File

@ -45,7 +45,7 @@ fi
if [ $osreldate -gt 300007 ]; then if [ $osreldate -gt 300007 ]; then
echo " + using sendfile()" echo " + using sendfile()"
have=HAVE_SENDFILE . auto/have have=NGX_HAVE_SENDFILE . auto/have
CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS" CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS"
fi fi
@ -57,8 +57,8 @@ if [ \( $osreldate -lt 500000 -a $osreldate -ge 410000 \) \
then then
echo " + using kqueue" echo " + using kqueue"
have=HAVE_KQUEUE . auto/have have=NGX_HAVE_KQUEUE . auto/have
have=HAVE_CLEAR_EVENT . auto/have have=NGX_HAVE_CLEAR_EVENT . auto/have
EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE" EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS" CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
EVENT_FOUND=YES EVENT_FOUND=YES
@ -73,7 +73,7 @@ if [ \( $version -lt 500000 -a $version -ge 430000 \) \
-o $version -ge 500018 ] -o $version -ge 500018 ]
then then
echo " + using kqueue's NOTE_LOWAT" echo " + using kqueue's NOTE_LOWAT"
have=HAVE_LOWAT_EVENT . auto/have have=NGX_HAVE_LOWAT_EVENT . auto/have
fi fi
@ -85,7 +85,7 @@ if [ $USE_THREADS = "rfork" ]; then
# #
# if [ $version -gt 460101 ]; then # if [ $version -gt 460101 ]; then
# echo " + kqueue's EVFILT_SIGNAL is safe" # echo " + kqueue's EVFILT_SIGNAL is safe"
# have=HAVE_SAFE_EVFILT_SIGNAL . auto/have # have=NGX_HAVE_SAFE_EVFILT_SIGNAL . auto/have
# else # else
# echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this" # echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this"
# echo "FreeBSD version, so --with-threads=rfork could not be used" # echo "FreeBSD version, so --with-threads=rfork could not be used"
@ -100,7 +100,7 @@ if [ $EVENT_AIO = YES ]; then
if [ \( $version -lt 500000 -a $version -ge 430000 \) \ if [ \( $version -lt 500000 -a $version -ge 430000 \) \
-o $version -ge 500014 ] -o $version -ge 500014 ]
then then
have=HAVE_AIO . auto/have have=NGX_HAVE_AIO . auto/have
EVENT_MODULES="$EVENT_MODULES $AIO_MODULE" EVENT_MODULES="$EVENT_MODULES $AIO_MODULE"
CORE_SRCS="$CORE_SRCS $AIO_SRCS" CORE_SRCS="$CORE_SRCS $AIO_SRCS"
else else

View File

@ -37,7 +37,8 @@ version=`grep "#define LINUX_VERSION_CODE" /usr/include/linux/version.h \
if [ $version -ge 131609 -o $EVENT_RTSIG = YES ]; then if [ $version -ge 131609 -o $EVENT_RTSIG = YES ]; then
echo " + using rt signals" echo " + using rt signals"
have=HAVE_RTSIG . auto/have have=NGX_HAVE_RTSIG . auto/have
have=NGX_HAVE_POLL . auto/have
EVENT_MODULES="$EVENT_MODULES $RTSIG_MODULE" EVENT_MODULES="$EVENT_MODULES $RTSIG_MODULE"
CORE_SRCS="$CORE_SRCS $RTSIG_SRCS" CORE_SRCS="$CORE_SRCS $RTSIG_SRCS"
EVENT_FOUND=YES EVENT_FOUND=YES
@ -47,7 +48,7 @@ fi
# epoll, EPOLLET version # epoll, EPOLLET version
ngx_feature="epoll" ngx_feature="epoll"
ngx_feature_name="epoll" ngx_feature_name="NGX_HAVE_EPOLL"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sys/epoll.h>" ngx_feature_incs="#include <sys/epoll.h>"
ngx_feature_libs= ngx_feature_libs=
@ -60,8 +61,7 @@ ngx_feature_test="int efd = 0, fd = 1, n;
. auto/feature . auto/feature
if [ $ngx_found = yes ]; then if [ $ngx_found = yes ]; then
have=HAVE_EPOLL . auto/have have=NGX_HAVE_CLEAR_EVENT . auto/have
have=HAVE_CLEAR_EVENT . auto/have
CORE_SRCS="$CORE_SRCS $EPOLL_SRCS" CORE_SRCS="$CORE_SRCS $EPOLL_SRCS"
EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE" EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE"
EVENT_FOUND=YES EVENT_FOUND=YES
@ -72,7 +72,7 @@ fi
CC_AUX_FLAGS="-D_GNU_SOURCE" CC_AUX_FLAGS="-D_GNU_SOURCE"
ngx_feature="sendfile()" ngx_feature="sendfile()"
ngx_feature_name="sendfile" ngx_feature_name="NGX_HAVE_SENDFILE"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sys/sendfile.h>" ngx_feature_incs="#include <sys/sendfile.h>"
ngx_feature_libs= ngx_feature_libs=
@ -90,7 +90,7 @@ fi
CC_AUX_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" CC_AUX_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
ngx_feature="sendfile64()" ngx_feature="sendfile64()"
ngx_feature_name="HAVE_SENDFILE64" ngx_feature_name="NGX_HAVE_SENDFILE64"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sys/sendfile.h>" ngx_feature_incs="#include <sys/sendfile.h>"
ngx_feature_libs= ngx_feature_libs=
@ -105,7 +105,7 @@ ngx_include="sys/prctl.h"; . auto/include
# prctl(PR_SET_DUMPABLE) # prctl(PR_SET_DUMPABLE)
ngx_feature="prctl(PR_SET_DUMPABLE)" ngx_feature="prctl(PR_SET_DUMPABLE)"
ngx_feature_name="HAVE_PR_SET_DUMPABLE" ngx_feature_name="NGX_HAVE_PR_SET_DUMPABLE"
ngx_feature_run=yes ngx_feature_run=yes
ngx_feature_incs="#include <sys/prctl.h>" ngx_feature_incs="#include <sys/prctl.h>"
ngx_feature_libs= ngx_feature_libs=

View File

@ -23,7 +23,7 @@ ngx_spacer=
CC_AUX_FLAGS="-D_FILE_OFFSET_BITS=64 -lrt" CC_AUX_FLAGS="-D_FILE_OFFSET_BITS=64 -lrt"
case $PLATFORM in case $NGX_PLATFORM in
*:sun4u) *:sun4u)
# "-mcpu=v9" enables the "casa" assembler instruction # "-mcpu=v9" enables the "casa" assembler instruction
@ -43,7 +43,7 @@ fi
ngx_feature="sendfilev()" ngx_feature="sendfilev()"
ngx_feature_name="sendfile" ngx_feature_name="NGX_HAVE_SENDFILE"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sys/sendfile.h>" ngx_feature_incs="#include <sys/sendfile.h>"
ngx_feature_libs="-lsendfile" ngx_feature_libs="-lsendfile"
@ -54,7 +54,6 @@ ngx_feature_test="int fd = 1; sendfilevec_t vec[1];
if [ $ngx_found = yes ]; then if [ $ngx_found = yes ]; then
have=HAVE_SENDFILE . auto/have
CORE_SRCS="$CORE_SRCS $SOLARIS_SENDFILEV_SRCS" CORE_SRCS="$CORE_SRCS $SOLARIS_SENDFILEV_SRCS"
CORE_LIBS="$CORE_LIBS -lsendfile" CORE_LIBS="$CORE_LIBS -lsendfile"
fi fi

View File

@ -26,5 +26,5 @@ if [ $EVENT_SELECT = NO ]; then
EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE" EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE"
fi fi
have=HAVE_AIO . auto/have have=NGX_HAVE_AIO . auto/have
have=HAVE_IOCP . auto/have have=NGX_HAVE_IOCP . auto/have

View File

@ -95,14 +95,14 @@ END
fi fi
echo " nginx path prefix: $PREFIX" echo " nginx path prefix: $NGX_PREFIX"
echo " nginx binary file: $SBIN_PATH" echo " nginx binary file: $NGX_SBIN_PATH"
echo " nginx configuration file: $CONF_PATH" echo " nginx configuration file: $NGX_CONF_PATH"
echo " nginx pid file: $PID_PATH" echo " nginx pid file: $NGX_PID_PATH"
if [ ".$ERROR_LOG_PATH" != "." ]; then if test -n "$NGX_ERROR_LOG_PATH"; then
echo " nginx error log file: $ERROR_LOG_PATH" echo " nginx error log file: $NGX_ERROR_LOG_PATH"
else else
echo " nginx logs errors to stderr" echo " nginx logs errors to stderr"
fi fi
echo " nginx http access log file: $HTTP_LOG_PATH" echo " nginx http access log file: $NGX_HTTP_LOG_PATH"
echo echo

View File

@ -9,7 +9,7 @@ case $USE_THREADS in
CORE_DEPS="$CORE_DEPS $FREEBSD_RFORK_DEPS" CORE_DEPS="$CORE_DEPS $FREEBSD_RFORK_DEPS"
CORE_SRCS="$CORE_SRCS $FREEBSD_RFORK_SRCS" CORE_SRCS="$CORE_SRCS $FREEBSD_RFORK_SRCS"
case $PLATFORM in case $NGX_PLATFORM in
*:i386) *:i386)
if [ \( $version -gt 500000 -a $version -lt 501000 \) \ if [ \( $version -gt 500000 -a $version -lt 501000 \) \
-o $version -lt 491000 ] -o $version -lt 491000 ]
@ -42,7 +42,7 @@ case $USE_THREADS in
;; ;;
libc_r) libc_r)
case $PLATFORM in case $NGX_PLATFORM in
FreeBSD:[34]*) FreeBSD:[34]*)
have=NGX_THREADS . auto/have have=NGX_THREADS . auto/have
CFLAGS="$CFLAGS -pthread" CFLAGS="$CFLAGS -pthread"

View File

@ -74,7 +74,7 @@ ngx_param=TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
ngx_feature="setproctitle()" ngx_feature="setproctitle()"
ngx_feature_name="HAVE_SETPROCTITLE" ngx_feature_name="NGX_HAVE_SETPROCTITLE"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs= ngx_feature_incs=
ngx_feature_libs= ngx_feature_libs=
@ -83,7 +83,7 @@ ngx_feature_test="setproctitle(\"test\");"
ngx_feature="pread()" ngx_feature="pread()"
ngx_feature_name="pread" ngx_feature_name="NGX_HAVE_PREAD"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs= ngx_feature_incs=
ngx_feature_libs= ngx_feature_libs=
@ -92,7 +92,7 @@ ngx_feature_test="char buf[1]; ssize_t n; n = pread(0, buf, 1, 0)"
ngx_feature="pwrite()" ngx_feature="pwrite()"
ngx_feature_name="pwrite" ngx_feature_name="NGX_HAVE_PWRITE"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs= ngx_feature_incs=
ngx_feature_libs= ngx_feature_libs=
@ -101,7 +101,7 @@ ngx_feature_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0)"
ngx_feature="strerror_r()" ngx_feature="strerror_r()"
ngx_feature_name="strerror_r" ngx_feature_name="NGX_HAVE_STRERROR_R"
ngx_feature_run=yes ngx_feature_run=yes
ngx_feature_incs="#include <string.h>" ngx_feature_incs="#include <string.h>"
ngx_feature_libs= ngx_feature_libs=
@ -113,7 +113,7 @@ ngx_feature_test="char buf[32]; int n; n = strerror_r(1, buf, 32);
# GNU style strerror_r() returns not length, but pointer # GNU style strerror_r() returns not length, but pointer
ngx_feature="gnu style strerror_r()" ngx_feature="gnu style strerror_r()"
ngx_feature_name="gnu_strerror_r" ngx_feature_name="NGX_HAVE_GNU_STRERROR_R"
ngx_feature_run=yes ngx_feature_run=yes
ngx_feature_incs="#include <string.h>" ngx_feature_incs="#include <string.h>"
ngx_feature_libs= ngx_feature_libs=
@ -123,7 +123,7 @@ ngx_feature_test="char buf[32]; int n; n = strerror_r(1, buf, 32);
ngx_feature="localtime_r()" ngx_feature="localtime_r()"
ngx_feature_name="localtime_r" ngx_feature_name="NGX_HAVE_LOCALTIME_R"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <time.h>" ngx_feature_incs="#include <time.h>"
ngx_feature_libs= ngx_feature_libs=
@ -132,7 +132,7 @@ ngx_feature_test="struct tm t; time_t c=0; localtime_r(&c, &t)"
ngx_feature="posix_memalign()" ngx_feature="posix_memalign()"
ngx_feature_name="posix_memalign" ngx_feature_name="NGX_HAVE_POSIX_MEMALIGN"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <stdlib.h>" ngx_feature_incs="#include <stdlib.h>"
ngx_feature_libs= ngx_feature_libs=
@ -141,7 +141,7 @@ ngx_feature_test="void *p; int n; n = posix_memalign(&p, 4096, 4096)"
ngx_feature="memalign()" ngx_feature="memalign()"
ngx_feature_name="memalign" ngx_feature_name="NGX_HAVE_MEMALIGN"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <stdlib.h>" ngx_feature_incs="#include <stdlib.h>"
ngx_feature_libs= ngx_feature_libs=
@ -150,7 +150,7 @@ ngx_feature_test="void *p; p = memalign(4096, 4096)"
ngx_feature="sched_yield()" ngx_feature="sched_yield()"
ngx_feature_name="HAVE_SCHED_YIELD" ngx_feature_name="NGX_HAVE_SCHED_YIELD"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sched.h>" ngx_feature_incs="#include <sched.h>"
ngx_feature_libs= ngx_feature_libs=
@ -159,7 +159,7 @@ ngx_feature_test="sched_yield()"
ngx_feature="mmap(MAP_ANON|MAP_SHARED)" ngx_feature="mmap(MAP_ANON|MAP_SHARED)"
ngx_feature_name="MAP_ANON" ngx_feature_name="NGX_HAVE_MAP_ANON"
ngx_feature_run=yes ngx_feature_run=yes
ngx_feature_incs="#include <sys/mman.h>" ngx_feature_incs="#include <sys/mman.h>"
ngx_feature_libs= ngx_feature_libs=
@ -171,7 +171,7 @@ ngx_feature_test="void *p;
ngx_feature='mmap("/dev/zero", MAP_SHARED)' ngx_feature='mmap("/dev/zero", MAP_SHARED)'
ngx_feature_name="MAP_DEVZERO" ngx_feature_name="NGX_HAVE_MAP_DEVZERO"
ngx_feature_run=yes ngx_feature_run=yes
ngx_feature_incs="#include <sys/mman.h> ngx_feature_incs="#include <sys/mman.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -185,7 +185,7 @@ ngx_feature_test='void *p; int fd;
ngx_feature="System V shared memory" ngx_feature="System V shared memory"
ngx_feature_name="SYSVSHM" ngx_feature_name="NGX_HAVE_SYSVSHM"
ngx_feature_run=yes ngx_feature_run=yes
ngx_feature_incs="#include <sys/ipc.h> ngx_feature_incs="#include <sys/ipc.h>
#include <sys/shm.h>" #include <sys/shm.h>"
@ -198,7 +198,7 @@ ngx_feature_test="int id;
ngx_feature="struct msghdr.msg_control" ngx_feature="struct msghdr.msg_control"
ngx_feature_name="msghdr_msg_control" ngx_feature_name="NGX_HAVE_MSGHDR_MSG_CONTROL"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>" ngx_feature_incs="#include <sys/socket.h>"
ngx_feature_libs= ngx_feature_libs=
@ -207,7 +207,7 @@ ngx_feature_test="struct msghdr msg; msg.msg_control = NULL"
ngx_feature="ioctl(FIONBIO)" ngx_feature="ioctl(FIONBIO)"
ngx_feature_name="FIONBIO" ngx_feature_name="NGX_HAVE_FIONBIO"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <sys/ioctl.h> ngx_feature_incs="#include <sys/ioctl.h>
$NGX_INCLUDE_SYS_FILIO_H" $NGX_INCLUDE_SYS_FILIO_H"
@ -217,7 +217,7 @@ ngx_feature_test="int i; i = FIONBIO"
ngx_feature="struct tm.tm_gmtoff" ngx_feature="struct tm.tm_gmtoff"
ngx_feature_name="gmtoff" ngx_feature_name="NGX_HAVE_GMTOFF"
ngx_feature_run=no ngx_feature_run=no
ngx_feature_incs="#include <time.h>" ngx_feature_incs="#include <time.h>"
ngx_feature_libs= ngx_feature_libs=

View File

@ -6,6 +6,54 @@
title="nginx"> title="nginx">
<changes ver="0.1.9" date="25.11.2004">
<change type="bugfix">
<para lang="ru">
ÅÓÌÉ × ÚÁÐÒÏÓÅ ÅÓÔØ "//", "/./", "/../" ÉÌÉ "%XX", ÔÏ ÐÒÏËÓÉÒÕÅÍÙÊ
ÚÁÐÒÏÓ ÐÅÒÅÄÁ×ÁÌÓÑ ÂÅÚ ÁÒÇÕÍÅÎÔÏ×.
</para>
<para lang="en">
the proxied request was sent without arguments if the request contains
"//", "/./", "/../" or "%XX".
</para>
</change>
<change type="bugfix">
<para lang="ru">
ÐÒÉ ÓÖÁÔÉÉ ÂÏÌØÛÉÈ ÏÔ×ÅÔÏ× ÉÎÏÇÄÁ ÏÎÉ ÐÅÒÅÄÁ×ÁÌÉÓØ ÎÅ ÐÏÌÎÏÓÔØÀ.
</para>
<para lang="en">
the large compressed responses may be transferred not completely.
</para>
</change>
<change type="bugfix">
<para lang="ru">
ÎÅ ÐÅÒÅÄÁ×ÁÌÉÓØ ÆÁÊÌÙ ÂÏÌØÛÅ 2G ÎÁ Linux, ÎÅÐÏÄÄÅÒÖÉ×ÁÀÝÅÍ sendfile64().
</para>
<para lang="en">
the files bigger than 2G was not transferred on Linux that does not support
sendfile64().
</para>
</change>
<change type="bugfix">
<para lang="ru">
ÎÁ Linux ÐÒÉ ËÏÎÆÉÇÕÒÁÃÉÉ ÓÂÏÒËÉ ÎÕÖÎÏ ÂÙÌÏ ÏÂÑÚÁÔÅÌØÎÏ ÉÓÐÏÌØÚÏ×ÁÔØ
ÐÁÒÁÍÅÔÒ --with-poll_module;
ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.1.8.
</para>
<para lang="en">
while the build configuration on Linux the --with-poll_module parameter
was required;
bug appeared in 0.1.8.
</para>
</change>
</changes>
<changes ver="0.1.8" date="20.11.2004"> <changes ver="0.1.8" date="20.11.2004">
<change type="bugfix"> <change type="bugfix">

View File

@ -112,7 +112,7 @@ ngx_uint_t ngx_max_module;
int main(int argc, char *const *argv, char *const *envp) int main(int argc, char *const *argv)
{ {
ngx_int_t i; ngx_int_t i;
ngx_log_t *log; ngx_log_t *log;

View File

@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_ #define _NGINX_H_INCLUDED_
#define NGINX_VER "nginx/0.1.8" #define NGINX_VER "nginx/0.1.9"
#define NGINX_VAR "NGINX" #define NGINX_VAR "NGINX"
#define NGX_NEWPID_EXT ".newbin" #define NGX_NEWPID_EXT ".newbin"

View File

@ -140,7 +140,7 @@ void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy,
break; break;
} }
#if (HAVE_WRITE_ZEROCOPY) #if (NGX_HAVE_WRITE_ZEROCOPY)
if ((*busy)->buf->zerocopy_busy) { if ((*busy)->buf->zerocopy_busy) {
break; break;
} }

View File

@ -11,6 +11,13 @@
#include <ngx_auto_headers.h> #include <ngx_auto_headers.h>
#if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8))
#define NGX_MAX_UINT32_VALUE 0xffffffffLL
#else
#define NGX_MAX_UINT32_VALUE 0xffffffff
#endif
#if defined __DragonFly__ && !defined __FreeBSD__ #if defined __DragonFly__ && !defined __FreeBSD__
#define __FreeBSD__ 4 #define __FreeBSD__ 4
#define __FreeBSD_version 480101 #define __FreeBSD_version 480101
@ -127,12 +134,5 @@ typedef long ngx_flag_t;
#define NGX_MAXHOSTNAMELEN MAXHOSTNAMELEN #define NGX_MAXHOSTNAMELEN MAXHOSTNAMELEN
*/ */
#if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8))
#define NGX_MAX_UINT32_VALUE 0xffffffffLL
#else
#define NGX_MAX_UINT32_VALUE 0xffffffff
#endif
#endif /* _NGX_CONFIG_H_INCLUDED_ */ #endif /* _NGX_CONFIG_H_INCLUDED_ */

View File

@ -48,7 +48,7 @@ typedef struct {
unsigned nonblocking_accept:1; unsigned nonblocking_accept:1;
unsigned nonblocking:1; unsigned nonblocking:1;
unsigned shared:1; /* shared between threads or processes */ unsigned shared:1; /* shared between threads or processes */
#if (HAVE_DEFERRED_ACCEPT) #if (NGX_HAVE_DEFERRED_ACCEPT)
unsigned deferred_accept:1; unsigned deferred_accept:1;
#endif #endif
@ -101,7 +101,7 @@ struct ngx_connection_s {
ngx_ssl_t *ssl; ngx_ssl_t *ssl;
#endif #endif
#if (HAVE_IOCP) #if (NGX_HAVE_IOCP)
struct sockaddr *local_sockaddr; struct sockaddr *local_sockaddr;
socklen_t local_socklen; socklen_t local_socklen;
#endif #endif
@ -122,7 +122,7 @@ struct ngx_connection_s {
unsigned tcp_nodelay:1; unsigned tcp_nodelay:1;
signed tcp_nopush:2; signed tcp_nopush:2;
#if (HAVE_IOCP) #if (NGX_HAVE_IOCP)
unsigned accept_context_updated:1; unsigned accept_context_updated:1;
#endif #endif

View File

@ -9,11 +9,18 @@
#include <ngx_event.h> #include <ngx_event.h>
#define NGX_NONE 1 #if 0
#define NGX_SENDFILE_LIMIT 4096
#endif
#define NGX_NONE 1
static ngx_inline ngx_int_t static ngx_inline ngx_int_t
ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf); ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf);
static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool,
ngx_chain_t **chain, ngx_chain_t *in);
static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src, static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src,
ngx_uint_t sendfile); ngx_uint_t sendfile);
@ -26,17 +33,20 @@ ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
if (ctx->in == NULL && ctx->busy == NULL) { if (ctx->in == NULL && ctx->busy == NULL) {
/* /*
* the short path for the case when the ctx->in and ctx->busy chains * the short path for the case when the ctx->in and ctx->busy chains
* are empty, the incoming chain is empty too or has the single buf * are empty, the incoming chain is empty too or has the single buf
* that does not require the copy * that does not require the copy
*/ */
if (in == NULL) { if (in == NULL) {
return ctx->output_filter(ctx->filter_ctx, in); return ctx->output_filter(ctx->filter_ctx, in);
} }
if (in->next == NULL if (in->next == NULL
#if (NGX_SENDFILE_LIMIT)
&& !(in->buf->in_file && in->buf->file_last > NGX_SENDFILE_LIMIT)
#endif
&& (!ngx_output_chain_need_to_copy(ctx, in->buf))) && (!ngx_output_chain_need_to_copy(ctx, in->buf)))
{ {
return ctx->output_filter(ctx->filter_ctx, in); return ctx->output_filter(ctx->filter_ctx, in);
@ -46,7 +56,7 @@ ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
/* add the incoming buf to the chain ctx->in */ /* add the incoming buf to the chain ctx->in */
if (in) { if (in) {
if (ngx_chain_add_copy(ctx->pool, &ctx->in, in) == NGX_ERROR) { if (ngx_output_chain_add_copy(ctx->pool, &ctx->in, in) == NGX_ERROR) {
return NGX_ERROR; return NGX_ERROR;
} }
} }
@ -191,11 +201,23 @@ ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
static ngx_inline ngx_int_t static ngx_inline ngx_int_t
ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf) ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
{ {
ngx_uint_t sendfile;
if (ngx_buf_special(buf)) { if (ngx_buf_special(buf)) {
return 0; return 0;
} }
if (!ctx->sendfile) { sendfile = ctx->sendfile;
#if (NGX_SENDFILE_LIMIT)
if (buf->in_file && buf->file_pos >= NGX_SENDFILE_LIMIT) {
sendfile = 0;
}
#endif
if (!sendfile) {
if (!ngx_buf_in_memory(buf)) { if (!ngx_buf_in_memory(buf)) {
return 1; return 1;
@ -216,6 +238,71 @@ static ngx_inline ngx_int_t
} }
static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool,
ngx_chain_t **chain, ngx_chain_t *in)
{
ngx_chain_t *cl, **ll;
#if (NGX_SENDFILE_LIMIT)
ngx_buf_t *b, *buf;
#endif
ll = chain;
for (cl = *chain; cl; cl = cl->next) {
ll = &cl->next;
}
while (in) {
if (!(cl = ngx_alloc_chain_link(pool))) {
return NGX_ERROR;
}
#if (NGX_SENDFILE_LIMIT)
buf = in->buf;
if (buf->in_file
&& buf->file_pos < NGX_SENDFILE_LIMIT
&& buf->file_last > NGX_SENDFILE_LIMIT)
{
if (!(b = ngx_calloc_buf(pool))) {
return NGX_ERROR;
}
ngx_memcpy(b, buf, sizeof(ngx_buf_t));
if (ngx_buf_in_memory(buf)) {
buf->pos += (ssize_t) (NGX_SENDFILE_LIMIT - buf->file_pos);
b->last = buf->pos;
}
buf->file_pos = NGX_SENDFILE_LIMIT;
b->file_last = NGX_SENDFILE_LIMIT;
cl->buf = b;
} else {
cl->buf = buf;
in = in->next;
}
#else
cl->buf = in->buf;
in = in->next;
#endif
*ll = cl;
ll = &cl->next;
}
*ll = NULL;
return NGX_OK;
}
static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src, static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src,
ngx_uint_t sendfile) ngx_uint_t sendfile)
{ {
@ -228,6 +315,14 @@ static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src,
size = dst->end - dst->pos; size = dst->end - dst->pos;
} }
#if (NGX_SENDFILE_LIMIT)
if (src->in_file && src->file_pos >= NGX_SENDFILE_LIMIT) {
sendfile = 0;
}
#endif
if (ngx_buf_in_memory(src)) { if (ngx_buf_in_memory(src)) {
ngx_memcpy(dst->pos, src->pos, size); ngx_memcpy(dst->pos, src->pos, size);
src->pos += size; src->pos += size;

View File

@ -162,12 +162,12 @@ void ngx_time_update(time_t s)
ngx_cached_http_time.data = p; ngx_cached_http_time.data = p;
#if (HAVE_GETTIMEZONE) #if (NGX_HAVE_GETTIMEZONE)
ngx_gmtoff = ngx_gettimezone(); ngx_gmtoff = ngx_gettimezone();
ngx_gmtime(s + ngx_gmtoff * 60, &tm); ngx_gmtime(s + ngx_gmtoff * 60, &tm);
#elif (HAVE_GMTOFF) #elif (NGX_HAVE_GMTOFF)
ngx_localtime(&tm); ngx_localtime(&tm);
ngx_gmtoff = tm.ngx_tm_gmtoff / 60; ngx_gmtoff = tm.ngx_tm_gmtoff / 60;

View File

@ -9,7 +9,7 @@
#include <ngx_event.h> #include <ngx_event.h>
#include <ngx_aio.h> #include <ngx_aio.h>
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
#include <ngx_kqueue_module.h> #include <ngx_kqueue_module.h>
#endif #endif
@ -27,7 +27,7 @@ ngx_os_io_t ngx_os_aio = {
ngx_aio_read_chain, ngx_aio_read_chain,
ngx_aio_write, ngx_aio_write,
ngx_aio_write_chain, ngx_aio_write_chain,
NGX_HAVE_ZEROCOPY 0
}; };
@ -64,7 +64,7 @@ ngx_module_t ngx_aio_module = {
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
static int ngx_aio_init(ngx_cycle_t *cycle) static int ngx_aio_init(ngx_cycle_t *cycle)
{ {
@ -152,7 +152,7 @@ static int ngx_aio_process_events(ngx_cycle_t *cycle)
return ngx_kqueue_module_ctx.actions.process_events(cycle); return ngx_kqueue_module_ctx.actions.process_events(cycle);
} }
#endif /* HAVE_KQUEUE */ #endif /* NGX_HAVE_KQUEUE */
#if 0 #if 0

View File

@ -9,7 +9,7 @@
#include <ngx_event.h> #include <ngx_event.h>
#if (TEST_BUILD_DEVPOLL) #if (NGX_TEST_BUILD_DEVPOLL)
/* Solaris declarations */ /* Solaris declarations */

View File

@ -9,7 +9,7 @@
#include <ngx_event.h> #include <ngx_event.h>
#if (TEST_BUILD_EPOLL) #if (NGX_TEST_BUILD_EPOLL)
/* epoll declarations */ /* epoll declarations */
@ -168,7 +168,7 @@ static int ngx_epoll_init(ngx_cycle_t *cycle)
ngx_event_actions = ngx_epoll_module_ctx.actions; ngx_event_actions = ngx_epoll_module_ctx.actions;
#if (HAVE_CLEAR_EVENT) #if (NGX_HAVE_CLEAR_EVENT)
ngx_event_flags = NGX_USE_CLEAR_EVENT ngx_event_flags = NGX_USE_CLEAR_EVENT
#else #else
ngx_event_flags = NGX_USE_LEVEL_EVENT ngx_event_flags = NGX_USE_LEVEL_EVENT

View File

@ -189,7 +189,7 @@ static ngx_int_t ngx_kqueue_init(ngx_cycle_t *cycle)
ngx_event_actions = ngx_kqueue_module_ctx.actions; ngx_event_actions = ngx_kqueue_module_ctx.actions;
ngx_event_flags = NGX_USE_ONESHOT_EVENT ngx_event_flags = NGX_USE_ONESHOT_EVENT
#if (HAVE_CLEAR_EVENT) #if (NGX_HAVE_CLEAR_EVENT)
|NGX_USE_CLEAR_EVENT |NGX_USE_CLEAR_EVENT
#else #else
|NGX_USE_LEVEL_EVENT |NGX_USE_LEVEL_EVENT

View File

@ -9,7 +9,7 @@
#include <ngx_event.h> #include <ngx_event.h>
#if (TEST_BUILD_RTSIG) #if (NGX_TEST_BUILD_RTSIG)
#define F_SETSIG 10 #define F_SETSIG 10
#define SIGRTMIN 33 #define SIGRTMIN 33
@ -217,7 +217,7 @@ static ngx_int_t ngx_rtsig_add_connection(ngx_connection_t *c)
return NGX_ERROR; return NGX_ERROR;
} }
#if (HAVE_ONESIGFD) #if (NGX_HAVE_ONESIGFD)
if (fcntl(c->fd, F_SETAUXFL, O_ONESIGFD) == -1) { if (fcntl(c->fd, F_SETAUXFL, O_ONESIGFD) == -1) {
ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno,
"fcntl(F_SETAUXFL) failed"); "fcntl(F_SETAUXFL) failed");

View File

@ -258,7 +258,7 @@ static ngx_int_t ngx_select_process_events(ngx_cycle_t *cycle)
ngx_connection_t *c; ngx_connection_t *c;
ngx_epoch_msec_t delta; ngx_epoch_msec_t delta;
struct timeval tv, *tp; struct timeval tv, *tp;
#if (HAVE_SELECT_CHANGE_TIMEOUT) #if (NGX_HAVE_SELECT_CHANGE_TIMEOUT)
static ngx_epoch_msec_t deltas = 0; static ngx_epoch_msec_t deltas = 0;
#endif #endif
@ -362,7 +362,7 @@ static ngx_int_t ngx_select_process_events(ngx_cycle_t *cycle)
err = 0; err = 0;
} }
#if (HAVE_SELECT_CHANGE_TIMEOUT) #if (NGX_HAVE_SELECT_CHANGE_TIMEOUT)
if (timer != NGX_TIMER_INFINITE) { if (timer != NGX_TIMER_INFINITE) {
delta = timer - (tv.tv_sec * 1000 + tv.tv_usec / 1000); delta = timer - (tv.tv_sec * 1000 + tv.tv_usec / 1000);
@ -403,7 +403,7 @@ static ngx_int_t ngx_select_process_events(ngx_cycle_t *cycle)
} }
} }
#else /* !(HAVE_SELECT_CHANGE_TIMEOUT) */ #else /* !(NGX_HAVE_SELECT_CHANGE_TIMEOUT) */
ngx_gettimeofday(&tv); ngx_gettimeofday(&tv);
ngx_time_update(tv.tv_sec); ngx_time_update(tv.tv_sec);
@ -427,7 +427,7 @@ static ngx_int_t ngx_select_process_events(ngx_cycle_t *cycle)
} }
} }
#endif /* HAVE_SELECT_CHANGE_TIMEOUT */ #endif /* NGX_HAVE_SELECT_CHANGE_TIMEOUT */
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"select ready %d", ready); "select ready %d", ready);

View File

@ -371,7 +371,7 @@ static ngx_int_t ngx_event_process_init(ngx_cycle_t *cycle)
rev->accept = 1; rev->accept = 1;
#if (HAVE_DEFERRED_ACCEPT) #if (NGX_HAVE_DEFERRED_ACCEPT)
rev->deferred_accept = s[i].deferred_accept; rev->deferred_accept = s[i].deferred_accept;
#endif #endif
@ -719,7 +719,7 @@ static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
rtsig = 0; rtsig = 0;
fd = 0; fd = 0;
#if (HAVE_EPOLL) && !(TEST_BUILD_EPOLL) #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL)
fd = epoll_create(100); fd = epoll_create(100);
@ -735,7 +735,7 @@ static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
#endif #endif
#if (HAVE_RTSIG) #if (NGX_HAVE_RTSIG)
if (module == NULL) { if (module == NULL) {
connections = DEFAULT_CONNECTIONS; connections = DEFAULT_CONNECTIONS;
@ -745,21 +745,21 @@ static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
#endif #endif
#if (HAVE_DEVPOLL) #if (NGX_HAVE_DEVPOLL)
connections = DEFAULT_CONNECTIONS; connections = DEFAULT_CONNECTIONS;
module = &ngx_devpoll_module; module = &ngx_devpoll_module;
#endif #endif
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
connections = DEFAULT_CONNECTIONS; connections = DEFAULT_CONNECTIONS;
module = &ngx_kqueue_module; module = &ngx_kqueue_module;
#endif #endif
#if (HAVE_SELECT) #if (NGX_HAVE_SELECT)
if (module == NULL) { if (module == NULL) {

View File

@ -15,7 +15,7 @@
#define NGX_INVALID_INDEX 0xd0d0d0d0 #define NGX_INVALID_INDEX 0xd0d0d0d0
#if (HAVE_IOCP) #if (NGX_HAVE_IOCP)
typedef struct { typedef struct {
WSAOVERLAPPED ovlp; WSAOVERLAPPED ovlp;
@ -86,7 +86,7 @@ struct ngx_event_s {
unsigned accept_context_updated:1; unsigned accept_context_updated:1;
#endif #endif
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
unsigned kq_vnode:1; unsigned kq_vnode:1;
/* the pending errno reported by kqueue */ /* the pending errno reported by kqueue */
@ -107,7 +107,7 @@ struct ngx_event_s {
* accept: 1 if accept many, 0 otherwise * accept: 1 if accept many, 0 otherwise
*/ */
#if (HAVE_KQUEUE) || (HAVE_IOCP) #if (NGX_HAVE_KQUEUE) || (NGX_HAVE_IOCP)
int available; int available;
#else #else
unsigned available:1; unsigned available:1;
@ -117,9 +117,9 @@ struct ngx_event_s {
ngx_event_handler_pt event_handler; ngx_event_handler_pt event_handler;
#if (HAVE_AIO) #if (NGX_HAVE_AIO)
#if (HAVE_IOCP) #if (NGX_HAVE_IOCP)
ngx_event_ovlp_t ovlp; ngx_event_ovlp_t ovlp;
#else #else
struct aiocb aiocb; struct aiocb aiocb;
@ -154,12 +154,12 @@ struct ngx_event_s {
unsigned posted_timedout:1; unsigned posted_timedout:1;
unsigned posted_eof:1; unsigned posted_eof:1;
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
/* the pending errno reported by kqueue */ /* the pending errno reported by kqueue */
int posted_errno; int posted_errno;
#endif #endif
#if (HAVE_KQUEUE) || (HAVE_IOCP) #if (NGX_HAVE_KQUEUE) || (NGX_HAVE_IOCP)
int posted_available; int posted_available;
#else #else
unsigned posted_available:1; unsigned posted_available:1;
@ -272,7 +272,7 @@ extern ngx_event_actions_t ngx_event_actions;
/* /*
* Need to add socket or handle only once - i/o completion port. * Need to add socket or handle only once - i/o completion port.
* It also requires HAVE_AIO and NGX_USE_AIO_EVENT to be set. * It also requires NGX_HAVE_AIO and NGX_USE_AIO_EVENT to be set.
*/ */
#define NGX_USE_IOCP_EVENT 0x00000200 #define NGX_USE_IOCP_EVENT 0x00000200
@ -296,7 +296,7 @@ extern ngx_event_actions_t ngx_event_actions;
#define NGX_VNODE_EVENT 0 #define NGX_VNODE_EVENT 0
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
#define NGX_READ_EVENT EVFILT_READ #define NGX_READ_EVENT EVFILT_READ
#define NGX_WRITE_EVENT EVFILT_WRITE #define NGX_WRITE_EVENT EVFILT_WRITE
@ -325,7 +325,7 @@ extern ngx_event_actions_t ngx_event_actions;
#define NGX_DISABLE_EVENT EV_DISABLE #define NGX_DISABLE_EVENT EV_DISABLE
#elif (HAVE_DEVPOLL) #elif (NGX_HAVE_DEVPOLL)
#define NGX_READ_EVENT POLLIN #define NGX_READ_EVENT POLLIN
#define NGX_WRITE_EVENT POLLOUT #define NGX_WRITE_EVENT POLLOUT
@ -334,7 +334,7 @@ extern ngx_event_actions_t ngx_event_actions;
#define NGX_ONESHOT_EVENT 1 #define NGX_ONESHOT_EVENT 1
#elif (HAVE_EPOLL) #elif (NGX_HAVE_EPOLL)
#define NGX_READ_EVENT EPOLLIN #define NGX_READ_EVENT EPOLLIN
#define NGX_WRITE_EVENT EPOLLOUT #define NGX_WRITE_EVENT EPOLLOUT
@ -347,7 +347,7 @@ extern ngx_event_actions_t ngx_event_actions;
#endif #endif
#elif (HAVE_POLL) #elif (NGX_HAVE_POLL)
#define NGX_READ_EVENT POLLIN #define NGX_READ_EVENT POLLIN
#define NGX_WRITE_EVENT POLLOUT #define NGX_WRITE_EVENT POLLOUT
@ -364,10 +364,10 @@ extern ngx_event_actions_t ngx_event_actions;
#define NGX_LEVEL_EVENT 0 #define NGX_LEVEL_EVENT 0
#define NGX_ONESHOT_EVENT 1 #define NGX_ONESHOT_EVENT 1
#endif /* HAVE_KQUEUE */ #endif /* NGX_HAVE_KQUEUE */
#if (HAVE_IOCP) #if (NGX_HAVE_IOCP)
#define NGX_IOCP_ACCEPT 0 #define NGX_IOCP_ACCEPT 0
#define NGX_IOCP_IO 1 #define NGX_IOCP_IO 1
#define NGX_IOCP_CONNECT 2 #define NGX_IOCP_CONNECT 2

View File

@ -9,7 +9,7 @@
#include <ngx_event.h> #include <ngx_event.h>
static ngx_int_t ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size); static ssize_t ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size);
ngx_int_t ngx_ssl_init(ngx_log_t *log) ngx_int_t ngx_ssl_init(ngx_log_t *log)
@ -58,7 +58,7 @@ ngx_int_t ngx_ssl_create_session(ngx_ssl_ctx_t *ssl_ctx, ngx_connection_t *c,
} }
ngx_int_t ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size) ssize_t ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size)
{ {
int n, sslerr; int n, sslerr;
ngx_err_t err; ngx_err_t err;
@ -239,7 +239,7 @@ ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in,
} }
static ngx_int_t ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size) static ssize_t ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size)
{ {
int n, sslerr; int n, sslerr;
ngx_err_t err; ngx_err_t err;

View File

@ -41,7 +41,7 @@ ngx_int_t ngx_ssl_create_session(ngx_ssl_ctx_t *ctx, ngx_connection_t *c,
#define ngx_ssl_handshake(c) NGX_OK #define ngx_ssl_handshake(c) NGX_OK
ngx_int_t ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size); ssize_t ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size);
ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in, ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in,
off_t limit); off_t limit);
ngx_int_t ngx_ssl_shutdown(ngx_connection_t *c); ngx_int_t ngx_ssl_shutdown(ngx_connection_t *c);

View File

@ -132,7 +132,7 @@ ngx_int_t ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
p->upstream_eof = 1; p->upstream_eof = 1;
p->read = 1; p->read = 1;
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
if (p->upstream->read->kq_errno) { if (p->upstream->read->kq_errno) {
p->upstream->read->error = 1; p->upstream->read->error = 1;
p->upstream_error = 1; p->upstream_error = 1;

View File

@ -120,7 +120,7 @@ ngx_int_t ngx_event_thread_process_posted(ngx_cycle_t *cycle)
ev->ready |= ev->posted_ready; ev->ready |= ev->posted_ready;
ev->timedout |= ev->posted_timedout; ev->timedout |= ev->posted_timedout;
ev->pending_eof |= ev->posted_eof; ev->pending_eof |= ev->posted_eof;
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
ev->kq_errno |= ev->posted_errno; ev->kq_errno |= ev->posted_errno;
#endif #endif
if (ev->posted_available) { if (ev->posted_available) {
@ -130,7 +130,7 @@ ngx_int_t ngx_event_thread_process_posted(ngx_cycle_t *cycle)
ev->posted_ready = 0; ev->posted_ready = 0;
ev->posted_timedout = 0; ev->posted_timedout = 0;
ev->posted_eof = 0; ev->posted_eof = 0;
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
ev->posted_errno = 0; ev->posted_errno = 0;
#endif #endif
ev->posted_available = 0; ev->posted_available = 0;

View File

@ -237,14 +237,14 @@ static ngx_http_log_op_name_t ngx_http_gzip_log_fmt_ops[] = {
static u_char gzheader[10] = { 0x1f, 0x8b, Z_DEFLATED, 0, 0, 0, 0, 0, 0, 3 }; static u_char gzheader[10] = { 0x1f, 0x8b, Z_DEFLATED, 0, 0, 0, 0, 0, 0, 3 };
#if (HAVE_LITTLE_ENDIAN) #if (NGX_HAVE_LITTLE_ENDIAN)
struct gztrailer { struct gztrailer {
uint32_t crc32; uint32_t crc32;
uint32_t zlen; uint32_t zlen;
}; };
#else /* HAVE_BIG_ENDIAN */ #else /* NGX_HAVE_BIG_ENDIAN */
struct gztrailer { struct gztrailer {
u_char crc32[4]; u_char crc32[4];
@ -437,7 +437,8 @@ static ngx_int_t ngx_http_gzip_proxied(ngx_http_request_t *r,
static ngx_int_t ngx_http_gzip_body_filter(ngx_http_request_t *r, static ngx_int_t ngx_http_gzip_body_filter(ngx_http_request_t *r,
ngx_chain_t *in) ngx_chain_t *in)
{ {
int rc, wbits, memlevel, last; int rc, wbits, memlevel;
ngx_int_t last;
struct gztrailer *trailer; struct gztrailer *trailer;
ngx_buf_t *b; ngx_buf_t *b;
ngx_chain_t *cl; ngx_chain_t *cl;
@ -469,7 +470,7 @@ static ngx_int_t ngx_http_gzip_body_filter(ngx_http_request_t *r,
/* /*
* We preallocate a memory for zlib in one buffer (200K-400K), this * We preallocate a memory for zlib in one buffer (200K-400K), this
* dicreases a number of malloc() and free() calls and also probably * dicreases a number of malloc() and free() calls and also probably
* dicreases a number of syscalls (sbrk() or so). * dicreases a number of syscalls (sbrk() and so on).
* Besides we free this memory as soon as the gzipping will complete * Besides we free this memory as soon as the gzipping will complete
* and do not wait while a whole response will be sent to a client. * and do not wait while a whole response will be sent to a client.
* *
@ -512,8 +513,19 @@ static ngx_int_t ngx_http_gzip_body_filter(ngx_http_request_t *r,
} }
cl->buf = b; cl->buf = b;
cl->next = NULL; cl->next = NULL;
ctx->out = cl;
ctx->last_out = &cl->next; /*
* We pass the gzheader to the next filter now to avoid its linking
* to the ctx->busy chain. zlib does not usually output the compressed
* data in the initial iterations, so the gzheader that was linked
* to the ctx->busy chain would be flushed by ngx_http_write_filter().
*/
if (ngx_http_next_body_filter(r, cl) == NGX_ERROR) {
return ngx_http_gzip_error(ctx);
}
ctx->last_out = &ctx->out;
ctx->crc32 = crc32(0L, Z_NULL, 0); ctx->crc32 = crc32(0L, Z_NULL, 0);
ctx->flush = Z_NO_FLUSH; ctx->flush = Z_NO_FLUSH;
@ -727,7 +739,7 @@ static ngx_int_t ngx_http_gzip_body_filter(ngx_http_request_t *r,
b->last += 8; b->last += 8;
} }
#if (HAVE_LITTLE_ENDIAN) #if (NGX_HAVE_LITTLE_ENDIAN)
trailer->crc32 = ctx->crc32; trailer->crc32 = ctx->crc32;
trailer->zlen = ctx->zin; trailer->zlen = ctx->zin;
#else #else
@ -763,7 +775,7 @@ static ngx_int_t ngx_http_gzip_body_filter(ngx_http_request_t *r,
} }
} }
if (last == NGX_AGAIN) { if (last == NGX_AGAIN && !ctx->done) {
return NGX_AGAIN; return NGX_AGAIN;
} }
@ -881,7 +893,9 @@ static int ngx_http_gzip_error(ngx_http_gzip_ctx_t *ctx)
{ {
deflateEnd(&ctx->zstream); deflateEnd(&ctx->zstream);
ngx_pfree(ctx->request->pool, ctx->preallocated); if (ctx->preallocated) {
ngx_pfree(ctx->request->pool, ctx->preallocated);
}
ctx->zstream.avail_in = 0; ctx->zstream.avail_in = 0;
ctx->zstream.avail_out = 0; ctx->zstream.avail_out = 0;

View File

@ -10,19 +10,19 @@
typedef struct { typedef struct {
ngx_array_t indices; ngx_array_t indices;
size_t max_index_len; size_t max_index_len;
ngx_http_cache_hash_t *index_cache; ngx_http_cache_hash_t *index_cache;
} ngx_http_index_loc_conf_t; } ngx_http_index_loc_conf_t;
typedef struct { typedef struct {
ngx_uint_t index; ngx_uint_t index;
u_char *last; u_char *last;
ngx_str_t path; ngx_str_t path;
ngx_str_t redirect; ngx_str_t redirect;
ngx_http_cache_t *cache; ngx_http_cache_entry_t *cache;
unsigned tested:1; ngx_uint_t tested; /* unsigned tested:1 */
} ngx_http_index_ctx_t; } ngx_http_index_ctx_t;

View File

@ -297,7 +297,7 @@ void ngx_http_proxy_cache_busy_lock(ngx_http_proxy_ctx_t *p)
if (rc == NGX_AGAIN) { if (rc == NGX_AGAIN) {
if ((ngx_event_flags & (NGX_USE_CLEAR_EVENT|NGX_HAVE_KQUEUE_EVENT)) if ((ngx_event_flags & (NGX_USE_CLEAR_EVENT|NGX_USE_KQUEUE_EVENT))
&& !p->request->connection->write->active) && !p->request->connection->write->active)
{ {
/* /*

View File

@ -414,7 +414,7 @@ void ngx_http_proxy_check_broken_connection(ngx_event_t *ev)
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ev->log, 0, ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ev->log, 0,
"http proxy check client, write event:%d", ev->write); "http proxy check client, write event:%d", ev->write);
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
@ -563,9 +563,9 @@ void ngx_http_proxy_busy_lock_handler(ngx_event_t *rev)
*/ */
#if 0 #if 0
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
if ((ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) && rev->kq_eof) { if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && rev->kq_eof) {
ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock);
ngx_del_timer(rev); ngx_del_timer(rev);
@ -1400,7 +1400,7 @@ static char *ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data)
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
#elif !(HAVE_SO_SNDLOWAT) #elif !(NGX_HAVE_SO_SNDLOWAT)
ngx_conf_log_error(NGX_LOG_WARN, cf, 0, ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
"\"proxy_send_lowat\" is not supported, ignored"); "\"proxy_send_lowat\" is not supported, ignored");

View File

@ -142,7 +142,7 @@ typedef struct {
typedef struct { typedef struct {
ngx_http_cache_ctx_t ctx; ngx_http_cache_t ctx;
ngx_uint_t status; ngx_uint_t status;
ngx_str_t status_line; ngx_str_t status_line;

View File

@ -782,7 +782,7 @@ static void ngx_http_proxy_send_request(ngx_http_proxy_ctx_t *p)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http proxy send request"); "http proxy send request");
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT)
&& !p->request_sent && !p->request_sent
@ -1287,8 +1287,8 @@ static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p)
header->length = r->headers_out.content_length_n; header->length = r->headers_out.content_length_n;
p->cache->ctx.length = r->headers_out.content_length_n; p->cache->ctx.length = r->headers_out.content_length_n;
header->key_len = p->cache->ctx.key.len; header->key_len = p->cache->ctx.key0.len;
ngx_memcpy(&header->key, p->cache->ctx.key.data, header->key_len); ngx_memcpy(&header->key, p->cache->ctx.key0.data, header->key_len);
header->key[header->key_len] = LF; header->key[header->key_len] = LF;
} }

View File

@ -63,7 +63,7 @@ ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *hash,
c[i].refs++; c[i].refs++;
if ((!(c[i].notify && (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT))) if ((!(c[i].notify && (ngx_event_flags & NGX_USE_KQUEUE_EVENT)))
&& (ngx_cached_time - c[i].updated >= hash->update)) && (ngx_cached_time - c[i].updated >= hash->update))
{ {
c[i].expired = 1; c[i].expired = 1;

View File

@ -14,11 +14,12 @@
/* /*
* The 7 uses before an allocation. * The 3 bits allows the 7 uses before the cache entry allocation.
* We can use maximum 7 bits, i.e up to the 127 uses. * We can use maximum 7 bits, i.e up to the 127 uses.
*/ */
#define NGX_HTTP_CACHE_LAZY_ALLOCATION_BITS 3 #define NGX_HTTP_CACHE_LAZY_ALLOCATION_BITS 3
typedef struct { typedef struct {
uint32_t crc; uint32_t crc;
ngx_str_t key; ngx_str_t key;
@ -45,7 +46,7 @@ typedef struct {
off_t size; off_t size;
ngx_str_t value; ngx_str_t value;
} data; } data;
} ngx_http_cache_t; } ngx_http_cache_entry_t;
typedef struct { typedef struct {
@ -62,7 +63,7 @@ typedef struct {
#define NGX_HTTP_CACHE_NELTS 4 #define NGX_HTTP_CACHE_NELTS 4
typedef struct { typedef struct {
ngx_http_cache_t *elts; ngx_http_cache_entry_t *elts;
size_t hash; size_t hash;
size_t nelts; size_t nelts;
time_t life; time_t life;
@ -76,9 +77,9 @@ typedef struct {
typedef struct { typedef struct {
ngx_http_cache_hash_t *hash; ngx_http_cache_hash_t *hash;
ngx_http_cache_t *cache; ngx_http_cache_entry_t *cache;
ngx_file_t file; ngx_file_t file;
ngx_str_t key; ngx_array_t key;
uint32_t crc; uint32_t crc;
u_char md5[16]; u_char md5[16];
ngx_path_t *path; ngx_path_t *path;
@ -90,7 +91,10 @@ typedef struct {
ssize_t header_size; ssize_t header_size;
size_t file_start; size_t file_start;
ngx_log_t *log; ngx_log_t *log;
} ngx_http_cache_ctx_t;
/* STUB */
ngx_str_t key0;
} ngx_http_cache_t;
@ -99,6 +103,8 @@ typedef struct {
#define NGX_HTTP_CACHE_THE_SAME 3 #define NGX_HTTP_CACHE_THE_SAME 3
#if 0
ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *cache, ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *cache,
ngx_http_cleanup_t *cleanup, ngx_http_cleanup_t *cleanup,
ngx_str_t *key, uint32_t *crc); ngx_str_t *key, uint32_t *crc);
@ -127,5 +133,7 @@ int ngx_garbage_collector_http_cache_handler(ngx_gc_t *gc, ngx_str_t *name,
char *ngx_http_set_cache_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); char *ngx_http_set_cache_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
#endif
#endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */ #endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */

View File

@ -1828,7 +1828,7 @@ static char *ngx_http_lowat_check(ngx_conf_t *cf, void *post, void *data)
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
#elif !(HAVE_SO_SNDLOWAT) #elif !(NGX_HAVE_SO_SNDLOWAT)
ngx_conf_log_error(NGX_LOG_WARN, cf, 0, ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
"\"send_lowat\" is not supported, ignored"); "\"send_lowat\" is not supported, ignored");

View File

@ -9,19 +9,20 @@
#include <ngx_http.h> #include <ngx_http.h>
#if (HAVE_OPENSSL_MD5_H) #if (NGX_HAVE_OPENSSL_MD5_H)
#include <openssl/md5.h> #include <openssl/md5.h>
#else #else
#include <md5.h> #include <md5.h>
#endif #endif
#if (HAVE_OPENSSL_MD5) #if (NGX_OPENSSL_MD5)
#define MD5Init MD5_Init #define MD5Init MD5_Init
#define MD5Update MD5_Update #define MD5Update MD5_Update
#define MD5Final MD5_Final #define MD5Final MD5_Final
#endif #endif
#if 0
int ngx_http_cache_get_file(ngx_http_request_t *r, ngx_http_cache_ctx_t *ctx) int ngx_http_cache_get_file(ngx_http_request_t *r, ngx_http_cache_ctx_t *ctx)
{ {
@ -237,3 +238,5 @@ int ngx_garbage_collector_http_cache_handler(ngx_gc_t *gc, ngx_str_t *name,
return NGX_OK; return NGX_OK;
} }
#endif

View File

@ -686,7 +686,7 @@ ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r)
ch = *p++; ch = *p++;
while (p < r->uri_start + r->uri.len + 1 && r->args_start == NULL) { while (p < r->uri_end && r->args_start == NULL) {
/* /*
* we use "ch = *p++" inside the cycle but this operation is safe * we use "ch = *p++" inside the cycle but this operation is safe

View File

@ -532,6 +532,7 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
r->uri.len = r->uri_end - r->uri_start; r->uri.len = r->uri_end - r->uri_start;
} }
if (r->complex_uri || r->quoted_uri) { if (r->complex_uri || r->quoted_uri) {
if (!(r->uri.data = ngx_palloc(r->pool, r->uri.len + 1))) { if (!(r->uri.data = ngx_palloc(r->pool, r->uri.len + 1))) {
@ -557,6 +558,7 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
r->uri.data = r->uri_start; r->uri.data = r->uri_start;
} }
r->unparsed_uri.len = r->uri_end - r->uri_start; r->unparsed_uri.len = r->uri_end - r->uri_start;
r->unparsed_uri.data = r->uri_start; r->unparsed_uri.data = r->uri_start;
@ -1751,7 +1753,7 @@ static void ngx_http_keepalive_handler(ngx_event_t *rev)
ctx = (ngx_http_log_ctx_t *) rev->log->data; ctx = (ngx_http_log_ctx_t *) rev->log->data;
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
if (rev->pending_eof) { if (rev->pending_eof) {

View File

@ -220,7 +220,7 @@ struct ngx_http_cleanup_s {
struct { struct {
ngx_http_cache_hash_t *hash; ngx_http_cache_hash_t *hash;
ngx_http_cache_t *cache; ngx_http_cache_entry_t *cache;
} cache; } cache;
} data; } data;
@ -254,7 +254,7 @@ struct ngx_http_request_s {
void **srv_conf; void **srv_conf;
void **loc_conf; void **loc_conf;
ngx_http_cache_t *cache; ngx_http_cache_entry_t *cache;
ngx_file_t file; ngx_file_t file;

View File

@ -9,7 +9,7 @@
#include <ngx_event.h> #include <ngx_event.h>
#include <ngx_aio.h> #include <ngx_aio.h>
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
#include <ngx_kqueue_module.h> #include <ngx_kqueue_module.h>
#endif #endif
@ -46,7 +46,7 @@ ssize_t ngx_aio_read(ngx_connection_t *c, u_char *buf, size_t size)
rev->aiocb.aio_buf = buf; rev->aiocb.aio_buf = buf;
rev->aiocb.aio_nbytes = size; rev->aiocb.aio_nbytes = size;
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
rev->aiocb.aio_sigevent.sigev_notify_kqueue = ngx_kqueue; rev->aiocb.aio_sigevent.sigev_notify_kqueue = ngx_kqueue;
rev->aiocb.aio_sigevent.sigev_notify = SIGEV_KEVENT; rev->aiocb.aio_sigevent.sigev_notify = SIGEV_KEVENT;
rev->aiocb.aio_sigevent.sigev_value.sigval_ptr = rev; rev->aiocb.aio_sigevent.sigev_value.sigval_ptr = rev;

View File

@ -9,7 +9,7 @@
#include <ngx_event.h> #include <ngx_event.h>
#include <ngx_aio.h> #include <ngx_aio.h>
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
#include <ngx_kqueue_module.h> #include <ngx_kqueue_module.h>
#endif #endif
@ -43,7 +43,7 @@ ssize_t ngx_aio_write(ngx_connection_t *c, u_char *buf, size_t size)
wev->aiocb.aio_buf = buf; wev->aiocb.aio_buf = buf;
wev->aiocb.aio_nbytes = size; wev->aiocb.aio_nbytes = size;
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
wev->aiocb.aio_sigevent.sigev_notify_kqueue = ngx_kqueue; wev->aiocb.aio_sigevent.sigev_notify_kqueue = ngx_kqueue;
wev->aiocb.aio_sigevent.sigev_notify = SIGEV_KEVENT; wev->aiocb.aio_sigevent.sigev_notify = SIGEV_KEVENT;
wev->aiocb.aio_sigevent.sigev_value.sigval_ptr = wev; wev->aiocb.aio_sigevent.sigev_value.sigval_ptr = wev;

View File

@ -40,7 +40,7 @@ void *ngx_calloc(size_t size, ngx_log_t *log)
} }
#if (HAVE_POSIX_MEMALIGN) #if (NGX_HAVE_POSIX_MEMALIGN)
void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log) void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log)
{ {
@ -58,7 +58,7 @@ void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log)
return p; return p;
} }
#elif (HAVE_MEMALIGN) #elif (NGX_HAVE_MEMALIGN)
void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log) void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log)
{ {

View File

@ -25,7 +25,7 @@ void *ngx_calloc(size_t size, ngx_log_t *log);
* allocations bigger than page size at the page boundary. * allocations bigger than page size at the page boundary.
*/ */
#if (HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN) #if (NGX_HAVE_POSIX_MEMALIGN || NGX_HAVE_MEMALIGN)
void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log); void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log);

View File

@ -17,7 +17,7 @@ ngx_int_t ngx_write_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size,
struct iovec iov[1]; struct iovec iov[1];
struct msghdr msg; struct msghdr msg;
#if (HAVE_MSGHDR_MSG_CONTROL) #if (NGX_HAVE_MSGHDR_MSG_CONTROL)
union { union {
struct cmsghdr cm; struct cmsghdr cm;
@ -83,7 +83,7 @@ ngx_int_t ngx_read_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size,
struct iovec iov[1]; struct iovec iov[1];
struct msghdr msg; struct msghdr msg;
#if (HAVE_MSGHDR_MSG_CONTROL) #if (NGX_HAVE_MSGHDR_MSG_CONTROL)
union { union {
struct cmsghdr cm; struct cmsghdr cm;
char space[CMSG_SPACE(sizeof(int))]; char space[CMSG_SPACE(sizeof(int))];
@ -100,7 +100,7 @@ ngx_int_t ngx_read_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size,
msg.msg_iov = iov; msg.msg_iov = iov;
msg.msg_iovlen = 1; msg.msg_iovlen = 1;
#if (HAVE_MSGHDR_MSG_CONTROL) #if (NGX_HAVE_MSGHDR_MSG_CONTROL)
msg.msg_control = (caddr_t) &cmsg; msg.msg_control = (caddr_t) &cmsg;
msg.msg_controllen = sizeof(cmsg); msg.msg_controllen = sizeof(cmsg);
#else #else
@ -131,7 +131,7 @@ ngx_int_t ngx_read_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size,
return NGX_ERROR; return NGX_ERROR;
} }
#if (HAVE_MSGHDR_MSG_CONTROL) #if (NGX_HAVE_MSGHDR_MSG_CONTROL)
if (ch->command == NGX_CMD_OPEN_CHANNEL) { if (ch->command == NGX_CMD_OPEN_CHANNEL) {

View File

@ -8,7 +8,7 @@
#include <ngx_core.h> #include <ngx_core.h>
#if (NGX_STRERROR_R) #if (NGX_HAVE_STRERROR_R)
u_char *ngx_strerror_r(int err, u_char *errstr, size_t size) u_char *ngx_strerror_r(int err, u_char *errstr, size_t size)
{ {
@ -28,7 +28,7 @@ u_char *ngx_strerror_r(int err, u_char *errstr, size_t size)
return errstr; return errstr;
} }
#elif (NGX_GNU_STRERROR_R) #elif (NGX_HAVE_GNU_STRERROR_R)
/* Linux strerror_r() */ /* Linux strerror_r() */

View File

@ -46,7 +46,7 @@ typedef int ngx_err_t;
#define ngx_set_socket_errno(err) errno = err #define ngx_set_socket_errno(err) errno = err
#if (HAVE_STRERROR_R || HAVE_GNU_STRERROR_R) #if (NGX_HAVE_STRERROR_R || NGX_HAVE_GNU_STRERROR_R)
u_char *ngx_strerror_r(int err, u_char *errstr, size_t size); u_char *ngx_strerror_r(int err, u_char *errstr, size_t size);

View File

@ -15,7 +15,7 @@ ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0, ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0,
"read: %d, %p, %uz, %O", file->fd, buf, size, offset); "read: %d, %p, %uz, %O", file->fd, buf, size, offset);
#if (NGX_PREAD) #if (NGX_HAVE_PREAD)
n = pread(file->fd, buf, size, offset); n = pread(file->fd, buf, size, offset);
@ -60,7 +60,7 @@ ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0, ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0,
"write: %d, %p, %uz, %O", file->fd, buf, size, offset); "write: %d, %p, %uz, %O", file->fd, buf, size, offset);
#if (NGX_PWRITE) #if (NGX_HAVE_PWRITE)
n = pwrite(file->fd, buf, size, offset); n = pwrite(file->fd, buf, size, offset);

View File

@ -60,23 +60,23 @@
#include <ngx_auto_config.h> #include <ngx_auto_config.h>
#if (HAVE_POLL) #if (NGX_HAVE_POLL)
#include <poll.h> #include <poll.h>
#endif #endif
#if (HAVE_AIO) #if (NGX_HAVE_AIO)
#include <aio.h> #include <aio.h>
#endif #endif
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
#include <sys/event.h> #include <sys/event.h>
#endif #endif
#if defined SO_ACCEPTFILTER && !defined HAVE_DEFERRED_ACCEPT #if defined SO_ACCEPTFILTER && !defined NGX_HAVE_DEFERRED_ACCEPT
#define HAVE_DEFERRED_ACCEPT 1 #define NGX_HAVE_DEFERRED_ACCEPT 1
#endif #endif
@ -91,8 +91,8 @@ pid_t rfork_thread(int flags, void *stack, int (*func)(void *arg), void *arg);
#endif #endif
#ifndef HAVE_INHERITED_NONBLOCK #ifndef NGX_HAVE_INHERITED_NONBLOCK
#define HAVE_INHERITED_NONBLOCK 1 #define NGX_HAVE_INHERITED_NONBLOCK 1
#endif #endif

View File

@ -30,7 +30,7 @@ ngx_os_io_t ngx_os_io = {
ngx_unix_recv, ngx_unix_recv,
ngx_readv_chain, ngx_readv_chain,
ngx_unix_send, ngx_unix_send,
#if (HAVE_SENDFILE) #if (NGX_HAVE_SENDFILE)
ngx_freebsd_sendfile_chain, ngx_freebsd_sendfile_chain,
NGX_IO_SENDFILE NGX_IO_SENDFILE
#else #else
@ -128,7 +128,7 @@ ngx_int_t ngx_os_init(ngx_log_t *log)
version = ngx_freebsd_kern_osreldate; version = ngx_freebsd_kern_osreldate;
#if (HAVE_SENDFILE) #if (NGX_HAVE_SENDFILE)
/* /*
* The determination of the sendfile() "nbytes bug" is complex enough. * The determination of the sendfile() "nbytes bug" is complex enough.
@ -161,7 +161,7 @@ ngx_int_t ngx_os_init(ngx_log_t *log)
#endif #endif
#endif /* HAVE_SENDFILE */ #endif /* NGX_HAVE_SENDFILE */
if ((version < 500000 && version >= 440003) || version >= 500017) { if ((version < 500000 && version >= 440003) || version >= 500017) {

View File

@ -381,7 +381,7 @@ ngx_int_t ngx_mutex_dolock(ngx_mutex_t *m, ngx_int_t try)
return NGX_AGAIN; return NGX_AGAIN;
} }
if (ngx_freebsd_hw_ncpu > 1 && tries++ < 1000) { if (ngx_ncpu > 1 && tries++ < 1000) {
/* the spinlock is used only on the SMP system */ /* the spinlock is used only on the SMP system */
@ -581,7 +581,7 @@ ngx_cond_t *ngx_cond_init(ngx_log_t *log)
} }
cv->signo = NGX_CV_SIGNAL; cv->signo = NGX_CV_SIGNAL;
cv->tid = 0; cv->tid = -1;
cv->log = log; cv->log = log;
cv->kq = -1; cv->kq = -1;
@ -640,6 +640,8 @@ ngx_int_t ngx_cond_wait(ngx_cond_t *cv, ngx_mutex_t *m)
ngx_log_error(NGX_LOG_ALERT, cv->log, ngx_errno, "kevent() failed"); ngx_log_error(NGX_LOG_ALERT, cv->log, ngx_errno, "kevent() failed");
return NGX_ERROR; return NGX_ERROR;
} }
cv->tid = ngx_thread_self();
} }
if (ngx_mutex_unlock(m) == NGX_ERROR) { if (ngx_mutex_unlock(m) == NGX_ERROR) {
@ -714,6 +716,10 @@ ngx_int_t ngx_cond_signal(ngx_cond_t *cv)
"cv %p to signal %P %d", "cv %p to signal %P %d",
cv, cv->tid, cv->signo); cv, cv->tid, cv->signo);
if (cv->tid == -1) {
return NGX_OK;
}
if (kill(cv->tid, cv->signo) == -1) { if (kill(cv->tid, cv->signo) == -1) {
err = ngx_errno; err = ngx_errno;

View File

@ -55,7 +55,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in,
return in; return in;
} }
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) { if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) {
ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno, ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno,

View File

@ -56,35 +56,37 @@
#include <sys/prctl.h> #include <sys/prctl.h>
#endif #endif
#if (NGX_HAVE_SENDFILE64) #if (NGX_HAVE_SENDFILE64)
#include <sys/sendfile.h> #include <sys/sendfile.h>
#else #else
extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size); extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
#define NGX_SENDFILE_LIMIT (NGX_MAX_UINT32_VALUE + 1)
#endif #endif
#if (HAVE_POLL) #if (NGX_HAVE_POLL)
#include <poll.h> #include <poll.h>
#endif #endif
#if (HAVE_EPOLL) #if (NGX_HAVE_EPOLL)
#include <sys/epoll.h> #include <sys/epoll.h>
#endif /* HAVE_EPOLL */
#if defined TCP_DEFER_ACCEPT && !defined HAVE_DEFERRED_ACCEPT
#define HAVE_DEFERRED_ACCEPT 1
#endif #endif
#ifndef HAVE_INHERITED_NONBLOCK #if defined TCP_DEFER_ACCEPT && !defined NGX_HAVE_DEFERRED_ACCEPT
#define HAVE_INHERITED_NONBLOCK 0 #define NGX_HAVE_DEFERRED_ACCEPT 1
#endif #endif
#ifndef HAVE_SELECT_CHANGE_TIMEOUT #ifndef NGX_HAVE_INHERITED_NONBLOCK
#define HAVE_SELECT_CHANGE_TIMEOUT 1 #define NGX_HAVE_INHERITED_NONBLOCK 0
#endif
#ifndef NGX_HAVE_SELECT_CHANGE_TIMEOUT
#define NGX_HAVE_SELECT_CHANGE_TIMEOUT 1
#endif #endif
#ifndef NGX_SETPROCTITLE_USES_ENV #ifndef NGX_SETPROCTITLE_USES_ENV

View File

@ -18,7 +18,7 @@ ngx_os_io_t ngx_os_io = {
ngx_unix_recv, ngx_unix_recv,
ngx_readv_chain, ngx_readv_chain,
ngx_unix_send, ngx_unix_send,
#if (HAVE_SENDFILE) #if (NGX_HAVE_SENDFILE)
ngx_linux_sendfile_chain, ngx_linux_sendfile_chain,
NGX_IO_SENDFILE NGX_IO_SENDFILE
#else #else

View File

@ -13,7 +13,7 @@
* On Linux up to 2.4.21 sendfile() (syscall #187) works with 32-bit * On Linux up to 2.4.21 sendfile() (syscall #187) works with 32-bit
* offsets only and the including <sys/sendfile.h> breaks the compiling * offsets only and the including <sys/sendfile.h> breaks the compiling
* if off_t is 64 bit wide. So we use own sendfile() definition where offset * if off_t is 64 bit wide. So we use own sendfile() definition where offset
* parameter is int32_t and use sendfile() with the file parts below 2G. * parameter is int32_t and use sendfile() for the file parts below 2G only.
* *
* Linux 2.4.21 has a new sendfile64() syscall #239. * Linux 2.4.21 has a new sendfile64() syscall #239.
*/ */

View File

@ -15,18 +15,6 @@
#define NGX_IO_SENDFILE 1 #define NGX_IO_SENDFILE 1
#define NGX_IO_ZEROCOPY 2 #define NGX_IO_ZEROCOPY 2
#if (HAVE_SENDFILE)
#define NGX_HAVE_SENDFILE NGX_IO_SENDFILE
#else
#define NGX_HAVE_SENDFILE 0
#endif
#if (HAVE_ZEROCOPY)
#define NGX_HAVE_ZEROCOPY NGX_IO_ZEROCOPY
#else
#define NGX_HAVE_ZEROCOPY 0
#endif
typedef ssize_t (*ngx_recv_pt)(ngx_connection_t *c, u_char *buf, size_t size); typedef ssize_t (*ngx_recv_pt)(ngx_connection_t *c, u_char *buf, size_t size);
typedef ssize_t (*ngx_recv_chain_pt)(ngx_connection_t *c, ngx_chain_t *in); typedef ssize_t (*ngx_recv_chain_pt)(ngx_connection_t *c, ngx_chain_t *in);

View File

@ -70,17 +70,17 @@
#include <ngx_auto_config.h> #include <ngx_auto_config.h>
#if (HAVE_POLL) #if (NGX_HAVE_POLL)
#include <poll.h> #include <poll.h>
#endif #endif
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
#include <sys/event.h> #include <sys/event.h>
#endif #endif
#if (HAVE_DEVPOLL) #if (NGX_HAVE_DEVPOLL)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/devpoll.h> #include <sys/devpoll.h>
#endif #endif

View File

@ -121,7 +121,7 @@ ngx_int_t ngx_posix_init(ngx_log_t *log)
ngx_max_sockets = rlmt.rlim_cur; ngx_max_sockets = rlmt.rlim_cur;
#if (HAVE_INHERITED_NONBLOCK) #if (NGX_HAVE_INHERITED_NONBLOCK)
ngx_inherited_nonblocking = 1; ngx_inherited_nonblocking = 1;
#else #else
ngx_inherited_nonblocking = 0; ngx_inherited_nonblocking = 0;

View File

@ -607,6 +607,10 @@ static void ngx_master_exit(ngx_cycle_t *cycle)
static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
{ {
ngx_int_t n;
ngx_err_t err;
ngx_core_conf_t *ccf;
ngx_worker_process_init(cycle); ngx_worker_process_init(cycle);
ngx_setproctitle("worker process"); ngx_setproctitle("worker process");
@ -618,6 +622,8 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
exit(2); exit(2);
} }
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
if (ngx_threads_n) { if (ngx_threads_n) {
if (ngx_init_threads(ngx_threads_n, if (ngx_init_threads(ngx_threads_n,
ccf->thread_stack_size, cycle) == NGX_ERROR) ccf->thread_stack_size, cycle) == NGX_ERROR)
@ -914,10 +920,9 @@ static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle)
for (i = 0; i < ngx_threads_n; i++) { for (i = 0; i < ngx_threads_n; i++) {
if (ngx_threads[i].state < NGX_THREAD_EXIT) { if (ngx_threads[i].state < NGX_THREAD_EXIT) {
ngx_cond_signal(ngx_threads[i].cv); if (ngx_cond_signal(ngx_threads[i].cv) == NGX_ERROR) {
if (ngx_threads[i].cv->tid == (ngx_tid_t) -1) {
ngx_threads[i].state = NGX_THREAD_DONE; ngx_threads[i].state = NGX_THREAD_DONE;
} else { } else {
live = 1; live = 1;
} }
@ -955,8 +960,6 @@ static void *ngx_worker_thread_cycle(void *data)
ngx_core_tls_t *tls; ngx_core_tls_t *tls;
ngx_cycle_t *cycle; ngx_cycle_t *cycle;
thr->cv->tid = ngx_thread_self();
cycle = (ngx_cycle_t *) ngx_cycle; cycle = (ngx_cycle_t *) ngx_cycle;
sigemptyset(&set); sigemptyset(&set);

View File

@ -9,7 +9,7 @@
#include <ngx_event.h> #include <ngx_event.h>
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
{ {
@ -136,7 +136,7 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
return n; return n;
} }
#else /* ! NAVE_KQUEUE */ #else /* ! NGX_HAVE_KQUEUE */
ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
{ {
@ -216,4 +216,4 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
return n; return n;
} }
#endif /* NAVE_KQUEUE */ #endif /* NGX_HAVE_KQUEUE */

View File

@ -9,7 +9,7 @@
#include <ngx_event.h> #include <ngx_event.h>
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
{ {
@ -115,7 +115,7 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
return n; return n;
} }
#else /* ! NAVE_KQUEUE */ #else /* ! NGX_HAVE_KQUEUE */
ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
{ {
@ -170,4 +170,4 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
return n; return n;
} }
#endif /* NAVE_KQUEUE */ #endif /* NGX_HAVE_KQUEUE */

View File

@ -17,7 +17,7 @@ ssize_t ngx_unix_send(ngx_connection_t *c, u_char *buf, size_t size)
wev = c->write; wev = c->write;
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) { if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) {
ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno, ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno,

View File

@ -8,7 +8,7 @@
#include <ngx_core.h> #include <ngx_core.h>
#if (HAVE_MAP_ANON) #if (NGX_HAVE_MAP_ANON)
void *ngx_create_shared_memory(size_t size, ngx_log_t *log) void *ngx_create_shared_memory(size_t size, ngx_log_t *log)
{ {
@ -25,7 +25,7 @@ void *ngx_create_shared_memory(size_t size, ngx_log_t *log)
return p; return p;
} }
#elif (HAVE_MAP_DEVZERO) #elif (NGX_HAVE_MAP_DEVZERO)
void *ngx_create_shared_memory(size_t size, ngx_log_t *log) void *ngx_create_shared_memory(size_t size, ngx_log_t *log)
{ {
@ -56,7 +56,7 @@ void *ngx_create_shared_memory(size_t size, ngx_log_t *log)
return p; return p;
} }
#elif (HAVE_SYSVSHM) #elif (NGX_HAVE_SYSVSHM)
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>

View File

@ -20,7 +20,7 @@
*/ */
#if (HAVE_FIONBIO) #if (NGX_HAVE_FIONBIO)
int ngx_nonblocking(ngx_socket_t s) int ngx_nonblocking(ngx_socket_t s)
{ {

View File

@ -19,7 +19,7 @@ typedef int ngx_socket_t;
#define ngx_socket_n "socket()" #define ngx_socket_n "socket()"
#if (HAVE_FIONBIO) #if (NGX_HAVE_FIONBIO)
int ngx_nonblocking(ngx_socket_t s); int ngx_nonblocking(ngx_socket_t s);
int ngx_blocking(ngx_socket_t s); int ngx_blocking(ngx_socket_t s);

View File

@ -49,35 +49,35 @@
#include <ngx_auto_config.h> #include <ngx_auto_config.h>
#if (HAVE_POLL) #if (NGX_HAVE_POLL)
#include <poll.h> #include <poll.h>
#endif #endif
#if (HAVE_SENDFILE) #if (NGX_HAVE_SENDFILE)
#include <sys/sendfile.h> #include <sys/sendfile.h>
#endif #endif
#if (HAVE_AIO) #if (NGX_HAVE_AIO)
#include <aio.h> #include <aio.h>
#endif #endif
#if (HAVE_DEVPOLL) #if (NGX_HAVE_DEVPOLL)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/devpoll.h> #include <sys/devpoll.h>
#endif #endif
#ifndef HAVE_INHERITED_NONBLOCK #ifndef NGX_HAVE_INHERITED_NONBLOCK
#define HAVE_INHERITED_NONBLOCK 1 #define NGX_HAVE_INHERITED_NONBLOCK 1
#endif #endif
#ifndef HAVE_SO_SNDLOWAT #ifndef NGX_HAVE_SO_SNDLOWAT
/* setsockopt(SO_SNDLOWAT) returns error "Option not supported by protocol" */ /* setsockopt(SO_SNDLOWAT) returns error "Option not supported by protocol" */
#define HAVE_SO_SNDLOWAT 0 #define NGX_HAVE_SO_SNDLOWAT 0
#endif #endif

View File

@ -17,7 +17,7 @@ ngx_os_io_t ngx_os_io = {
ngx_unix_recv, ngx_unix_recv,
ngx_readv_chain, ngx_readv_chain,
ngx_unix_send, ngx_unix_send,
#if (HAVE_SENDFILE) #if (NGX_HAVE_SENDFILE)
ngx_solaris_sendfilev_chain, ngx_solaris_sendfilev_chain,
NGX_IO_SENDFILE NGX_IO_SENDFILE
#else #else

View File

@ -53,7 +53,6 @@ typedef struct {
typedef struct { typedef struct {
pthread_cond_t cond; pthread_cond_t cond;
ngx_tid_t tid;
ngx_log_t *log; ngx_log_t *log;
} ngx_cond_t; } ngx_cond_t;

View File

@ -10,7 +10,7 @@
void ngx_localtime(ngx_tm_t *tm) void ngx_localtime(ngx_tm_t *tm)
{ {
#if (HAVE_LOCALTIME_R) #if (NGX_HAVE_LOCALTIME_R)
time_t now; time_t now;
now = ngx_time(); now = ngx_time();

View File

@ -36,7 +36,7 @@ typedef struct tm ngx_tm_t;
#define ngx_tm_wday_t int #define ngx_tm_wday_t int
#if (HAVE_GMTOFF) #if (NGX_HAVE_GMTOFF)
#define ngx_tm_gmtoff tm_gmtoff #define ngx_tm_gmtoff tm_gmtoff
#define ngx_tm_zone tm_zone #define ngx_tm_zone tm_zone
#endif #endif

View File

@ -30,7 +30,7 @@ ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
return in; return in;
} }
#if (HAVE_KQUEUE) #if (NGX_HAVE_KQUEUE)
if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) { if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) {
ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno, ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno,

View File

@ -15,18 +15,6 @@
#define NGX_IO_SENDFILE 1 #define NGX_IO_SENDFILE 1
#define NGX_IO_ZEROCOPY 2 #define NGX_IO_ZEROCOPY 2
#if (HAVE_SENDFILE)
#define NGX_HAVE_SENDFILE NGX_IO_SENDFILE
#else
#define NGX_HAVE_SENDFILE 0
#endif
#if (HAVE_ZEROCOPY)
#define NGX_HAVE_ZEROCOPY NGX_IO_ZEROCOPY
#else
#define NGX_HAVE_ZEROCOPY 0
#endif
typedef ssize_t (*ngx_recv_pt)(ngx_connection_t *c, u_char *buf, size_t size); typedef ssize_t (*ngx_recv_pt)(ngx_connection_t *c, u_char *buf, size_t size);
typedef ssize_t (*ngx_recv_chain_pt)(ngx_connection_t *c, ngx_chain_t *in); typedef ssize_t (*ngx_recv_chain_pt)(ngx_connection_t *c, ngx_chain_t *in);

View File

@ -39,7 +39,7 @@ typedef FILETIME ngx_mtime_t;
#define ngx_msleep Sleep #define ngx_msleep Sleep
#define HAVE_GETTIMEZONE 1 #define NGX_HAVE_GETTIMEZONE 1
ngx_int_t ngx_gettimezone(void); ngx_int_t ngx_gettimezone(void);
void ngx_gettimeofday(struct timeval *tp); void ngx_gettimeofday(struct timeval *tp);

View File

@ -115,37 +115,31 @@ typedef uint32_t ngx_atomic_t;
#define TIME_T_LEN sizeof("-2147483648") - 1 #define TIME_T_LEN sizeof("-2147483648") - 1
#define OFF_T_MAX_VALUE 9223372036854775807
#define NGX_HAVE_LITTLE_ENDIAN 1
#define NGX_THREADS 1
#define NGX_WIN_NT 200000 #define NGX_WIN_NT 200000
#define NGX_THREADS 1 #ifndef NGX_HAVE_INHERITED_NONBLOCK
#define NGX_HAVE_INHERITED_NONBLOCK 1
#ifndef HAVE_INHERITED_NONBLOCK
#define HAVE_INHERITED_NONBLOCK 1
#endif #endif
#ifndef HAVE_WIN32_TRANSMITPACKETS #ifndef NGX_HAVE_WIN32_TRANSMITPACKETS
#define HAVE_WIN32_TRANSMITPACKETS 1 #define NGX_HAVE_WIN32_TRANSMITPACKETS 1
#define HAVE_WIN32_TRANSMITFILE 0 #define NGX_HAVE_WIN32_TRANSMITFILE 0
#endif #endif
#ifndef HAVE_WIN32_TRANSMITFILE #ifndef NGX_HAVE_WIN32_TRANSMITFILE
#define HAVE_WIN32_TRANSMITFILE 1 #define NGX_HAVE_WIN32_TRANSMITFILE 1
#endif #endif
#if (HAVE_WIN32_TRANSMITPACKETS) || (HAVE_WIN32_TRANSMITFILE) #if (NGX_HAVE_WIN32_TRANSMITPACKETS) || (NGX_HAVE_WIN32_TRANSMITFILE)
#define HAVE_SENDFILE 1 #define NGX_HAVE_SENDFILE 1
#endif #endif
#define OFF_T_MAX_VALUE 9223372036854775807
/* STUB */
#define HAVE_LITTLE_ENDIAN 1
#endif /* _NGX_WIN32_CONFIG_H_INCLUDED_ */ #endif /* _NGX_WIN32_CONFIG_H_INCLUDED_ */