discard request body before going to keep-alive state and use lingering timeouts
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 27fd159..dd9ec23 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1921,8 +1921,16 @@
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 @@
}
}
- clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
ngx_http_request_done(r, 0);
c->data = hc;