]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.1.12-RELEASE import release-0.1.12
authorIgor Sysoev <igor@sysoev.ru>
Mon, 6 Dec 2004 14:45:08 +0000 (14:45 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 6 Dec 2004 14:45:08 +0000 (14:45 +0000)
    *) 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.

docs/xml/nginx/changes.xml
src/core/nginx.h
src/http/modules/ngx_http_index_handler.c
src/http/ngx_http_log_handler.c
src/http/ngx_http_request.c
src/http/ngx_http_request.h
src/http/ngx_http_request_body.c
src/os/unix/ngx_linux_config.h
src/os/unix/ngx_solaris_config.h

index 505fbdea8532dedf61e56983eeae76b0955c480b..4fde0b7b479c618cdfbbc9d46d89d8b6a778d099 100644 (file)
@@ -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">
index 3ac28f155d59963686f6b33eb47ad8e7201e77f8..a36895e3504fe31cd0e87fbd601767a221af1093 100644 (file)
@@ -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"
index 74ccf0ae1d0196c7c85b6b40d17af6f9cf7b9b78..892b825ae2bd96d43c02a49ed593881082d334a9 100644 (file)
@@ -477,12 +477,12 @@ static char *ngx_http_index_merge_loc_conf(ngx_conf_t *cf,
         }
     }
 
-#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;
     }
index fd373444e4265fe2c43bd25aadc2c0804d5db282..71cbb295324ac44e5d52cc7cc354d2b5abc4af63 100644 (file)
@@ -28,6 +28,8 @@ static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf,
                                    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_http_log_op_name_t ngx_http_log_fmt_ops[] = {
     { 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_apache_length(ngx_http_request_t *r, u_char *buf,
 }
 
 
+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)
 {
index fe3d516cf9296c2a03efa2d6804af63460debf80..b2c35169eeeec6a6bea86e29adc686c69ee68ea7 100644 (file)
@@ -795,6 +795,8 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
             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 @@ static ngx_int_t ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
 
         /* 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 @@ static ngx_int_t ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
          * 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 @@ static ngx_int_t ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
     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 @@ static void ngx_http_keepalive_handler(ngx_event_t *rev)
     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 @@ static void ngx_http_lingering_close_handler(ngx_event_t *rev)
 
     } 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;
index 141daa1b808fb822b37c5935cdb35169d79b1156..bdc9cb2e50264e443400f8a42d26e5e4b12ca876 100644 (file)
@@ -298,6 +298,8 @@ struct ngx_http_request_s {
     /* 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;
index c9ec6fa07e364544b5501818c3218f219dfde9c8..eb6aebfc6a669cd71deec746449bf31ca03d81ca 100644 (file)
@@ -42,6 +42,7 @@ ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r)
             /* 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 @@ ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r)
         }
 
         r->header_in->pos = r->header_in->last;
+        r->request_length += size;
     }
 
 
@@ -173,6 +175,7 @@ static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r)
 
         r->request_body->buf->last += n;
         r->request_body->rest -= n;
+        r->request_length += n;
 
         if (r->request_body->rest == 0) {
             break;
index 84eaf5c6acfa2d27487518ecbec92b2eef1b947e..bb08f41e3f508344da6faf37aea99283aab5b41b 100644 (file)
@@ -80,6 +80,12 @@ extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
 #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
index 452850c0f6199934b47d3c1a3bdeb0f820727d94..e387006dac20eddcebff3a02eb36dc1aa0a0b597 100644 (file)
@@ -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