summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-06-22 09:50:51 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-06-22 09:50:51 +0000
commit4f35368b4d929587724bec4da1d2dd7ad5a5239a (patch)
tree94a755dafe6891cd14d0ae250a7a5c3655bde048 /src/http/ngx_http_core_module.c
parent82bf3348421c84f6f3393b67a637103d33179808 (diff)
downloadnginx-4f35368b4d929587724bec4da1d2dd7ad5a5239a.tar.gz
nginx-4f35368b4d929587724bec4da1d2dd7ad5a5239a.tar.bz2
merge r2889:
keepalive_requests
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index c312a05f7..d9983588a 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -426,6 +426,13 @@ static ngx_command_t ngx_http_core_commands[] = {
0,
NULL },
+ { ngx_string("keepalive_requests"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_num_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_core_loc_conf_t, keepalive_requests),
+ NULL },
+
{ ngx_string("satisfy"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_enum_slot,
@@ -1294,8 +1301,13 @@ ngx_http_update_location_config(ngx_http_request_t *r)
r->request_body_file_log_level = NGX_LOG_WARN;
}
- if (r->keepalive && clcf->keepalive_timeout == 0) {
- r->keepalive = 0;
+ if (r->keepalive) {
+ if (clcf->keepalive_timeout == 0) {
+ r->keepalive = 0;
+
+ } else if (r->connection->requests >= clcf->keepalive_requests) {
+ r->keepalive = 0;
+ }
}
if (!clcf->tcp_nopush) {
@@ -2909,6 +2921,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t *cf)
lcf->limit_rate = NGX_CONF_UNSET_SIZE;
lcf->keepalive_timeout = NGX_CONF_UNSET_MSEC;
lcf->keepalive_header = NGX_CONF_UNSET;
+ lcf->keepalive_requests = NGX_CONF_UNSET_UINT;
lcf->lingering_time = NGX_CONF_UNSET_MSEC;
lcf->lingering_timeout = NGX_CONF_UNSET_MSEC;
lcf->resolver_timeout = NGX_CONF_UNSET_MSEC;
@@ -3103,6 +3116,8 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
prev->keepalive_timeout, 75000);
ngx_conf_merge_sec_value(conf->keepalive_header,
prev->keepalive_header, 0);
+ ngx_conf_merge_uint_value(conf->keepalive_requests,
+ prev->keepalive_requests, 100);
ngx_conf_merge_msec_value(conf->lingering_time,
prev->lingering_time, 30000);
ngx_conf_merge_msec_value(conf->lingering_timeout,