]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.0.3-2004-03-29-21:43:58 import
authorIgor Sysoev <igor@sysoev.ru>
Mon, 29 Mar 2004 17:43:58 +0000 (17:43 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 29 Mar 2004 17:43:58 +0000 (17:43 +0000)
32 files changed:
auto/cc
auto/init
auto/lib/make
auto/lib/md5/conf
auto/lib/md5/make
auto/lib/md5/makefile.bcc [new file with mode: 0644]
auto/lib/md5/makefile.msvc
auto/lib/md5/makefile.owc
auto/lib/pcre/conf
auto/lib/pcre/make
auto/lib/pcre/makefile.bcc [new file with mode: 0644]
auto/lib/zlib/conf
auto/lib/zlib/make
auto/lib/zlib/makefile.bcc [new file with mode: 0644]
auto/lib/zlib/makefile.msvc
auto/lib/zlib/makefile.owc
auto/make
auto/sources
src/core/ngx_alloc.c
src/core/ngx_atomic.h
src/core/ngx_conf_file.c
src/core/ngx_config.h
src/core/ngx_times.c
src/event/ngx_event_busy_lock.c
src/http/modules/proxy/ngx_http_proxy_upstream.c
src/http/ngx_http.h
src/http/ngx_http_core_module.c
src/http/ngx_http_request.h
src/http/ngx_http_request_body.c
src/os/unix/ngx_freebsd_init.c
src/os/unix/ngx_freebsd_sendfile_chain.c
src/os/win32/ngx_win32_config.h

diff --git a/auto/cc b/auto/cc
index 377c442d6b9170b63da709a5d426d7d6baf6db19..67f364d4eb304e725490031f59e29b989d1a1547 100644 (file)
--- a/auto/cc
+++ b/auto/cc
@@ -62,6 +62,9 @@ case $CC in
          # debug
          CFLAGS="$CFLAGS -g"
 
+         # DragonFly's gcc3 generate DWARF
+         CFLAGS="$CFLAGS -g -gstabs"
+
          have=HAVE_GCC_VARIADIC_MACROS . auto/have
 
          if [ ".$CPP" = "." ]; then
@@ -70,10 +73,11 @@ case $CC in
 
          LINK="\$(CC)"
 
-         OBJEXT=o
-         COMPILEONLY="-c"
+         INCOPT="-I "
+         COMPOPT="-c"
          OBJOUT="-o "
          BINOUT="-o "
+         OBJEXT="o"
 
          CC_STRONG="$CC -Wall -Werror"
     ;;
@@ -142,10 +146,11 @@ case $CC in
 
          LINK="\$(CC)"
 
-         OBJEXT=o
-         COMPILEONLY="-c"
+         INCOPT="-I "
+         COMPOPT="-c"
          OBJOUT="-o "
          BINOUT="-o "
+         OBJEXT="o"
 
          CC_STRONG="$CC -w1 -Werror"
     ;;
@@ -170,7 +175,7 @@ case $CC in
          CFLAGS="$CFLAGS -Gs"
 
          case $CPU in
-             pentiumpro)
+             pentium)
                  # optimize for Pentium and Athlon
                  CPU_OPT="-G5"
              ;;
@@ -220,13 +225,13 @@ case $CC in
          BUILDPCH="-Ycngx_config.h"
          USEPCH="-Yungx_config.h"
 
-         OBJEXT=obj
-         COMPILEONLY="-c"
+         INCOPT="-I "
+         COMPOPT="-c"
          OBJOUT="-Fo"
          BINOUT="-Fe"
-         BINEXT=.exe
-
-         CC_STRONG="$CC -W3 -WX"
+         OBJEXT="obj"
+         BINEXT=".exe"
+         #DIRSEP='\\'
     ;;
 
 
@@ -296,15 +301,64 @@ case $CC in
          # link flags
          CORE_LINK="$CORE_LINK -l=nt"
 
-         OBJEXT=obj
-         COMPILEONLY="-c"
+         INCOPT="-i="
+         COMPOPT="-c"
          OBJOUT="-fo"
          BINOUT="-fe="
-         BINEXT=.exe
+         OBJEXT="obj"
+         BINEXT=".exe"
+         DIRSEP='\\'
 
-         INC_EQ=YES
-         MAKE_BS=YES
          MAKE_SL=YES
     ;;
 
+
+    bcc32)
+         # Borland C++ 5.5
+
+         # optimization
+
+         # maximize speed
+         CFLAGS="$CFLAGS -O2"
+
+         case $CPU in
+             pentium)
+                 # optimize for Pentium and Athlon
+                 CPU_OPT="-5"
+             ;;
+
+             pentiumpro)
+                 # optimize for Pentium Pro, Pentium II and Pentium III
+                 CPU_OPT="-6"
+             ;;
+         esac
+
+         CFLAGS="$CFLAGS $CPU_OPT"
+
+         # multithreaded
+         CFLAGS="$CFLAGS -tWM"
+
+         # stop on warning
+         CFLAGS="$CFLAGS -w!"
+
+         # disable logo
+         CFLAGS="$CFLAGS -q"
+
+         # precompiled headers
+         CORE_DEPS="$CORE_DEPS $OBJS\\ngx_config.csm"
+         PCH="$OBJS\\ngx_config.csm"
+         BUILDPCH="-H=$OBJS\\ngx_config.csm"
+         USEPCH="-Hu -H=$OBJS\\ngx_config.csm"
+
+         LINK="\$(CC)"
+
+         INCOPT="-I"
+         COMPOPT="-c"
+         OBJOUT="-o" 
+         BINOUT="-e"
+         OBJEXT="obj"
+         BINEXT=".exe"
+         DIRSEP='\\'
+    ;;
+
 esac
index 2cc024abd72dc8911b2b102e0ed39102b46f99fd..6c175d28502ec77e38c280c9548687f8382b5232 100644 (file)
--- a/auto/init
+++ b/auto/init
@@ -12,11 +12,10 @@ CC_WARN=$CC
 PCH=NO
 USEPCH=
 
+OBJEXT=
 BINEXT=
-INC_EQ=NO
-MAKE_BS=NO
+DIRSEP='\/'
 MAKE_SL=NO
-MAKE_BL=YES
 
 
 # checking echo's "-n" option and "\c" capabilties
index 3bab86b713af343e72a33c7022b6bffd47bceb59..7acae504fff6b5615ce7c44163e3cce368da348e 100644 (file)
@@ -1,12 +1,12 @@
 
-if [ $PCRE != NO ]; then
+if [ $PCRE != NONE -a $PCRE != NO ]; then
     . auto/lib/pcre/make
 fi
 
-if [ $MD5 != NO ]; then
+if [ $MD5 != NONE -a $MD5 != NO ]; then
     . auto/lib/md5/make
 fi
 
-if [ $ZLIB != NO ]; then
+if [ $ZLIB != NONE -a $ZLIB != NO ]; then
     . auto/lib/zlib/make
 fi
index 5c6a417a04d87accd5f07ff5572a8beeee5e87df..40fd74716381cc7fc13d2ca88f25c115f61f8bf6 100644 (file)
@@ -10,17 +10,11 @@ if [ $MD5 != NONE ]; then
         OPENSSL_MD5=NO
     fi
 
-    CORE_INCS="$CORE_INCS -I $MD5"
+    CORE_INCS="$CORE_INCS $MD5"
 
     case "$CC" in
 
-        cl)
-            LINK_DEPS="$LINK_DEPS $MD5/md5.lib"
-            CORE_LIBS="$CORE_LIBS md5.lib"
-            CORE_LINK="$CORE_LINK -libpath:$MD5"
-        ;;
-
-        wcl386)
+        cl | wcl386 | bcc32)
             LINK_DEPS="$LINK_DEPS $MD5/md5.lib"
             CORE_LIBS="$CORE_LIBS $MD5/md5.lib"
         ;;
