nginx-0.1.19-RELEASE import

    *) Bugfix: now, if request contains the zero, then the 404 error is
       returned for the local requests.

    *) Bugfix: nginx could not be built on NetBSD 2.0.

    *) Bugfix: the timeout may occur while reading of the the client
       request body via SSL connections.
diff --git a/auto/make b/auto/make
index 9b6e4be..f304ac7 100644
--- a/auto/make
+++ b/auto/make
@@ -32,7 +32,7 @@
 fi
 
 
-# ALL_INCS, required by OpenWatcom C precompiled headers
+# ALL_INCS, required by the addons and by OpenWatcom C precompiled headers
 
 ngx_incs=`echo $CORE_INCS $NGX_OBJS $HTTP_INCS $IMAP_INCS\
     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
@@ -120,10 +120,32 @@
 fi
 
 
+if test -n "$NGX_ADDON_SRCS"; then
+
+cat << END                                                >> $NGX_MAKEFILE
+
+ADDON_DEPS = \$(CORE_DPES) $NGX_ADDON_DEPS
+
+END
+
+fi
+
+
 # nginx
 
 ngx_all_srcs=`echo $ngx_all_srcs | sed -e "s/\//$ngx_regex_dirsep/g"`
-ngx_modules_c=`echo $NGX_MODULES_C | sed -e "s/\//$ngx_regex_dirsep/g"`
+
+for ngx_src in $NGX_ADDON_SRCS
+do
+    ngx_obj="addon/`basename \`dirname $ngx_src\``"
+
+    test -d $NGX_OBJS/$ngx_obj || mkdir -p $NGX_OBJS/$ngx_obj
+
+    ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
+        | sed -e "s/\//$ngx_regex_dirsep/g"`
+
+    ngx_all_srcs="$ngx_all_srcs $ngx_obj"
+done
 
 ngx_all_objs=`echo $ngx_all_srcs \
     | sed -e "s/\([^ ]*\.\)cpp/$NGX_OBJS\/\1$ngx_objext/g" \
@@ -131,6 +153,8 @@
           -e "s/\([^ ]*\.\)c/$NGX_OBJS\/\1$ngx_objext/g" \
           -e "s/\([^ ]*\.\)S/$NGX_OBJS\/\1$ngx_objext/g"`
 
+ngx_modules_c=`echo $NGX_MODULES_C | sed -e "s/\//$ngx_regex_dirsep/g"`
+
 ngx_modules_obj=`echo $ngx_modules_c | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
 
 
@@ -185,7 +209,6 @@
 
 for ngx_src in $CORE_SRCS
 do
-
     ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
     ngx_obj=`echo $ngx_src \
         | sed -e "s/^\(.*\.\)cpp$/$ngx_objs_dir\1$ngx_objext/g" \
@@ -215,7 +238,6 @@
 
     for ngx_src in $HTTP_SRCS
     do
-
         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
         ngx_obj=`echo $ngx_src \
             | sed -e "s/^\(.*\.\)cpp$/$ngx_objs_dir\1$ngx_objext/g" \
@@ -229,7 +251,6 @@
 	$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src
 
 END
-
      done
 
 fi
@@ -247,7 +268,6 @@
 
     for ngx_src in $IMAP_SRCS
     do
