summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--CHANGES.ru7
-rw-r--r--src/core/nginx.h4
-rw-r--r--src/core/ngx_connection.h2
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/ngx_http_core_module.c19
-rw-r--r--src/http/ngx_http_core_module.h1
-rw-r--r--src/http/ngx_http_request.c2
8 files changed, 36 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index fb43fa03b..f398ff76c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,9 @@
+Changes with nginx 0.6.38 22 Jun 2009
+
+ *) Feature: the "keepalive_requests" directive.
+
+
Changes with nginx 0.6.37 18 May 2009
*) Feature: Microsoft specific "AUTH LOGIN with User Name" mode support
diff --git a/CHANGES.ru b/CHANGES.ru
index 2172d11c7..a4140596a 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,9 @@
+Изменения в nginx 0.6.38 22.06.2009
+
+ *) Добавление: директива keepalive_requests.
+
+
Изменения в nginx 0.6.37 18.05.2009
*) Добавление: поддержка Microsoft-специфичного режима
@@ -628,7 +633,7 @@
*) Добавление: директивы open_file_cache, open_file_cache_retest и
open_file_cache_errors.
- *) Исправление: утечка сокетов; ошибка появилась в 0.6.7.
+ *) Исправление: утечки сокетов; ошибка появилась в 0.6.7.
*) Исправление: В строку заголовка ответа "Content-Type", указанную в
методе $r->send_http_header(), не добавлялась кодировка, указанная в
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 14458bf9f..f386edec5 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,8 +8,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 006037
-#define NGINX_VERSION "0.6.37"
+#define nginx_version 006038
+#define NGINX_VERSION "0.6.38"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index ac8679697..4c41555e1 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -134,6 +134,8 @@ struct ngx_connection_s {
ngx_atomic_uint_t number;
+ ngx_uint_t requests;
+
unsigned buffered:8;
unsigned log_error:3; /* ngx_connection_log_error_e */
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index 768628be6..95ef2f0dc 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -47,7 +47,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '0.6.37';
+our $VERSION = '0.6.38';
require XSLoader;
XSLoader::load('nginx', $VERSION);
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,
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 76d42150a..23b51442f 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -307,6 +307,7 @@ struct ngx_http_core_loc_conf_s {
time_t keepalive_header; /* keepalive_timeout */
+ ngx_uint_t keepalive_requests; /* keepalive_requests */
ngx_uint_t satisfy; /* satisfy */
ngx_uint_t if_modified_since; /* if_modified_since */
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index f7c2ffa46..f762a033f 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -253,6 +253,8 @@ ngx_http_init_request(ngx_event_t *rev)
return;
}
+ c->requests++;
+
hc = c->data;
if (hc == NULL) {