index 485bf41eb052f98e36fb6f36e70c4b3320e32c94..2632c9b1f087300e7c3404e6b39e148bf504f8c4 100644 (file)
@@ -3,10 +3,17 @@ case "$CC" in
 
     cl)
         makefile=makefile.msvc
+        opt="CPU_OPT=$CPU_OPT LIBC=$LIBC MD5_ASM=$MD5_ASM"
     ;;
 
     wcl386)
         makefile=makefile.owc
+        opt="CPU_OPT=$CPU_OPT"
+    ;;
+
+    bcc32)
+        makefile=makefile.bcc
+        opt="-DCPU_OPT=$CPU_OPT -DMD5_ASM=$MD5_ASM"
     ;;
 
 esac
@@ -15,7 +22,8 @@ esac
 case $PLATFORM in
 
     win32)
-        echo "$MD5/md5.lib:"                                      >> $MAKEFILE
+        line=`echo $MD5/md5.lib: | sed -e "s/\//$DIRSEP/g"`
+        echo "$line"                                              >> $MAKEFILE
     ;;
 
     *)
@@ -31,11 +39,11 @@ done=NO
 case $PLATFORM in
 
     win32)
+        md5=`echo $MD5 | sed -e "s/\//$DIRSEP/g"`
 
         cp auto/lib/md5/$makefile $MD5
-        echo " cd $MD5"                                          >> $MAKEFILE
-        echo $ngx_n "  \$(MAKE) -f $makefile" $ngx_c             >> $MAKEFILE
-        echo " CPU_OPT=$CPU_OPT LIBC=$LIBC MD5_ASM=$MD5_ASM"      >> $MAKEFILE
+        echo " cd $md5"                                          >> $MAKEFILE
+        echo " \$(MAKE) -f $makefile $opt"                       >> $MAKEFILE
         echo " cd ..\\..\\.."                                    >> $MAKEFILE
 
         done=YES
diff --git a/auto/lib/md5/makefile.bcc b/auto/lib/md5/makefile.bcc
new file mode 100644 (file)
index 0000000..e3dd8aa
--- /dev/null
@@ -0,0 +1,16 @@
+
+CFLAGS = -q -O2 -tWM $(CPU_OPT) -DL_ENDIAN
+
+!if "$(MD5_ASM)" == "YES"
+
+md5.lib:
+       bcc32 -c $(CFLAGS) -DMD5_ASM md5_dgst.c
+       tlib md5.lib +md5_dgst.obj +asm/m-win32.obj
+
+!else
+
+md5.lib:
+       bcc32 -c $(CFLAGS) md5_dgst.c
+       tlib md5.lib +md5_dgst.obj
+
+!endif
index 7ba190d86f7f45cc06d6786dc870b3f21acaac69..c497c39ae79e11d6d39f2d13a51ffbe29acab18b 100644 (file)
@@ -1,16 +1,16 @@
 
-CFLAGS = -nologo -c -MT -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN
+CFLAGS = -nologo -MT -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN
 
 !if "$(MD5_ASM)" == "YES"
 
 md5.lib:
-       cl $(CFLAGS) -D MD5_ASM md5_dgst.c
+       cl -c $(CFLAGS) -D MD5_ASM md5_dgst.c
        link -lib -out:md5.lib md5_dgst.obj asm/m-win32.obj
 
 !else
 
 md5.lib:
-       cl $(CFLAGS) md5_dgst.c
+       cl -c $(CFLAGS) md5_dgst.c
        link -lib -out:md5.lib md5_dgst.obj
 
 !endif
index 2cb6b654f0706b7d6326ddb3448d56d5b750f38d..917acba30f882596abfea8f82b6493df1df3bcc7 100644 (file)
@@ -1,6 +1,6 @@
 
-CFLAGS = -c -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT)
+CFLAGS = -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT)
 
 md5.lib:
-       wcl386 $(CFLAGS) -dL_ENDIAN md5_dgst.c
+       wcl386 -c $(CFLAGS) -dL_ENDIAN md5_dgst.c
        wlib -n md5.lib md5_dgst.obj
index 972c1068232d79aab0c497553aae029d49c6875e..3f2c7a1f6af795b6f5ce592a52315eb0f2cdc7dc 100644 (file)
@@ -1,21 +1,12 @@
 
 if [ $PCRE != NONE ]; then
-    CORE_INCS="$CORE_INCS -I $PCRE"
+    CORE_INCS="$CORE_INCS $PCRE"
     CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
     CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
 
     case "$CC" in
 
-        cl)
-            have=HAVE_PCRE . auto/have
-            have=PCRE_STATIC . auto/have
-            CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
-            LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib"
-            CORE_LIBS="$CORE_LIBS pcre.lib"
-            CORE_LINK="$CORE_LINK -libpath:$PCRE"
-        ;;
-
-        wcl386)
+        cl | wcl386 | bcc32)
             have=HAVE_PCRE . auto/have
             have=PCRE_STATIC . auto/have
             CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
index 1f26f5b838a050dfbe5e4871ca7f2f78d6187dbf..3a42eaba83e5ca2c58955782c5ec757d9b3982b8 100644 (file)
@@ -3,10 +3,17 @@ case "$CC" in
 
     cl)
         makefile=makefile.msvc
+        opt="CPU_OPT=$CPU_OPT LIBC=$LIBC"
     ;;
 
     wcl386)
         makefile=makefile.owc
+        opt="CPU_OPT=$CPU_OPT"
+    ;;
+
+    bcc32)
+        makefile=makefile.bcc
+        opt="-DCPU_OPT=$CPU_OPT"
     ;;
 
 esac
@@ -19,14 +26,21 @@ case $PLATFORM in
         cp auto/lib/pcre/patch.config.in $PCRE
         cp auto/lib/pcre/$makefile $PCRE
 
-        echo "$PCRE/pcre.h:"                                      >> $MAKEFILE
-        echo " cd $PCRE"                                         >> $MAKEFILE
+        pcre=`echo $PCRE | sed -e "s/\//$DIRSEP/g"`
+        line=`echo $PCRE/pcre.h: | sed -e "s/\//$DIRSEP/g"`
+
+        echo "$line"                                              >> $MAKEFILE
+        echo " cd $pcre"                                         >> $MAKEFILE
         echo " \$(MAKE) -f $makefile pcre.h"                     >> $MAKEFILE
         echo " cd ..\\..\\.."                                    >> $MAKEFILE
         echo                                                      >> $MAKEFILE
-        echo "$PCRE/pcre.lib:  $PCRE/pcre.h"                     >> $MAKEFILE
-        echo " cd $PCRE"                                         >> $MAKEFILE
-        echo " \$(MAKE) -f $makefile CPU_OPT=$CPU_OPT LIBC=$LIBC">> $MAKEFILE
+
+        line="$PCRE/pcre.lib:  $PCRE/pcre.h"
+        line=`echo $line | sed -e "s/\//$DIRSEP/g"`
+
+        echo "$line"                                              >> $MAKEFILE
+        echo " cd $pcre"                                         >> $MAKEFILE
+        echo " \$(MAKE) -f $makefile $opt"                       >> $MAKEFILE
         echo " cd ..\\..\\.."                                    >> $MAKEFILE
     ;;
 
