diff src/http/ngx_http_request.c @ 24:420dd3f9e703 NGINX_0_1_12

nginx 0.1.12 *) 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.
author Igor Sysoev <http://sysoev.ru>
date Mon, 06 Dec 2004 00:00:00 +0300
parents 8b6db3bda591
children 45fe5b98a9de
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -795,6 +795,8 @@ static void ngx_http_process_request_hea
             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_he
 
         /* 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_he
          * 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_he
     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(n
     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_han
 
     } 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;