nginx-0.1.12-RELEASE import

    *) Feature: the %request_length log parameter.

    *) Bugfix: when using the /dev/poll, select and poll on the platforms,
       where these methods may do the false reports, there may be the long
       delay when the request was passed via the keep-alive connection. It
       may be at least on Solaris when using the /dev/poll.

    *) Bugfix: the send_lowat directive is ignored on Linux because Linux
       does not support the SO_SNDLOWAT option.
diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml
index 505fbde..4fde0b7 100644
--- a/docs/xml/nginx/changes.xml
+++ b/docs/xml/nginx/changes.xml
@@ -6,6 +6,46 @@
             title="nginx">
 
 
+<changes ver="0.1.12" date="06.12.2004">
+
+<change type="feature">
+<para lang="ru">
+ÐÁÒÁÍÅÔÒ ÌÏÇÁ %request_length.
+</para>
+<para lang="en">
+the %request_length log parameter.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ /dev/poll, select É poll ÎÁ ÐÌÁÔÆÏÒÍÁÈ, ÇÄÅ ×ÏÚÍÏÖÎÙ
+ÌÏÖÎÙÅ ÓÒÁÂÁÔÙ×ÁÎÉÑ ÕËÁÚÁÎÎÙÈ ÍÅÔÏÄÏ×, ÍÏÇÌÉ ÂÙÔØ ÄÌÉÔÅÌØÎÙÅ ÚÁÄÅÒÖËÉ
+ÐÒÉ ÏÂÒÁÂÏÔËÅ ÚÁÐÒÏÓÁ ÐÏ keep-alive ÓÏÅÄÉÎÅÎÉÀ.
+îÁÂÌÀÄÁÌÏÓØ ÐÏ ËÒÁÊÎÅÊ ÍÅÒÅ ÎÁ Solaris Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ /dev/poll.
+</para>
+<para lang="en">
+when using the /dev/poll, select and poll on the platforms, where
+these methods may do the false reports, there may be the long delay when
+the request was passed via the keep-alive connection.
+It may be at least on Solaris when using the /dev/poll.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ÄÉÒÅËÔÉ×Á send_lowat ÉÇÎÏÒÉÒÕÅÔÓÑ ÎÁ Linux, ÔÁË ËÁË Linux ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔ
+ÏÐÃÉÀ SO_SNDLOWAT.
+</para>
+<para lang="en">
+the send_lowat directive is ignored on Linux because Linux does not support
+the SO_SNDLOWAT option.
+</para>
+</change>
+
+</changes>
+
+
 <changes ver="0.1.11" date="02.12.2004">
 
 <change type="feature">
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 3ac28f1..a36895e 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.1.11"
+#define NGINX_VER          "nginx/0.1.12"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_NEWPID_EXT     ".newbin"
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c
index 74ccf0a..892b825 100644
--- a/src/http/modules/ngx_http_index_handler.c
+++ b/src/http/modules/ngx_http_index_handler.c
@@ -477,12 +477,12 @@
         }
     }
 
-#endif
-
     if (conf->max_index_len < prev->max_index_len) {
         conf->max_index_len = prev->max_index_len;
     }
 
+#endif
+
     if (conf->index_cache == NULL) {
         conf->index_cache = prev->index_cache;
     }
diff --git a/src/http/ngx_http_log_handler.c b/src/http/ngx_http_log_handler.c
index fd37344..71cbb29 100644
--- a/src/http/ngx_http_log_handler.c
+++ b/src/http/ngx_http_log_handler.c
@@ -28,6 +28,8 @@
                                    uintptr_t data);
 static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf,
                                           uintptr_t data);
+static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
+                                           uintptr_t data);
 static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
                                       uintptr_t data);
 static u_char *ngx_http_log_connection_header_out(ngx_http_request_t *r,
@@ -118,6 +120,8 @@
     { ngx_string("status"), 3, ngx_http_log_status },
     { ngx_string("length"), NGX_OFF_T_LEN, ngx_http_log_length },
     { ngx_string("apache_length"), NGX_OFF_T_LEN, ngx_http_log_apache_length },
+    { ngx_string("request_length"), NGX_OFF_T_LEN,
+                                    ngx_http_log_request_length },
     { ngx_string("i"), NGX_HTTP_LOG_ARG, ngx_http_log_header_in },
     { ngx_string("o"), NGX_HTTP_LOG_ARG, ngx_http_log_header_out },
     { ngx_null_string, 0, NULL }
@@ -283,6 +287,13 @@
 }
 
 