diff --git a/auto/lib/pcre/makefile.bcc b/auto/lib/pcre/makefile.bcc
new file mode 100644 (file)
index 0000000..5744b90
--- /dev/null
@@ -0,0 +1,17 @@
+
+CFLAGS =       -q -O2 -tWM $(CPU_OPT)
+PCREFLAGS =    -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10
+
+
+pcre.lib:      pcre.h
+       bcc32 -q -edftables dftables.c
+
+       dftables > chartables.c
+
+       bcc32 -c $(CFLAGS) $(PCREFLAGS) maketables.c get.c study.c pcre.c
+
+       tlib pcre.lib +maketables.obj +get.obj +study.obj +pcre.obj
+
+pcre.h:
+       patch -o pcre.h pcre.in patch.pcre.in
+       patch -o config.h config.in patch.config.in
index c699ca63fe8de9b05a61be3ed6d46f5cea26629a..82cc5edc87eadf14a4e497d938097f1bab4ef4fd 100644 (file)
@@ -1,16 +1,10 @@
 
 if [ $ZLIB != NONE ]; then
-    CORE_INCS="$CORE_INCS -I $ZLIB"
+    CORE_INCS="$CORE_INCS $ZLIB"
 
     case "$CC" in
 
-        cl)
-            LINK_DEPS="$LINK_DEPS $ZLIB/zlib.lib"
-            CORE_LIBS="$CORE_LIBS zlib.lib"
-            CORE_LINK="$CORE_LINK -libpath:$ZLIB"
-        ;;
-
-        wcl386)
+        cl | wcl386 | bcc32)
             LINK_DEPS="$LINK_DEPS $ZLIB/zlib.lib"
             CORE_LIBS="$CORE_LIBS $ZLIB/zlib.lib"
         ;;
index 00b08bb1e9a386fd430948684fbf8111613e6c6c..c442730652a8d6d12449eeb2b07c6d6308a02ef9 100644 (file)
@@ -3,10 +3,18 @@ case "$CC" in
 
     cl)
         makefile=makefile.msvc
+        opt="CPU_OPT=$CPU_OPT LIBC=$LIBC"
+
     ;;
 
     wcl386)
         makefile=makefile.owc
+        opt="CPU_OPT=$CPU_OPT"
+    ;;
+
+    bcc32)
+        makefile=makefile.bcc
+        opt="-DCPU_OPT=$CPU_OPT"
     ;;
 
 esac
@@ -15,7 +23,8 @@ esac
 case $PLATFORM in
 
     win32)
-        echo "$ZLIB/zlib.lib:"                                    >> $MAKEFILE
+        line=`echo $ZLIB/zlib.lib: | sed -e "s/\//$DIRSEP/g"`
+        echo "$line"                                              >> $MAKEFILE
     ;;
 
     *)
@@ -31,10 +40,11 @@ done=NO
 case $PLATFORM in
 
     win32)
+        zlib=`echo $ZLIB | sed -e "s/\//$DIRSEP/g"`
 
         cp auto/lib/zlib/$makefile $ZLIB
-        echo " cd $ZLIB"                                         >> $MAKEFILE
-        echo " \$(MAKE) -f $makefile CPU_OPT=$CPU_OPT LIBC=$LIBC">> $MAKEFILE
+        echo " cd $zlib"                                         >> $MAKEFILE
+        echo " \$(MAKE) -f $makefile $opt"                       >> $MAKEFILE
         echo " cd ..\\..\\.."                                    >> $MAKEFILE
 
         done=YES
diff --git a/auto/lib/zlib/makefile.bcc b/auto/lib/zlib/makefile.bcc
new file mode 100644 (file)
index 0000000..0ec4de8
--- /dev/null
@@ -0,0 +1,8 @@
+
+CFLAGS = -q -O2 -tWM $(CPU_OPT)
+
+zlib.lib:
+       bcc32 -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c
+
+       tlib zlib.lib +adler32.obj +crc32.obj +deflate.obj \
+               +trees.obj +zutil.obj
index fe3f4f35d3c6318ff31bc4131f151c97a2805775..a9983efdf9afebdbebb255bbfb1b72404f47457c 100644 (file)
@@ -1,8 +1,8 @@
 
-CFLAGS = -nologo -c -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT)
+CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT)
 
 zlib.lib:
-       cl $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c
+       cl -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c
 
        link -lib -out:zlib.lib adler32.obj crc32.obj deflate.obj \
                trees.obj zutil.obj
index e119bb9e3ab4b0f5e5de260ffdcd66b726ad4d11..bc57d20cf35a3de91f1bc2b7712a0cade0efe67e 100644 (file)
@@ -1,6 +1,6 @@
 
-CFLAGS = -c -zq -bt=nt -ot -op -oi -oe -s -bm $(CPU_OPT)
+CFLAGS = -zq -bt=nt -ot -op -oi -oe -s -bm $(CPU_OPT)
 
 zlib.lib:
-       wcl386 $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c
+       wcl386 -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c
        wlib -n zlib.lib adler32.obj crc32.obj deflate.obj trees.obj zutil.obj
index 4ba216de28350d11dfbdb86cd50d07c9c6d2213f..8aefe00ebc605f51237e8c744f382b79e4caa1b2 100644 (file)
--- a/auto/make
+++ b/auto/make
@@ -18,14 +18,9 @@ if [ $MAKE_SL = YES ]; then
     echo                                                          >> $MAKEFILE
 fi
 
-all_inc="$CORE_INCS -I $OBJS $HTTP_INCS"
-if [ $INC_EQ = YES ]; then
-    all_inc=`echo $all_inc | sed -e "s/-I /-i=/g"`
-fi
-
-if [ $MAKE_BS = YES ]; then
-    all_inc=`echo $all_inc | sed -e "s/\//\\\\\\/g"`
-fi
+all_inc="$CORE_INCS $OBJS $HTTP_INCS"
+all_inc=`echo " $all_inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g"`
+all_inc=`echo $all_inc | sed -e "s/\//$DIRSEP/g"`
 
 echo "ALL_INCS = $all_inc"                                        >> $MAKEFILE
 echo                                                              >> $MAKEFILE
@@ -41,9 +36,7 @@ fi
 
 for dep in $CORE_DEPS
 do
-    if [ $MAKE_BS = YES ]; then
-        dep=`echo $dep | sed -e "s/\//\\\\\\/g"`
-    fi
+    dep=`echo $dep | sed -e "s/\//$DIRSEP/g"`
 
     if [ $MAKE_SL = YES ]; then
         echo $ngx_n " $dep" $ngx_c                                >> $MAKEFILE
@@ -60,14 +53,8 @@ if [ $MAKE_SL = YES ]; then
     echo                                                          >> $MAKEFILE
 fi
 
-inc="$CORE_INCS -I $OBJS"
-if [ $INC_EQ = YES ]; then
-    inc=`echo $inc | sed -e "s/-I /-i=/g"`
-fi
-
-if [ $MAKE_BS = YES ]; then
-    inc=`echo $inc | sed -e "s/\//\\\\\\/g"`
-fi
+inc="$CORE_INCS $OBJS"
+inc=`echo " $inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g" -e "s/\//$DIRSEP/g"`
 
 echo "CORE_INCS = $inc"                                           >> $MAKEFILE
 echo                                                              >> $MAKEFILE
@@ -83,9 +70,7 @@ fi
 
 for dep in $HTTP_DEPS
 do
-    if [ $MAKE_BS = YES ]; then
-        dep=`echo $dep | sed -e "s/\//\\\\\\/g"`
-    fi
+    dep=`echo $dep | sed -e "s/\//$DIRSEP/g"`
 
     if [ $MAKE_SL = YES ]; then
         echo $ngx_n " $dep" $ngx_c                                >> $MAKEFILE
@@ -102,14 +87,8 @@ if [ $MAKE_SL = YES ]; then
     echo                                                          >> $MAKEFILE
 fi
 
