nginx-0.3.13-RELEASE import

    *) Feature: the IMAP/POP3 proxy supports STARTTLS and STLS.

    *) Bugfix: the IMAP/POP3 proxy did not work with the select, poll, and
       /dev/poll methods.

    *) Bugfix: in SSI handling.

    *) Bugfix: now Solaris sendfilev() is not used to transfer the client
       request body to FastCGI-server via the unix domain socket.

    *) Bugfix: the "auth_basic" directive did not disable the
       authorization; the bug had appeared in 0.3.11.
diff --git a/src/http/modules/ngx_http_auth_basic_module.c b/src/http/modules/ngx_http_auth_basic_module.c
index cf85557..48192ca 100644
--- a/src/http/modules/ngx_http_auth_basic_module.c
+++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -379,6 +379,8 @@
     if (ngx_strcmp(realm->data, "off") == 0) {
         realm->len = 0;
         realm->data = (u_char *) "";
+
+        return NGX_CONF_OK;
     }
 
     len = sizeof("Basic realm=\"") - 1 + realm->len + 1;
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index 125b8e0..45b6e73 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -1419,7 +1419,8 @@
 {
     ngx_http_variable_t  *var;
 
-    var = ngx_http_add_variable(cf, &ngx_http_fastcgi_script_name, 0);
+    var = ngx_http_add_variable(cf, &ngx_http_fastcgi_script_name,
+                                NGX_HTTP_VAR_NOHASH);
     if (var == NULL) {
         return NGX_ERROR;
     }
diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c
index 8231de1..bf7b925 100644
--- a/src/http/modules/ngx_http_geo_module.c
+++ b/src/http/modules/ngx_http_geo_module.c
@@ -130,18 +130,14 @@
     var->handler = ngx_http_geo_variable;
     var->data = (uintptr_t) tree;
 
-    /*
-     * create the temporary pool of a huge initial size
-     * to process quickly a large number of geo lines
-     */
-
-    pool = ngx_create_pool(512 * 1024, cf->log);
+    pool = ngx_create_pool(16384, cf->log);
     if (pool == NULL) {
         return NGX_CONF_ERROR;
     }
 
     if (ngx_array_init(&geo.values, pool, 512,
-                       sizeof(ngx_http_variable_value_t *)) == NGX_ERROR)
+                       sizeof(ngx_http_variable_value_t *))
+        == NGX_ERROR)
     {
         ngx_destroy_pool(pool);
         return NGX_CONF_ERROR;
diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c
index 66d5935..e819759 100644
--- a/src/http/modules/ngx_http_gzip_filter_module.c
+++ b/src/http/modules/ngx_http_gzip_filter_module.c
@@ -961,7 +961,7 @@
     ngx_http_variable_t     *var;
     ngx_http_log_op_name_t  *op;
 
-    var = ngx_http_add_variable(cf, &ngx_http_gzip_ratio, 0);
+    var = ngx_http_add_variable(cf, &ngx_http_gzip_ratio, NGX_HTTP_VAR_NOHASH);
     if (var == NULL) {
         return NGX_ERROR;
     }
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index 8278d34..afadc18 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -359,20 +359,20 @@
 static ngx_http_variable_t  ngx_http_proxy_vars[] = {
 
     { ngx_string("proxy_host"), ngx_http_proxy_host_variable, 0,
-      NGX_HTTP_VAR_CHANGABLE, 0 },
+      NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOHASH, 0 },
 
     { ngx_string("proxy_port"), ngx_http_proxy_port_variable, 0,
-      NGX_HTTP_VAR_CHANGABLE, 0 },
+      NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOHASH, 0 },
 
     { ngx_string("proxy_add_x_forwarded_for"),
-      ngx_http_proxy_add_x_forwarded_for_variable, 0, 0, 0 },
+      ngx_http_proxy_add_x_forwarded_for_variable, 0, NGX_HTTP_VAR_NOHASH, 0 },
 
 #if 0
-    { ngx_string("proxy_add_via"), NULL, 0, 0, 0 },
+    { ngx_string("proxy_add_via"), NULL, 0, NGX_HTTP_VAR_NOHASH, 0 },
 #endif
 
     { ngx_string("proxy_internal_body_length"),
-      ngx_http_proxy_internal_body_length_variable, 0, 0, 0 },
+      ngx_http_proxy_internal_body_length_variable, 0, NGX_HTTP_VAR_NOHASH, 0 },
 
     { ngx_null_string, NULL, 0, 0, 0 }
 };
diff --git a/src/http/modules/ngx_http_referer_module.c b/src/http/modules/ngx_http_referer_module.c
index a3d3d46..cd8be78 100644
--- a/src/http/modules/ngx_http_referer_module.c
+++ b/src/http/modules/ngx_http_referer_module.c
@@ -217,7 +217,8 @@
     name.len = sizeof("invalid_referer") - 1;
     name.data = (u_char *) "invalid_referer";
 
-    var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGABLE);
+    var = ngx_http_add_variable(cf, &name,
+                                NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOHASH);
     if (var == NULL) {
         return NGX_CONF_ERROR;
     }
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c
index 6f4ac45..dd0e92f 100644
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -648,13 +648,17 @@
 
                 rc = cmd->handler(r, ctx, params);
 
-                if (c->closed) {
+                if (c->destroyed) {
                     return NGX_DONE;
                 }
 
                 if (rc == NGX_OK) {
                     continue;
                 }
+
+                if (rc == NGX_ERROR) {
+                    return NGX_ERROR;
+                }
             }
 
 
diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c
index 808d945..1504f24 100644
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -244,6 +244,12 @@
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
 
+    r->allow_ranges = 1;
+
+    if (r->header_only || (r->main != r && ngx_file_size(&fi) == 0)) {
+        return ngx_http_send_header(r);
+    }
+
     /* we need to allocate all before the header would be sent */
 
     b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
@@ -256,11 +262,9 @@
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
 
-    r->allow_ranges = 1;
-
     rc = ngx_http_send_header(r);
 
-    if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
+    if (rc == NGX_ERROR || rc > NGX_OK) {
         return rc;
     }
 
diff --git a/src/http/modules/ngx_http_userid_filter_module.c b/src/http/modules/ngx_http_userid_filter_module.c
index c77dca2..159bd34 100644
--- a/src/http/modules/ngx_http_userid_filter_module.c
+++ b/src/http/modules/ngx_http_userid_filter_module.c
@@ -554,7 +554,7 @@
     ngx_http_variable_t     *var;
     ngx_http_log_op_name_t  *op;
 
-    var = ngx_http_add_variable(cf, &ngx_http_userid_got, 0);
+    var = ngx_http_add_variable(cf, &ngx_http_userid_got, NGX_HTTP_VAR_NOHASH);
     if (var == NULL) {
         return NGX_ERROR;
     }
@@ -562,7 +562,7 @@
     var->handler = ngx_http_userid_variable;
     var->data = offsetof(ngx_http_userid_ctx_t, uid_got);
 
-    var = ngx_http_add_variable(cf, &ngx_http_userid_set, 0);
+    var = ngx_http_add_variable(cf, &ngx_http_userid_set, NGX_HTTP_VAR_NOHASH);
     if (var == NULL) {
         return NGX_ERROR;
     }