+static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
+                                           uintptr_t data)
+{
+    return ngx_sprintf(buf, "%O", r->request_length);
+}
+
+
 static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
                                       uintptr_t data)
 {
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index fe3d516..b2c3516 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -795,6 +795,8 @@
             ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                            "http header done");
 
+            r->request_length += r->header_in->pos - r->header_in->start;
+
             r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE;
 
             rc = ngx_http_process_request_header(r);
@@ -922,6 +924,8 @@
 
         /* the client fills up the buffer with "\r\n" */
 
+        r->request_length += r->header_in->end - r->header_in->start;
+
         r->header_in->pos = r->header_in->start;
         r->header_in->last = r->header_in->start;
 
@@ -981,6 +985,8 @@
          * to relocate the parser header pointers
          */
 
+        r->request_length += r->header_in->end - r->header_in->start;
+
         r->header_in = b;
 
         return NGX_OK;
@@ -989,6 +995,8 @@
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http large header copy: %d", r->header_in->pos - old);
 
+    r->request_length += old - r->header_in->start;
+
     new = b->start;
 
     ngx_memcpy(new, old, r->header_in->pos - old);
@@ -1810,6 +1818,10 @@
     c->log_error = NGX_ERROR_INFO;
 
     if (n == NGX_AGAIN) {
+        if (ngx_handle_level_read_event(rev) == NGX_ERROR) {
+            ngx_http_close_connection(c);
+        }
+
         return;
     }
 
@@ -1932,6 +1944,11 @@
 
     } while (rev->ready);
 
+    if (ngx_handle_level_read_event(rev) == NGX_ERROR) {
+        ngx_http_close_connection(c);
+        return;
+    }
+
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
     timer *= 1000;
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index 141daa1..bdc9cb2 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -298,6 +298,8 @@
     /* used to learn the Apache compatible response length without a header */
     size_t               header_size;
 
+    size_t               request_length;
+
     u_char              *discarded_buffer;
     void               **err_ctx;
     ngx_uint_t           err_status;
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
index c9ec6fa..eb6aebf 100644
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -42,6 +42,7 @@
             /* the whole request body was pre-read */
 
             r->header_in->pos += r->headers_in.content_length_n;
+            r->request_length += r->headers_in.content_length_n;
 
             r->request_body->handler(r->request_body->data);
 
@@ -49,6 +50,7 @@
         }
 
         r->header_in->pos = r->header_in->last;
+        r->request_length += size;
     }
 
 
@@ -173,6 +175,7 @@
 
         r->request_body->buf->last += n;
         r->request_body->rest -= n;
+        r->request_length += n;
 
         if (r->request_body->rest == 0) {
             break;
diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h
index 84eaf5c..bb08f41 100644
--- a/src/os/unix/ngx_linux_config.h
+++ b/src/os/unix/ngx_linux_config.h
@@ -80,6 +80,12 @@
 #endif
 
 
+#ifndef NGX_HAVE_SO_SNDLOWAT
+/* setsockopt(SO_SNDLOWAT) returns ENOPROTOOPT */
+#define NGX_HAVE_SO_SNDLOWAT         0
+#endif
+
+
 #ifndef NGX_HAVE_INHERITED_NONBLOCK
 #define NGX_HAVE_INHERITED_NONBLOCK  0
 #endif
diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h
index 452850c..e387006 100644
--- a/src/os/unix/ngx_solaris_config.h
+++ b/src/os/unix/ngx_solaris_config.h
@@ -76,7 +76,7 @@
 
 
 #ifndef NGX_HAVE_SO_SNDLOWAT
-/* setsockopt(SO_SNDLOWAT) returns error "Option not supported by protocol" */
+/* setsockopt(SO_SNDLOWAT) returns ENOPROTOOPT */
 #define NGX_HAVE_SO_SNDLOWAT         0
 #endif