diff src/http/ngx_http_request.c @ 1373:fdea12ffb24a

discard request body before going to keep-alive state and use lingering timeouts
author Igor Sysoev <igor@sysoev.ru>
date Tue, 07 Aug 2007 10:53:27 +0000
parents 202cae9a0c2b
children cb8b30ef3e7e
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1921,8 +1921,16 @@ ngx_http_set_keepalive(ngx_http_request_
     c = r->connection;
     rev = c->read;
 
+    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "set http keepalive handler");
 
+    if (r->discard_body) {
+        r->lingering_time = ngx_time() + (time_t) (clcf->lingering_time / 1000);
+        ngx_add_timer(rev, clcf->lingering_timeout);
+        return;
+    }
+
     c->log->action = "closing request";
 
     hc = r->http_connection;
@@ -1966,8 +1974,6 @@ ngx_http_set_keepalive(ngx_http_request_
         }
     }
 
-    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
     ngx_http_request_done(r, 0);
 
     c->data = hc;