]> git.kaiwu.me - nginx.git/commitdiff
add lingering timeout if a response is short and a request body is being
authorIgor Sysoev <igor@sysoev.ru>
Mon, 19 Oct 2009 14:08:09 +0000 (14:08 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 19 Oct 2009 14:08:09 +0000 (14:08 +0000)
discarded, the bug was introduced in r3050

src/http/ngx_http_request.c

index 6c42f385c5bd508217b2bed1d448eb4d94e360b6..485a564695ca55365f973f1508016dec55e3a6d6 100644 (file)
@@ -2101,13 +2101,20 @@ ngx_http_finalize_connection(ngx_http_request_t *r)
 {
     ngx_http_core_loc_conf_t  *clcf;
 
+    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
     if (r->main->count != 1) {
+
+        if (r->discard_body && r->lingering_time == 0) {
+            r->lingering_time = ngx_time()
+                                      + (time_t) (clcf->lingering_time / 1000);
+            ngx_add_timer(r->connection->read, clcf->lingering_timeout);
+        }
+
         ngx_http_close_request(r, 0);
         return;
     }
 
-    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
     if (!ngx_terminate
          && !ngx_exiting
          && r->keepalive