-inc="$HTTP_INCS -I $OBJS"
-if [ $INC_EQ = YES ]; then
-    inc=`echo $inc | sed -e "s/-I /-i=/g"`
-fi
-
-if [ $MAKE_BS = YES ]; then
-    inc=`echo $inc | sed -e "s/\//\\\\\\/g"`
-fi
+inc="$HTTP_INCS $OBJS"
+inc=`echo " $inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g" -e "s/\//$DIRSEP/g"`
 
 echo "HTTP_INCS = $inc"                                           >> $MAKEFILE
 echo                                                              >> $MAKEFILE
@@ -129,11 +108,7 @@ fi
 for src in $CORE_SRCS $HTTP_SRCS
 do
     obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"`
-    obj="$OBJS/$obj"
-
-    if [ $MAKE_BS = YES ]; then
-        obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
-    fi
+    obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"`
 
     if [ $MAKE_SL = YES ]; then
         echo $ngx_n " $obj" $ngx_c                                >> $MAKEFILE
@@ -145,10 +120,7 @@ done
 for src in $NGX_MODULES_C $LINK_DEPS
 do
     obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"`
-
-    if [ $MAKE_BS = YES ]; then
-        obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
-    fi
+    obj=`echo $obj | sed -e "s/\//$DIRSEP/g"`
 
     if [ $MAKE_SL = YES ]; then
         echo $ngx_n " $obj" $ngx_c                                >> $MAKEFILE
@@ -173,11 +145,7 @@ fi
 for src in $CORE_SRCS $HTTP_SRCS
 do
     obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"`
-    obj="$OBJS/$obj"
-
-    if [ $MAKE_BS = YES ]; then
-        obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
-    fi
+    obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"`
 
     if [ $MAKE_SL = YES ]; then
         echo $ngx_n " $obj" $ngx_c                                >> $MAKEFILE
@@ -189,22 +157,18 @@ done
 
 # nginx build ngx_modules.c and libs
 
-obj=`echo $NGX_MODULES_C | sed -e "s/\.c\$/.$OBJEXT/"`
-libs=`echo $CORE_LIBS | sed -e "s/\.c\$/.$OBJEXT/"`
-src=$NGX_MODULES_C
-if [ $MAKE_BS = YES ]; then
-    obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
-    src=`echo $src | sed -e "s/\//\\\\\\/g"`
-    libs=`echo $libs | sed -e "s/\//\\\\\\/g"`
-fi
+obj=`echo $NGX_MODULES_C | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\//$DIRSEP/g"`
+src=`echo $NGX_MODULES_C | sed -e "s/\//$DIRSEP/g"`
+libs=`echo $CORE_LIBS | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\//$DIRSEP/g"`
+link=`echo $CORE_LINK | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\//$DIRSEP/g"`
 
 if [ $MAKE_SL = YES ]; then
     echo " $obj $libs $CORE_LINK"                                 >> $MAKEFILE
     echo                                                          >> $MAKEFILE
 else
     echo "     $obj \\"                                          >> $MAKEFILE
-    echo "     $CORE_LIBS \\"                                    >> $MAKEFILE
-    echo "     $CORE_LINK"                                       >> $MAKEFILE
+    echo "     $libs \\"                                         >> $MAKEFILE
+    echo "     $link"                                            >> $MAKEFILE
     echo                                                          >> $MAKEFILE
 fi
 
@@ -221,13 +185,13 @@ fi
 
 if [ $MAKE_SL = YES ]; then
     echo "$obj: $NGX_MODULES_C $deps"                             >> $MAKEFILE
-    echo $ngx_n "      \$(CC) $COMPILEONLY $args" $ngx_c         >> $MAKEFILE
+    echo $ngx_n "      \$(CC) $COMPOPT $args" $ngx_c             >> $MAKEFILE
     echo " $OBJOUT$obj $src"                                      >> $MAKEFILE
     echo                                                          >> $MAKEFILE
 else
     echo "$obj: \\"                                               >> $MAKEFILE
     echo "     $NGX_MODULES_C $deps"                             >> $MAKEFILE
-    echo "     \$(CC) $COMPILEONLY $args \\"                     >> $MAKEFILE
+    echo "     \$(CC) $COMPOPT $args \\"                         >> $MAKEFILE
     echo "             $OBJOUT$obj \\"                           >> $MAKEFILE
     echo "             $src"                                     >> $MAKEFILE
     echo                                                          >> $MAKEFILE
@@ -239,21 +203,17 @@ fi
 for src in $CORE_SRCS
 do
     obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"`
-    obj="$OBJS/$obj"
-
-    if [ $MAKE_BS = YES ]; then
-        obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
-        src=`echo $src | sed -e "s/\//\\\\\\/g"`
-    fi
+    obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"`
+    src=`echo $src | sed -e "s/\//$DIRSEP/g"`
 
     if [ $MAKE_SL = YES ]; then
         echo "$obj: $src $deps"                                   >> $MAKEFILE
-        echo " \$(CC) $COMPILEONLY $args $OBJOUT$obj $src"       >> $MAKEFILE
+        echo " \$(CC) $COMPOPT $args $OBJOUT$obj $src"           >> $MAKEFILE
         echo                                                      >> $MAKEFILE
     else
         echo "$obj: \\"                                           >> $MAKEFILE
         echo " $src $deps"                                       >> $MAKEFILE
-        echo " \$(CC) $COMPILEONLY $args \\"                     >> $MAKEFILE
+        echo " \$(CC) $COMPOPT $args \\"                         >> $MAKEFILE
         echo "         $OBJOUT$obj \\"                           >> $MAKEFILE
         echo "         $src"                                     >> $MAKEFILE
         echo                                                      >> $MAKEFILE
@@ -274,21 +234,17 @@ fi
 for src in $HTTP_SRCS
 do
     obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"`
-    obj="$OBJS/$obj"
-
-    if [ $MAKE_BS = YES ]; then
-        obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
-        src=`echo $src | sed -e "s/\//\\\\\\/g"`
-    fi
+    obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"`
+    src=`echo $src | sed -e "s/\//$DIRSEP/g"`
 
     if [ $MAKE_SL = YES ]; then
         echo "$obj: $src $deps"                                   >> $MAKEFILE
-        echo " \$(CC) $COMPILEONLY $args $OBJOUT$obj $src"       >> $MAKEFILE
+        echo " \$(CC) $COMPOPT $args $OBJOUT$obj $src"           >> $MAKEFILE
         echo                                                      >> $MAKEFILE
     else
         echo "$obj: \\"                                           >> $MAKEFILE
         echo " $src $deps"                                       >> $MAKEFILE
-        echo " \$(CC) $COMPILEONLY $args \\"                     >> $MAKEFILE
+        echo " \$(CC) $COMPOPT $args \\"                         >> $MAKEFILE
         echo "         $OBJOUT$obj \\"                           >> $MAKEFILE
         echo "         $src"                                     >> $MAKEFILE
         echo                                                      >> $MAKEFILE
@@ -302,13 +258,10 @@ if [ $PCH != NO ]; then
     echo "#include <ngx_config.h>" > $OBJS/pch.c
 
     pch="$PCH: src/core/ngx_config.h $OS_CONFIG $OBJS/ngx_auto_config.h"
-    src="\$(CC) \$(CFLAGS) $BUILDPCH $COMPILEONLY \$(ALL_INCS)"
+    pch=`echo $pch | sed -e "s/\//$DIRSEP/g"`
+    src="\$(CC) \$(CFLAGS) $BUILDPCH $COMPOPT \$(ALL_INCS)"
     src="$src $OBJOUT$OBJS/pch.obj $OBJS/pch.c"
-
-    if [ $MAKE_BS = YES ]; then
-        pch=`echo $pch | sed -e "s/\//\\\\\\/g"`
-        src=`echo $src | sed -e "s/\//\\\\\\/g"`
-    fi
+    src=`echo $src | sed -e "s/\//$DIRSEP/g"`
 
     echo "$pch"                                                   >> $MAKEFILE
     echo "     $src"                                             >> $MAKEFILE
