comparison src/http/ngx_http_request.c @ 3211:3ea03c1fe050

add lingering timeout if a response is short and a request body is being discarded, the bug was introduced in r3050
author Igor Sysoev <igor@sysoev.ru>
date Mon, 19 Oct 2009 14:08:09 +0000
parents 0e420f3f8e18
children 798a7f1d3b2f
comparison
equal deleted inserted replaced
3210:794613efbb71 3211:3ea03c1fe050
2099 static void 2099 static void
2100 ngx_http_finalize_connection(ngx_http_request_t *r) 2100 ngx_http_finalize_connection(ngx_http_request_t *r)
2101 { 2101 {
2102 ngx_http_core_loc_conf_t *clcf; 2102 ngx_http_core_loc_conf_t *clcf;
2103 2103
2104 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
2105
2104 if (r->main->count != 1) { 2106 if (r->main->count != 1) {
2107
2108 if (r->discard_body && r->lingering_time == 0) {
2109 r->lingering_time = ngx_time()
2110 + (time_t) (clcf->lingering_time / 1000);
2111 ngx_add_timer(r->connection->read, clcf->lingering_timeout);
2112 }
2113
2105 ngx_http_close_request(r, 0); 2114 ngx_http_close_request(r, 0);
2106 return; 2115 return;
2107 } 2116 }
2108
2109 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
2110 2117
2111 if (!ngx_terminate 2118 if (!ngx_terminate
2112 && !ngx_exiting 2119 && !ngx_exiting
2113 && r->keepalive 2120 && r->keepalive
2114 && clcf->keepalive_timeout > 0) 2121 && clcf->keepalive_timeout > 0)