nginx-0.1.3-RELEASE import

    *) Feature: the ngx_http_autoindex_module and the autoindex directive.

    *) Feature: the proxy_set_x_url directive.

    *) Bugfix: proxy module may get caught in an endless loop when sendfile
       is not used.
diff --git a/auto/configure b/auto/configure
index eb2fed0..b4a0b56 100755
--- a/auto/configure
+++ b/auto/configure
@@ -23,13 +23,14 @@
 
 . auto/cc/conf
 . auto/os/conf
-. auto/modules
-. auto/lib/conf
 
 if [ "$PLATFORM" != win32 ]; then
     . auto/threads
 fi
 
+. auto/modules
+. auto/lib/conf
+
 . auto/make
 . auto/lib/make
 . auto/install
diff --git a/auto/modules b/auto/modules
index 6c5111a..7d79205 100644
--- a/auto/modules
+++ b/auto/modules
@@ -87,7 +87,15 @@
     HTTP_SRCS="$HTTP_SRCS $HTTP_USERID_SRCS"
 fi
 
-HTTP_MODULES="$HTTP_MODULES $HTTP_STATIC_MODULE $HTTP_INDEX_MODULE"
+HTTP_MODULES="$HTTP_MODULES $HTTP_STATIC_MODULE"
+
+if [ $HTTP_AUTOINDEX = YES ]; then
+    have=NGX_HTTP_AUTOINDEX . auto/have
+    HTTP_MODULES="$HTTP_MODULES $HTTP_AUTOINDEX_MODULE"
+    HTTP_SRCS="$HTTP_SRCS $HTTP_AUTOINDEX_SRCS"
+fi
+
+HTTP_MODULES="$HTTP_MODULES $HTTP_INDEX_MODULE"
 
 if [ $HTTP_ACCESS = YES ]; then
     have=NGX_HTTP_ACCESS . auto/have
diff --git a/auto/options b/auto/options
index 75e9376..40a09b9 100644
--- a/auto/options
+++ b/auto/options
@@ -42,6 +42,7 @@
 HTTP_SSI=NO
 HTTP_ACCESS=YES
 HTTP_USERID=YES
+HTTP_AUTOINDEX=YES
 HTTP_STATUS=NO
 HTTP_REWRITE=YES
 HTTP_PROXY=YES
@@ -107,6 +108,7 @@
         --without-http_ssi_module)       HTTP_SSI=NO                ;;
         --without-http_userid_module)    HTTP_USERID=NO             ;;
         --without-http_access_module)    HTTP_ACCESS=NO             ;;
+        --without-http_autoindex_module) HTTP_AUTOINDEX=NO          ;;
         --without-http_status_module)    HTTP_STATUS=NO             ;;
         --without-http_rewrite_module)   HTTP_REWRITE=NO            ;;
         --without-http_proxy_module)     HTTP_PROXY=NO              ;;
diff --git a/auto/sources b/auto/sources
index 1622dcd..bf5829f 100644
--- a/auto/sources
+++ b/auto/sources
@@ -272,6 +272,10 @@
 HTTP_ACCESS_SRCS=src/http/modules/ngx_http_access_handler.c
 
 
+HTTP_AUTOINDEX_MODULE=ngx_http_autoindex_module
+HTTP_AUTOINDEX_SRCS=src/http/modules/ngx_http_autoindex_handler.c
+
+
 HTTP_STATUS_MODULE=ngx_http_status_module
 HTTP_STATUS_SRCS=src/http/modules/ngx_http_status_handler.c
 
diff --git a/auto/summary b/auto/summary
index 45c68e0..b8fb81d 100644
--- a/auto/summary
+++ b/auto/summary
@@ -6,6 +6,16 @@
 echo "Configuration summary"
 
 
+case $USE_THREADS in
+    rfork)         echo "  + using rfork()ed threads" ;;
+    pthreads)      echo "  + using libpthread threads library" ;;
+    libthr)        echo "  + using FreeBSD libthr threads library" ;;
+    libc_r)        echo "  + using FreeBSD libc_r threads library" ;;
+    linuxthreads)  echo "  + using FreeBSD LinuxThreads port library" ;;
+    NO)            echo "  + threads are not used" ;;
+    *)             echo "  + using lib$USE_THREADS threads library" ;;
+esac
+
 if [ $USE_PCRE = DISABLED ]; then
     echo " + PCRE library is disabled"
 
diff --git a/auto/threads b/auto/threads
index 9aaea51..a12eed3 100644
--- a/auto/threads
+++ b/auto/threads
@@ -20,17 +20,16 @@
         esac
     ;;
 
-    pthread)
+    pthreads)
         have=NGX_THREADS . auto/have
         CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
         CORE_LIBS="$CORE_LIBS -lpthread"
     ;;
 
-    freebsd4)
+    libthr)
         have=NGX_THREADS . auto/have
-        CFLAGS="$CFLAGS -pthread"
         CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
-        CORE_LIBS="$CORE_LIBS -pthread"
+        CORE_LIBS="$CORE_LIBS -lthr"
     ;;
 
     linuxthreads)
@@ -42,22 +41,30 @@
         CORE_LIBS="$CORE_LIBS -L /usr/local/lib -llthread -llgcc_r"
     ;;
 
-    lc_r)
-        have=NGX_THREADS . auto/have
-        CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
-        CORE_LIBS="$CORE_LIBS -lc_r"
+    libc_r)
+        case $PLATFORM in
+            FreeBSD:[34]*)
+                have=NGX_THREADS . auto/have
+                CFLAGS="$CFLAGS -pthread"
+                CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
+                CORE_LIBS="$CORE_LIBS -pthread"
+            ;;
+
+            FreeBSD:5*)
+                have=NGX_THREADS . auto/have
+                CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
+                CORE_LIBS="$CORE_LIBS -lc_r"
+            ;;
+        esac
     ;;
 
-    lthr)
-        have=NGX_THREADS . auto/have
-        CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
-        CORE_LIBS="$CORE_LIBS -lthr"
+    NO)
     ;;
 
-    lkse)
+    *)
         have=NGX_THREADS . auto/have
         CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
-        CORE_LIBS="$CORE_LIBS -lkse"
+        CORE_LIBS="$CORE_LIBS -l$USE_THREADS"
     ;;
 
 esac