index f8e43700d47d7234f98a31d9084655be5841b260..9aa9da0b53d652dcc99de390e0d6c9df6dc1305a 100644 (file)
@@ -1,7 +1,7 @@
 
 CORE_MODULES="ngx_core_module ngx_errlog_module"
 
-CORE_INCS="-I src/core"
+CORE_INCS="src/core"
 
 CORE_DEPS="src/core/nginx.h \
             src/core/ngx_config.h \
@@ -48,7 +48,7 @@ REGEX_SRCS=src/core/ngx_regex.c
 
 EVENT_MODULES="ngx_events_module ngx_event_core_module"
 
-EVENT_INCS="-I src/event -I src/event/modules"
+EVENT_INCS="src/event src/event/modules"
 
 EVENT_DEPS="src/event/ngx_event.h \
             src/event/ngx_event_timer.h \
@@ -93,7 +93,7 @@ AIO_SRCS="src/event/modules/ngx_aio_module.c \
           src/os/unix/ngx_aio_write_chain.c"
 
 
-UNIX_INCS="$CORE_INCS $EVENT_INCS -I src/os/unix"
+UNIX_INCS="$CORE_INCS $EVENT_INCS src/os/unix"
 
 UNIX_DEPS="$CORE_DEPS $EVENT_DEPS \
             src/os/unix/ngx_time.h \
@@ -135,7 +135,7 @@ SOLARIS_SRCS=src/os/unix/ngx_solaris_init.c
 SOLARIS_SENDFILEV_SRCS=src/os/unix/ngx_solaris_sendfilev_chain.c
 
 
-WIN32_INCS="$CORE_INCS $EVENT_INCS -I src/os/win32"
+WIN32_INCS="$CORE_INCS $EVENT_INCS src/os/win32"
 
 WIN32_DEPS="$CORE_DEPS $EVENT_DEPS \
             src/os/win32/ngx_win32_config.h \
@@ -182,7 +182,7 @@ HTTP_NOT_MODIFIED_FILTER_MODULE=ngx_http_not_modified_filter_module
 HTTP_STATIC_MODULE=ngx_http_static_module
 HTTP_INDEX_MODULE=ngx_http_index_module
 
-HTTP_INCS="-I src/http -I src/http/modules"
+HTTP_INCS="src/http src/http/modules"
 
 HTTP_DEPS="src/http/ngx_http.h \
             src/http/ngx_http_request.h \
@@ -232,7 +232,7 @@ HTTP_SSI_SRCS=src/http/modules/ngx_http_ssi_filter.c
 
 
 HTTP_PROXY_MODULE=ngx_http_proxy_module
-HTTP_PROXY_INCS="-I src/http/modules/proxy"
+HTTP_PROXY_INCS="src/http/modules/proxy"
 HTTP_PROXY_DEPS=src/http/modules/proxy/ngx_http_proxy_handler.h
 HTTP_PROXY_SRCS="src/http/modules/proxy/ngx_http_proxy_handler.c \
             src/http/modules/proxy/ngx_http_proxy_upstream.c \
index 1cbd4c8c8b2d7dba478a1453627757cc64e54708..de583fc09a7a33958ed4b1e81c849b038da16a97 100644 (file)
@@ -90,8 +90,6 @@ void ngx_destroy_pool(ngx_pool_t *pool)
             break;
         }
     }
-
-    pool = NULL;
 }
 
 
index 17362aa3281521a215b543ff75c27236a64ab9b0..311ef8892ff565525053badf0ef27972c1d4b8a9 100644 (file)
@@ -21,13 +21,14 @@ static ngx_inline uint32_t ngx_atomic_inc(ngx_atomic_t *value)
 {
     uint32_t  old;
 
+    old = 1;
+
     __asm__ volatile (
 
-    "   movl   $1, %0;   "
         NGX_SMP_LOCK
     "   xaddl  %0, %1;   "
 
-    : "=a" (old) : "m" (*value));
+    : "=q" (old) : "m" (*value));
 
     return old;
 }
@@ -37,13 +38,14 @@ static ngx_inline uint32_t ngx_atomic_dec(ngx_atomic_t *value)
 {
     uint32_t  old;
 
+    old = (uint32_t) -1;
+
     __asm__ volatile (
 
-    "   movl   $-1, %0;  "
         NGX_SMP_LOCK
     "   xaddl  %0, %1;   "
 
-    : "=a" (old) : "m" (*value));
+    : "=q" (old) : "m" (*value));
 
     return old;
 }
@@ -62,7 +64,7 @@ static ngx_inline uint32_t ngx_atomic_cmp_set(ngx_atomic_t *lock,
     "   setz      %%al;     "
     "   movzbl    %%al, %0; "
 
-    : "=a" (res) : "m" (*lock), "a" (old), "q" (set));
+    : "+a" (res) : "m" (*lock), "a" (old), "q" (set));
 
     return res;
 }
index 30a3e5f945e487acef1dc1a2cd97323b6b6b82dc..63918673c66341ac8f18ef6e931773f3e08eaa85 100644 (file)
@@ -556,7 +556,7 @@ void ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,
                             " (%d: ", err);
         len += ngx_strerror_r(err, errstr + len, sizeof(errstr) - len - 1);
         errstr[len++] = ')';
-        errstr[len++] = '\0';
+        errstr[len] = '\0';
     }
 
     ngx_log_error(level, cf->log, 0, "%s in %s:%d",
index e56edc9ace8bea59e2d97ff4ca24ace8a1db8635..eb3cacbe8f301b5e9a675d04fc226428670edb3c 100644 (file)
@@ -9,16 +9,22 @@
 #endif
 
 
-#if defined __FreeBSD__
+#if defined __DragonFly__ && !defined(__FreeBSD__)
+#define __FreeBSD__        4
+#define __FreeBSD_version  480101
+#endif
+
+
+#if defined (__FreeBSD__)
 #include <ngx_freebsd_config.h>
 
 
-#elif defined __linux__
+#elif defined (__linux__)
 #include <ngx_linux_config.h>
 
 
        /* Solaris */
-#elif defined(sun) && (defined(__svr4__) || defined(__SVR4))
+#elif defined (sun) && (defined (__svr4__) || defined (__SVR4))
 #include <ngx_solaris_config.h>
 
 
index b23fac61e772bd22cb21b8ec8a07c32f32ff2562..4a6ad2ef3afa4af00196cab898fba52b70e7541a 100644 (file)
@@ -171,7 +171,12 @@ void ngx_gmtime(time_t t, ngx_tm_t *tp)
     mon += 2;
 
     if (yday >= 306) {
-        yday -= 306;
+        /*
+         * yday is not used in Win32 SYSTEMTIME
+         *
+         * yday -= 306;
+         */
+
         year++;
         mon -= 12;
 
@@ -194,12 +199,16 @@ void ngx_gmtime(time_t t, ngx_tm_t *tp)
             }
         }
 
-    } else {
-        yday += 31 + 28;
-
-        if ((year % 4 == 0) && (year % 100 || (year % 400 == 0))) {
-             yday++;
-        }
+/*
+ *  yday is not used in Win32 SYSTEMTIME
+ *
+ *  } else {
+ *      yday += 31 + 28;
+ *
+ *      if ((year % 4 == 0) && (year % 100 || (year % 400 == 0))) {
+ *           yday++;
+ *      }
+ */
     }
 
     tp->ngx_tm_sec = (ngx_tm_sec_t) sec;