-
         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
         ngx_obj=`echo $ngx_src \
             | sed -e "s/^\(.*\.\)cpp$/$ngx_objs_dir\1$ngx_objext/g" \
@@ -261,7 +281,38 @@
 	$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src
 
 END
+     done
 
+fi
+
+
+# the addons sources
+
+if test -n "$NGX_ADDON_SRCS"; then
+
+    ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
+
+    for ngx_src in $NGX_ADDON_SRCS
+    do
+        ngx_obj="addon/`basename \`dirname $ngx_src\``"
+
+        ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
+            | sed -e "s/\//$ngx_regex_dirsep/g"`
+
+        ngx_obj=`echo $ngx_obj \
+            | sed -e "s/^\(.*\.\)cpp$/$ngx_objs_dir\1$ngx_objext/g" \
+                  -e "s/^\(.*\.\)cc$/$ngx_objs_dir\1$ngx_objext/g" \
+                  -e "s/^\(.*\.\)c$/$ngx_objs_dir\1$ngx_objext/g" \
+                  -e "s/^\(.*\.\)S$/$ngx_objs_dir\1$ngx_objext/g"`
+
+        ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
+
+        cat << END                                            >> $NGX_MAKEFILE
+
+$ngx_obj:	\$(ADDON_DEPS)$ngx_cont$ngx_src
+	$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src
+
+END
      done
 
 fi
diff --git a/auto/modules b/auto/modules
index 2c001e2..1fe9ac8 100644
--- a/auto/modules
+++ b/auto/modules
@@ -162,10 +162,32 @@
     HTTP_SRCS="$HTTP_SRCS src/http/modules/ngx_http_stub_status_module.c"
 fi
 
-if [ -r $NGX_OBJS/auto ]; then
-    . $NGX_OBJS/auto
+#if [ -r $NGX_OBJS/auto ]; then
+#    . $NGX_OBJS/auto
+#fi
+
+
+if test -n "$NGX_ADDONS"; then
+
+    echo configuring additional modules
+
+    for ngx_addon_dir in $NGX_ADDONS
+    do
+        echo "adding module in $ngx_addon_dir"
+
+        if test -f $ngx_addon_dir/config; then
+            . $ngx_addon_dir/config
+
+            echo " + $ngx_addon_name was configured"
+
+        else
+            echo "$0: error: no $ngx_addon_dir/config was found"
+            exit 1
+        fi
+    done
 fi
 
+
 modules="$CORE_MODULES $EVENT_MODULES"
 
 if [ $HTTP = YES ]; then
@@ -174,8 +196,11 @@
              $HTTP_COPY_FILTER_MODULE \
              $HTTP_RANGE_BODY_FILTER_MODULE \
              $HTTP_NOT_MODIFIED_FILTER_MODULE"
+
+    NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(HTTP_DEPS)"
 fi
 
+
 IMAP_MODULES=$IMAP_MODULE
 
 if [ $IMAP = YES ]; then
diff --git a/auto/options b/auto/options
index 7bb93ac..dd740fe 100644
--- a/auto/options
+++ b/auto/options
@@ -63,7 +63,7 @@
 
 IMAP=NO
 
-NGX_MODULES=
+NGX_ADDONS=
 
 USE_PCRE=NO
 PCRE=NONE
@@ -139,7 +139,7 @@
 
         --with-imap)                     IMAP=YES                   ;;
 
-        --with-module=*)                 NGX_MODULES="$NGX_MODULES $values" ;;
+        --add-module=*)                  NGX_ADDONS="$NGX_ADDONS $value" ;;
 
         --with-cc=*)                     CC="$value"                ;;
         --with-cpp=*)                    CPP="$value"               ;;
diff --git a/auto/os/conf b/auto/os/conf
index 71a143d..7375199 100644
--- a/auto/os/conf
+++ b/auto/os/conf
@@ -123,4 +123,15 @@
             . auto/feature
         fi
     fi
+
+    if [ NGX_SYSTEM != "NetBSD" ]; then
+
+        # NetBSD 2.0 incompatibly defines kevent.udata as "intptr_t"
+        cat << END >> $NGX_AUTO_CONFIG_H
+
+#define NGX_KQUEUE_UDATA_T  (void *)
+
+END
+
+     fi
 fi
diff --git a/auto/os/freebsd b/auto/os/freebsd
index e35b933..dfb547f 100644
--- a/auto/os/freebsd
+++ b/auto/os/freebsd
@@ -64,6 +64,7 @@
     EVENT_FOUND=YES
 fi
 
+
 NGX_KQUEUE_CHECKED=YES