nginx-0.1.17-RELEASE import

    *) Change: the ngx_http_rewrite_module was rewritten from the scratch.
       Now it is possible to redirect, to return the error codes, to check
       the variables and referrers. The directives can be used inside
       locations. The redirect directive was canceled.

    *) Feature: the ngx_http_geo_module.

    *) Feature: the proxy_set_x_var and fastcgi_set_var directives.

    *) Bugfix: the location configuration with "=" modifier may be used in
       another location.

    *) Bugfix: the correct content type was set only for requests that use
       small caps letters in extension.

    *) Bugfix: if the proxy_pass or fastcgi_pass directives were set in the
       location, and access was denied, and the error was redirected to a
       static page, then the segmentation fault occurred.

    *) Bugfix: if in a proxied "Location" header was a relative URL, then a
       host name and a slash were added to them; the bug had appeared in
       0.1.14.

    *) Bugfix: the system error message was not logged on Linux.
diff --git a/auto/cc/gcc b/auto/cc/gcc
index d5bf1dc..24b908d 100644
--- a/auto/cc/gcc
+++ b/auto/cc/gcc
@@ -28,6 +28,7 @@
 # optimizations
 
 #CFLAGS="$CFLAGS -O2 -fomit-frame-pointer"
+#CFLAGS="$CFLAGS -Os -fomit-frame-pointer"
 
 case $CPU in
     pentium)
diff --git a/auto/modules b/auto/modules
index 3221e26..375b755 100644
--- a/auto/modules
+++ b/auto/modules
@@ -116,6 +116,12 @@
     HTTP_SRCS="$HTTP_SRCS $HTTP_STATUS_SRCS"
 fi
 
+if [ $HTTP_GEO = YES ]; then
+    have=NGX_HTTP_GEO . auto/have
+    HTTP_MODULES="$HTTP_MODULES $HTTP_GEO_MODULE"
+    HTTP_SRCS="$HTTP_SRCS $HTTP_GEO_SRCS"
+fi
+
 if [ $HTTP_REWRITE = YES -a $USE_PCRE != DISABLED ]; then
     have=NGX_HTTP_REWRITE . auto/have
     USE_PCRE=YES
diff --git a/auto/options b/auto/options
index 3d552df..9aff6e2 100644
--- a/auto/options
+++ b/auto/options
@@ -53,6 +53,7 @@
 HTTP_USERID=YES
 HTTP_AUTOINDEX=YES
 HTTP_STATUS=NO
+HTTP_GEO=YES
 HTTP_REWRITE=YES
 HTTP_PROXY=YES
 HTTP_FASTCGI=YES
@@ -125,6 +126,7 @@
         --without-http_access_module)    HTTP_ACCESS=NO             ;;
         --without-http_autoindex_module) HTTP_AUTOINDEX=NO          ;;
         --without-http_status_module)    HTTP_STATUS=NO             ;;
+        --without-http_geo_module)       HTTP_GEO=NO                ;;
         --without-http_rewrite_module)   HTTP_REWRITE=NO            ;;
         --without-http_proxy_module)     HTTP_PROXY=NO              ;;
         --without-http_fastcgi_module)   HTTP_FASTCGI=NO            ;;
@@ -198,6 +200,7 @@
   --without-http_userid_module       disable ngx_http_userid_module
   --without-http_access_module       disable ngx_http_access_module
   --without-http_autoindex_module    disable ngx_http_autoindex_module
+  --without-http_geo_module          disable ngx_http_geo_module
   --without-http_rewrite_module      disable ngx_http_rewrite_module
   --without-http_proxy_module        disable ngx_http_proxy_module
   --without-http_fastcgi_module      disable ngx_http_fastcgi_module
diff --git a/auto/sources b/auto/sources
index c61d83a..ac177f1 100644
--- a/auto/sources
+++ b/auto/sources
@@ -21,14 +21,13 @@
            src/core/ngx_file.h \
            src/core/ngx_crc.h \
            src/core/ngx_rbtree.h \
+           src/core/ngx_radix_tree.h \
            src/core/ngx_times.h \
            src/core/ngx_connection.h \
            src/core/ngx_cycle.h \
            src/core/ngx_conf_file.h \
            src/core/ngx_garbage_collector.h"
 
-#           src/core/ngx_radix_tree.h \
-#           src/core/ngx_radix_tree.c \
 
 CORE_SRCS="src/core/nginx.c \
            src/core/ngx_log.c \
@@ -42,6 +41,7 @@
            src/core/ngx_inet.c \
            src/core/ngx_file.c \
            src/core/ngx_rbtree.c \
+           src/core/ngx_radix_tree.c \
            src/core/ngx_times.c \
            src/core/ngx_connection.c \
            src/core/ngx_cycle.c \
@@ -296,6 +296,10 @@
 HTTP_STATUS_SRCS=src/http/modules/ngx_http_status_handler.c
 
 
+HTTP_GEO_MODULE=ngx_http_geo_module
+HTTP_GEO_SRCS=src/http/modules/ngx_http_geo_module.c
+
+
 HTTP_REWRITE_MODULE=ngx_http_rewrite_module
 HTTP_REWRITE_SRCS=src/http/modules/ngx_http_rewrite_handler.c
 
diff --git a/auto/unix b/auto/unix
index 37bb5d2..406f2a2 100755
--- a/auto/unix
+++ b/auto/unix
@@ -94,8 +94,8 @@
 ngx_feature_run=yes
 ngx_feature_incs="#include <string.h>"
 ngx_feature_libs=
-ngx_feature_test="char buf[32]; int n; n = strerror_r(1, buf, 32);
-                  if (n > 32) return 1;"
+ngx_feature_test="char buf[1024]; long n; n = strerror_r(1, buf, 1024);
+                  if (n < 0 || n > 1024) return 1;"
 . auto/feature
 
 
@@ -106,8 +106,8 @@
 ngx_feature_run=yes
 ngx_feature_incs="#include <string.h>"
 ngx_feature_libs=
-ngx_feature_test="char buf[32]; int n; n = strerror_r(1, buf, 32);
-                  if (n < 32) return 1;"
+ngx_feature_test="char buf[1024]; long n; n = strerror_r(1, buf, 1024);
+                  if (n >= 0 && n < 1024) return 1;"
 . auto/feature