index f2244264dfa2ecb5c59e6024a17e6baf057e29d9..5a7357c5ea6456118f3516e523614b37602e4bee 100644 (file)
@@ -12,9 +12,10 @@ static void ngx_event_busy_lock_posted_handler(ngx_event_t *ev);
 
 /*
  * NGX_OK:     the busy lock is held
- * NGX_BUSY:   there are many the busy locks or many the waiting locks
  * NGX_AGAIN:  the all busy locks are held but we will wait the specified time
- * NGX_ERROR:  there was error while the mutex locking
+ * NGX_BUSY:   ctx->timer == 0: there are many the busy locks
+ *             ctx->timer != 0: there are many the waiting locks
+ * NGX_ERROR:  an error occured while the mutex locking
  */
 
 ngx_int_t ngx_event_busy_lock(ngx_event_busy_lock_t *bl,
index 68c9574083a303205c61504a229e6fe84d730a8d..6bc11a25ddd3e70fae9463bc2b444e3edc272ccd 100644 (file)
@@ -46,7 +46,9 @@ static char  connection_close_header[] = "Connection: close" CRLF;
 int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p)
 {
     int                         rc;
+    ngx_temp_file_t            *tf;
     ngx_http_request_t         *r;
+    ngx_http_request_body_t    *rb;
     ngx_http_proxy_upstream_t  *u;
 
     r = p->request;
@@ -63,29 +65,40 @@ int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p)
 
     u->method = r->method;
 
+    if (!(rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)))) {
+        return NGX_HTTP_INTERNAL_SERVER_ERROR;
+    }
+    r->request_body = rb;
+
     if (r->headers_in.content_length_n > 0) {
-        if (!(r->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)))) {
+
+        if (!(tf = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)))) {
             return NGX_HTTP_INTERNAL_SERVER_ERROR;
         }
 
-        r->temp_file->file.fd = NGX_INVALID_FILE;
-        r->temp_file->file.log = r->connection->log;
-        r->temp_file->path = p->lcf->temp_path;
-        r->temp_file->pool = r->pool;
-        r->temp_file->warn = "a client request body is buffered "
-                             "to a temporary file";
-        /* r->temp_file->persistent = 0; */
+        tf->file.fd = NGX_INVALID_FILE;
+        tf->file.log = r->connection->log;
+        tf->path = p->lcf->temp_path;
+        tf->pool = r->pool;
+        tf->warn = "a client request body is buffered to a temporary file";
+        /* tf->persistent = 0; */
 
-        r->request_body_handler = ngx_http_proxy_init_upstream;
-        r->data = p;
+        rb->buf_size = p->lcf->request_buffer_size;
+        rb->handler = ngx_http_proxy_init_upstream;
+        rb->data = p;
+        /* rb->bufs = NULL; */
+        /* rb->buf = NULL; */
+        /* rb->rest = 0; */
 
-        rc = ngx_http_read_client_request_body(r, p->lcf->request_buffer_size);
+        rb->temp_file = tf;
+
+        rc = ngx_http_read_client_request_body(r);
 
         if (rc == NGX_AGAIN) {
             return NGX_DONE;
         }
 
-        if (rc >= NGX_HTTP_SPECIAL_RESPONSE || rc == NGX_ERROR) {
+        if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
             return rc;
         }
     }
@@ -118,7 +131,7 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p)
           + 2;                          /* 2 is for "\r\n" at the header end */
 
 
-    if (p->lcf->preserve_host) {
+    if (p->lcf->preserve_host && r->headers_in.host) {
         len += sizeof(host_header) - 1
                + r->headers_in.host_name_len
                + 1                                           /* 1 is for ":" */
@@ -339,11 +352,11 @@ static void ngx_http_proxy_init_upstream(void *data)
         return;
     }
 
-    if (r->request_hunks) {
-        cl->next = r->request_hunks;
+    if (r->request_body->bufs) {
+        cl->next = r->request_body->bufs;
     }
 
-    r->request_hunks = cl;
+    r->request_body->bufs = cl;
 
     if (!(ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_proxy_log_ctx_t)))) {
         ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -380,7 +393,11 @@ static void ngx_http_proxy_init_upstream(void *data)
     output->filter_ctx = writer;
     writer->pool = r->pool;
 
+#if 0
+    if (p->lcf->busy_lock && p->busy_lock == NULL) {
+#else
     if (p->lcf->busy_lock && !p->busy_locked) {
+#endif
         ngx_http_proxy_upstream_busy_lock(p);
     } else {
         ngx_http_proxy_connect(p);
@@ -393,17 +410,17 @@ static void ngx_http_proxy_reinit_upstream(ngx_http_proxy_ctx_t *p)
     ngx_chain_t             *cl;
     ngx_output_chain_ctx_t  *output;
 
-    output = p->upstream->output_chain_ctx;
-
     /* reinit the request chain */
 
-    for (cl = p->request->request_hunks; cl; cl = cl->next) {
+    for (cl = p->request->request_body->bufs; cl; cl = cl->next) {
         cl->hunk->pos = cl->hunk->start;
         cl->hunk->file_pos = 0;
     }
 
     /* reinit the ngx_output_chain() context */
 
+    output = p->upstream->output_chain_ctx;
+
     output->hunk = NULL;
     output->in = NULL;
     output->free = NULL;
@@ -434,6 +451,56 @@ static void ngx_http_proxy_reinit_upstream(ngx_http_proxy_ctx_t *p)
 }
 
 
+#if 0
+
+void ngx_http_proxy_upstream_busy_lock(ngx_http_proxy_ctx_t *p)
+{
+    ngx_int_t  rc;
+
+    rc = ngx_event_busy_lock(p->lcf->busy_lock, p->busy_lock);
+
+    if (rc == NGX_AGAIN) {
+        return;
+    }
+
+    if (rc == NGX_OK) {
+        ngx_http_proxy_connect(p);
+        return;
+    }
+
+    if (rc == NGX_ERROR) {
+        p->state->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
+        ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
+        return;
+    }
+
+    /* rc == NGX_BUSY */
+
+#if (NGX_HTTP_CACHE)
+
+    if (p->busy_lock->timer) {
+        ft_type = NGX_HTTP_PROXY_FT_MAX_WAITING;
+    } else {
+        ft_type = NGX_HTTP_PROXY_FT_BUSY_LOCK;
+    }
+
+    if (p->stale && (p->lcf->use_stale & ft_type)) {
+        ngx_http_proxy_finalize_request(p,
+                                        ngx_http_proxy_send_cached_response(p));
+        return;
+    }
+
+#endif
+
+    p->state->status = NGX_HTTP_SERVICE_UNAVAILABLE;
+    ngx_http_proxy_finalize_request(p, NGX_HTTP_SERVICE_UNAVAILABLE);
+}
+
+#endif
+
+
+#if 1
+
 void ngx_http_proxy_upstream_busy_lock(ngx_http_proxy_ctx_t *p)
 {
     ngx_int_t  rc;
@@ -481,6 +548,8 @@ void ngx_http_proxy_upstream_busy_lock(ngx_http_proxy_ctx_t *p)
     ngx_http_proxy_finalize_request(p, NGX_HTTP_SERVICE_UNAVAILABLE);
 }
 
+#endif
+
 
 static void ngx_http_proxy_connect(ngx_http_proxy_ctx_t *p)
 {
@@ -530,17 +599,17 @@ static void ngx_http_proxy_connect(ngx_http_proxy_ctx_t *p)
         ngx_http_proxy_reinit_upstream(p);
     }
 
-    if (r->request_body_hunk) {
+    if (r->request_body->buf) {
         if (!(output->free = ngx_alloc_chain_link(r->pool))) {
             ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
             return;
         }
 
-        output->free->hunk = r->request_body_hunk;
+        output->free->hunk = r->request_body->buf;
         output->free->next = NULL;
         output->hunks = 1;
 
-        r->request_body_hunk->pos = r->request_body_hunk->start;
+        r->request_body->buf->pos = r->request_body->buf->start;
     }
 
     p->request_sent = 0;
@@ -590,7 +659,8 @@ static void ngx_http_proxy_send_request(ngx_http_proxy_ctx_t *p)
     p->action = "sending request to upstream";
 
     rc = ngx_output_chain(p->upstream->output_chain_ctx,
-                          p->request_sent ? NULL : p->request->request_hunks);
+                          p->request_sent ? NULL:
+                                            p->request->request_body->bufs);
 
     if (rc == NGX_ERROR) {
         ngx_http_proxy_next_upstream(p, NGX_HTTP_PROXY_FT_ERROR);
index ec2778a4ce2a736c86261803994ef524630632d3..3e0385b79ee1f0944e40d030f053f1fd801f6f33 100644 (file)
@@ -76,8 +76,7 @@ void ngx_http_close_request(ngx_http_request_t *r, int error);
 void ngx_http_close_connection(ngx_connection_t *c);
 
 
-ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r,
-                                            size_t request_buffer_size);
+ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r);
 
 int ngx_http_send_header(ngx_http_request_t *r);
 int ngx_http_special_response_handler(ngx_http_request_t *r, int error);
index f3f47f8e31b74694850a0a07327416066e47d617..48b7ba4982bc954f72e6c64762016f7b31e36b38 100644 (file)
@@ -422,14 +422,19 @@ static void ngx_http_run_phases(ngx_http_request_t *r)
 int ngx_http_find_location_config(ngx_http_request_t *r)
 {
     int                           rc;
-    ngx_uint_t                    i, exact;
+    ngx_uint_t                    i;
     ngx_str_t                     *auto_redirect;
     ngx_http_core_loc_conf_t      *clcf, **clcfp;
     ngx_http_core_srv_conf_t      *cscf;
+#if (HAVE_PCRE)
+    ngx_uint_t                    exact;
+#endif
 
     cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
     auto_redirect = NULL;
+#if (HAVE_PCRE)
     exact = 0;
+#endif
 
     clcfp = cscf->locations.elts;
     for (i = 0; i < cscf->locations.nelts; i++) {
@@ -473,7 +478,9 @@ int ngx_http_find_location_config(ngx_http_request_t *r)
             r->connection->log->log_level = clcf->err_log->log_level;
 
             if (clcfp[i]->exact_match && r->uri.len == clcfp[i]->name.len) {
+#if (HAVE_PCRE)
                 exact = 1;
+#endif
                 break;
             }
         }
@@ -751,14 +758,12 @@ static int ngx_http_core_init(ngx_cycle_t *cycle)
 {
 #if 0
     ngx_http_handler_pt        *h;
-#endif
     ngx_http_conf_ctx_t        *ctx;
     ngx_http_core_main_conf_t  *cmcf;
 
     ctx = (ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index];
     cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
 
-#if 0
     ngx_test_null(h, ngx_push_array(
                              &cmcf->phases[NGX_HTTP_TRANSLATE_PHASE].handlers),
                   NGX_ERROR);
@@ -775,7 +780,7 @@ static char *ngx_server_block(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
     char                        *rv;
     ngx_http_module_t           *module;
     ngx_conf_t                   pcf;
-    ngx_http_conf_ctx_t         *ctx, *hctx, *pctx;
+    ngx_http_conf_ctx_t         *ctx, *hctx;
     ngx_http_core_main_conf_t   *cmcf;
     ngx_http_core_srv_conf_t    *cscf, **cscfp;
 
@@ -830,7 +835,9 @@ static char *ngx_server_block(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
     /* parse inside server{} */
 
     pcf = *cf;
+#if 0
     pctx = cf->ctx;
+#endif
     cf->ctx = ctx;
     cf->cmd_type = NGX_HTTP_SRV_CONF;
     rv = ngx_conf_parse(cf, NULL);
index e86034eccf6f993ba9f2daa4b94e94e289cdb030..555d55593422fd9b0801dcf21a5ac48e1d0d3c0c 100644 (file)
@@ -116,18 +116,6 @@ typedef struct {
 } ngx_http_headers_in_t;
 
 
-typedef struct {
-    ngx_chain_t       chain[4];
-    ngx_hunk_t       *header_out;
-    ngx_hunk_t       *hunk;
-    ngx_hunk_t       *file_hunk;
-    ngx_file_t        temp_file;
-    ngx_path_t       *temp_path;
-    off_t             offset;
-    u_char           *header_in_pos;
-} ngx_http_request_body_t;
-
-
 typedef struct {
     off_t             start;
     off_t             end;
@@ -138,7 +126,7 @@ typedef struct {
 typedef struct {
     ngx_table_t       headers;   /* it must be first field */
 
-    int               status;
+    ngx_uint_t        status;
     ngx_str_t         status_line;
 
     ngx_table_elt_t  *server;
@@ -161,6 +149,17 @@ typedef struct {
 } ngx_http_headers_out_t;
 
 
+typedef struct {
+    ngx_temp_file_t   *temp_file;
+    ngx_chain_t       *bufs;
+    ngx_hunk_t        *buf;
+    size_t             rest;
+    size_t             buf_size;
+    void             (*handler) (void *data); 
+    void              *data;
+} ngx_http_request_body_t;
+
+
 struct ngx_http_cleanup_s {
     union {
         struct {
@@ -191,15 +190,25 @@ struct ngx_http_request_s {
 
     ngx_http_cache_t         *cache;
 
-    ngx_file_t           file;
+    ngx_file_t                file;
 
     ngx_pool_t               *pool;
     ngx_hunk_t               *header_in;
-    ngx_http_request_body_t  *request_body;
 
     ngx_http_headers_in_t     headers_in;
     ngx_http_headers_out_t    headers_out;
 
+    ngx_http_request_body_t  *request_body;
+
+#if 0
+    ngx_temp_file_t     *temp_file;
+    ngx_chain_t         *request_hunks;
+    ngx_hunk_t          *request_body_hunk;
+    size_t               remaining_body_len;
+    void               (*request_body_handler) (void *data); 
+    void                *data;
+#endif
+
     time_t               lingering_time;
 
     ngx_uint_t           method;
@@ -225,15 +234,9 @@ struct ngx_http_request_s {
     ngx_int_t            phase_handler;
     ngx_http_handler_pt  content_handler;
 
-    ngx_temp_file_t     *temp_file;
-    ngx_chain_t         *request_hunks;
-    ngx_hunk_t          *request_body_hunk;
-    size_t               remaining_body_len;
-    void               (*request_body_handler) (void *data); 
-    void                *data;
-
     ngx_array_t          cleanup;
 
+    /* used to learn the Apache compatible response length without a header */
     size_t               header_size;
 
     u_char              *discarded_buffer;
index f6be9cf501d27ff4b40847ef2f46f3baf5c145ef..c54674eb9a7cc9e79cdd4f8d96b64d54752b4dfd 100644 (file)
@@ -9,26 +9,28 @@ static void ngx_http_read_client_request_body_handler(ngx_event_t *rev);
 static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r);
 
 
-ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r,
-                                            size_t request_buffer_size)
+ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r)
 {
     ssize_t       size;
     ngx_hunk_t   *h;
     ngx_chain_t  *cl;
 
+
     size = r->header_in->last - r->header_in->pos;
 
     if (size) {
 
         /* there is the pre-read part of the request body */
 
-        ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR);
+        ngx_test_null(h, ngx_calloc_hunk(r->pool),
+                      NGX_HTTP_INTERNAL_SERVER_ERROR);
 
         h->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_TEMP;
         h->start = h->pos = r->header_in->pos;
         h->end = h->last = r->header_in->last;
 
-        ngx_alloc_link_and_set_hunk(r->request_hunks, h, r->pool, NGX_ERROR);
+        ngx_alloc_link_and_set_hunk(r->request_body->bufs, h, r->pool,
+                                    NGX_HTTP_INTERNAL_SERVER_ERROR);
 
         if (size >= r->headers_in.content_length_n) {
 
@@ -42,28 +44,28 @@ ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r,
     }
 
 
-    r->remaining_body_len = r->headers_in.content_length_n - size;
+    r->request_body->rest = r->headers_in.content_length_n - size;
 
-    if (r->remaining_body_len
-                            < request_buffer_size + (request_buffer_size >> 2))
+    if (r->request_body->rest
+                < r->request_body->buf_size + (r->request_body->buf_size >> 2))
     {
-        size = r->remaining_body_len;
+        size = r->request_body->rest;
 
     } else {
-        size = request_buffer_size;
+        size = r->request_body->buf_size;
     }
 
-    ngx_test_null(r->request_body_hunk, ngx_create_temp_hunk(r->pool, size),
-                  NGX_ERROR);
+    ngx_test_null(r->request_body->buf, ngx_create_temp_hunk(r->pool, size),
+                  NGX_HTTP_INTERNAL_SERVER_ERROR);
 
-    ngx_alloc_link_and_set_hunk(cl, r->request_body_hunk, r->pool,
-                                NGX_ERROR);
+    ngx_alloc_link_and_set_hunk(cl, r->request_body->buf, r->pool,
+                                NGX_HTTP_INTERNAL_SERVER_ERROR);
 
-    if (r->request_hunks) {
-        r->request_hunks->next = cl;
+    if (r->request_body->bufs) {
+        r->request_body->bufs->next = cl;
 
     } else {
-        r->request_hunks = cl;
+        r->request_body->bufs = cl;
     }
 
     r->connection->read->event_handler =
@@ -104,10 +106,10 @@ static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r)
                    "http read client request body");
 
     for ( ;; ) {
-        if (r->request_body_hunk->last == r->request_body_hunk->end) {
-            n = ngx_write_chain_to_temp_file(r->temp_file,
-                               r->request_hunks->next ? r->request_hunks->next:
-                                                        r->request_hunks);
+        if (r->request_body->buf->last == r->request_body->buf->end) {
+            n = ngx_write_chain_to_temp_file(r->request_body->temp_file,
+                     r->request_body->bufs->next ? r->request_body->bufs->next:
+                                                   r->request_body->bufs);
 
             /* TODO: n == 0 or not complete and level event */
 
@@ -115,19 +117,19 @@ static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r)
                 return NGX_HTTP_INTERNAL_SERVER_ERROR;
             }
 
-            r->temp_file->offset += n;
+            r->request_body->temp_file->offset += n;
 
-            r->request_body_hunk->pos = r->request_body_hunk->start;
-            r->request_body_hunk->last = r->request_body_hunk->start;
+            r->request_body->buf->pos = r->request_body->buf->start;
+            r->request_body->buf->last = r->request_body->buf->start;
         }
 
-        size = r->request_body_hunk->end - r->request_body_hunk->last;
+        size = r->request_body->buf->end - r->request_body->buf->last;
 
-        if (size > r->remaining_body_len) {
-            size = r->remaining_body_len;
+        if (size > r->request_body->rest) {
+            size = r->request_body->rest;
         }
 
-        n = ngx_recv(c, r->request_body_hunk->last, size);
+        n = ngx_recv(c, r->request_body->buf->last, size);
 
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
                        "http client request body recv " SIZE_T_FMT, n);
@@ -153,32 +155,32 @@ static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r)
             return NGX_HTTP_BAD_REQUEST;
         }
 
-        r->request_body_hunk->last += n;
-        r->remaining_body_len -= n;
+        r->request_body->buf->last += n;
+        r->request_body->rest -= n;
 
-        if (r->remaining_body_len == 0) {
+        if (r->request_body->rest == 0) {
             break;
         }
 
-        if (r->request_body_hunk->last < r->request_body_hunk->end) {
+        if (r->request_body->buf->last < r->request_body->buf->end) {
             break;
         }
     }
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                   "http client request body left " SIZE_T_FMT,
-                   r->remaining_body_len);
+                   "http client request body rest " SIZE_T_FMT,
+                   r->request_body->rest);
 
-    if (r->remaining_body_len) {
+    if (r->request_body->rest) {
         return NGX_AGAIN;
     }
 
-    if (r->temp_file->file.fd != NGX_INVALID_FILE) {
+    if (r->request_body->temp_file->file.fd != NGX_INVALID_FILE) {
 
         /* save the last part */
-        n = ngx_write_chain_to_temp_file(r->temp_file,
-                               r->request_hunks->next ? r->request_hunks->next:
-                                                        r->request_hunks);
+        n = ngx_write_chain_to_temp_file(r->request_body->temp_file,
+                     r->request_body->bufs->next ? r->request_body->bufs->next:
+                                                   r->request_body->bufs);
 
         /* TODO: n == 0 or not complete and level event */
 
@@ -193,18 +195,18 @@ static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r)
 
         h->type = NGX_HUNK_FILE;
         h->file_pos = 0;
-        h->file_last = r->temp_file->file.offset;
-        h->file = &r->temp_file->file;
+        h->file_last = r->request_body->temp_file->file.offset;
+        h->file = &r->request_body->temp_file->file;
 
-        if (r->request_hunks->next) {
-            r->request_hunks->next->hunk = h;
+        if (r->request_body->bufs->next) {
+            r->request_body->bufs->next->hunk = h;
 
         } else {
-            r->request_hunks->hunk = h;
+            r->request_body->bufs->hunk = h;
         }
     }
 
-    r->request_body_handler(r->data);
+    r->request_body->handler(r->request_body->data);
 
     return NGX_OK;
 }
index 0f02fba8ba2e431472b22e067af27732254ac166..eb66cf067aad041e6d0b6c5289fadfa82f202ba4 100644 (file)
@@ -106,9 +106,16 @@ int ngx_os_init(ngx_log_t *log)
 
     version = ngx_freebsd_kern_osreldate;
 
+#ifdef __DragonFly_version
+    ngx_log_error(NGX_LOG_INFO, log, 0,
+                  "kern.osreldate: %d, built on %d",
+                  version, __DragonFly_version);
+#else
     ngx_log_error(NGX_LOG_INFO, log, 0,
                   "kern.osreldate: %d, built on %d",
                   version, __FreeBSD_version);
+#endif
+
 
 
 #if (HAVE_SENDFILE)
index fb2898d6fc24c6b6264f058e96d435d55af2860c..b8872dfc308783f8bbb159e03eec51ed3d3b3d8e 100644 (file)
@@ -234,6 +234,9 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
         } else {
             rc = writev(c->fd, header.elts, header.nelts);
 
+            ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
+                           "writev: %d of " SIZE_T_FMT, rc, hsize);
+
             if (rc == -1) {
                 err = ngx_errno;
 
@@ -253,9 +256,6 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
             }
 
             sent = rc > 0 ? rc : 0;
-
-            ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
-                           "writev: " OFF_T_FMT, sent);
         }
 
         c->sent += sent;
index a600952ea7507e51bb0f6542ca944e3df5bd6064..cab3321e58485518044fd6d855e14bf5c77340d3 100644 (file)
 #pragma disable_message(202)
 #endif
 
+
+#ifdef __BORLANDC__
+/* the end of the precompiled headers */
+#pragma hdrstop
+
+#pragma warn -8027
+#pragma warn -8057
+#pragma warn -8060
+
+/* STUB */
+#pragma warn -8004
+#pragma warn -8008
+#pragma warn -8065
+#pragma warn -8066
+#pragma warn -8075
+#endif
+
+
 #include <ngx_auto_config.h>