summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-12-01 14:54:57 +0000
committerJonathan Kolb <jon@b0g.us>2008-12-01 14:54:57 +0000
commit8009eea9058f3d858f6837b252594347e1ed89c9 (patch)
tree0eeba20c6d1dcf29a44d906efce76539b0ba0328
parent14fc50d2541963292e3d8fece20078ee34b21e36 (diff)
downloadnginx-0.7.24.tar.gz
Changes with nginx 0.7.24 01 Dec 2008v0.7.24
*) Feature: the "if_modified_since" directive. *) Bugfix: nginx did not process a FastCGI server response, if the server send too many messages to stderr before response. *) Bugfix: the "$cookie_..." variables did not work in the SSI and the perl module.
-rw-r--r--CHANGES11
-rw-r--r--CHANGES.ru11
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/http/modules/ngx_http_geo_module.c7
-rw-r--r--src/http/modules/ngx_http_not_modified_filter_module.c24
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/ngx_http_core_module.c17
-rw-r--r--src/http/ngx_http_core_module.h1
-rw-r--r--src/http/ngx_http_upstream.c67
-rw-r--r--src/http/ngx_http_variables.c4
10 files changed, 99 insertions, 47 deletions
diff --git a/CHANGES b/CHANGES
index db21ef117..ed7cae635 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,15 @@
+Changes with nginx 0.7.24 01 Dec 2008
+
+ *) Feature: the "if_modified_since" directive.
+
+ *) Bugfix: nginx did not process a FastCGI server response, if the
+ server send too many messages to stderr before response.
+
+ *) Bugfix: the "$cookie_..." variables did not work in the SSI and the
+ perl module.
+
+
Changes with nginx 0.7.23 27 Nov 2008
*) Feature: the "delete" and "ranges" parameters in the "geo" directive.
diff --git a/CHANGES.ru b/CHANGES.ru
index 2c4f1add7..a7eaff7f7 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,15 @@
+Изменения в nginx 0.7.24 01.12.2008
+
+ *) Добавление: директива if_modified_since.
+
+ *) Исправление: nginx не обрабатывал ответ FastCGI-сервера, если перед
+ ответом сервер передавал много сообщений в stderr.
+
+ *) Исправление: переменные "$cookie_..." не работали в SSI and в
+ перловом модуле.
+
+
Изменения в nginx 0.7.23 27.11.2008
*) Добавление: параметры delete и ranges в директиве geo.
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 63f52c352..b65e539f7 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VERSION "0.7.23"
+#define NGINX_VERSION "0.7.24"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c
index 5fc63210c..bba399f6c 100644
--- a/src/http/modules/ngx_http_geo_module.c
+++ b/src/http/modules/ngx_http_geo_module.c
@@ -255,6 +255,13 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
} else {
+ if (ctx.tree == NULL) {
+ ctx.tree = ngx_radix_tree_create(cf->pool, -1);
+ if (ctx.tree == NULL) {
+ return NGX_CONF_ERROR;
+ }
+ }
+
var->get_handler = ngx_http_geo_cidr_variable;
var->data = (uintptr_t) ctx.tree;
diff --git a/src/http/modules/ngx_http_not_modified_filter_module.c b/src/http/modules/ngx_http_not_modified_filter_module.c
index ce4b55cf5..389a3a93a 100644
--- a/src/http/modules/ngx_http_not_modified_filter_module.c
+++ b/src/http/modules/ngx_http_not_modified_filter_module.c
@@ -50,7 +50,8 @@ static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
static
ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r)
{
- time_t ims;
+ time_t ims;
+ ngx_http_core_loc_conf_t *clcf;
if (r->headers_out.status != NGX_HTTP_OK
|| r != r->main
@@ -66,17 +67,22 @@ ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r)
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http ims:%d lm:%d", ims, r->headers_out.last_modified_time);
- /*
- * I think that the equality of the dates is correcter
- */
+ if (ims != r->headers_out.last_modified_time) {
- if (ims == r->headers_out.last_modified_time) {
- r->headers_out.status = NGX_HTTP_NOT_MODIFIED;
- r->headers_out.content_type.len = 0;
- ngx_http_clear_content_length(r);
- ngx_http_clear_accept_ranges(r);
+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+ if (clcf->if_modified_since == 0
+ || ims < r->headers_out.last_modified_time)
+ {
+ return ngx_http_next_header_filter(r);
+ }
}
+ r->headers_out.status = NGX_HTTP_NOT_MODIFIED;
+ r->headers_out.content_type.len = 0;
+ ngx_http_clear_content_length(r);
+ ngx_http_clear_accept_ranges(r);
+
return ngx_http_next_header_filter(r);
}
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index 7159783ec..77f527c72 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.7.23';
+our $VERSION = '0.7.24';
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 f220368da..b4bd40a93 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -108,6 +108,13 @@ static ngx_conf_enum_t ngx_http_core_satisfy[] = {
};
+static ngx_conf_enum_t ngx_http_core_if_modified_since[] = {
+ { ngx_string("exact"), 0 },
+ { ngx_string("before"), 1 },
+ { ngx_null_string, 0 }
+};
+
+
#if (NGX_HTTP_GZIP)
static ngx_conf_enum_t ngx_http_gzip_http_version[] = {
@@ -515,6 +522,13 @@ static ngx_command_t ngx_http_core_commands[] = {
offsetof(ngx_http_core_loc_conf_t, server_tokens),
NULL },
+ { ngx_string("if_modified_since"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_enum_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_core_loc_conf_t, if_modified_since),
+ &ngx_http_core_if_modified_since },
+
{ ngx_string("error_page"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|NGX_CONF_2MORE,
@@ -2663,6 +2677,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t *cf)
lcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE;
lcf->client_body_timeout = NGX_CONF_UNSET_MSEC;
lcf->satisfy = NGX_CONF_UNSET_UINT;
+ lcf->if_modified_since = NGX_CONF_UNSET_UINT;
lcf->internal = NGX_CONF_UNSET;
lcf->client_body_in_file_only = NGX_CONF_UNSET;
lcf->sendfile = NGX_CONF_UNSET;
@@ -2852,6 +2867,8 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy,
NGX_HTTP_SATISFY_ALL);
+ ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,
+ 0);
ngx_conf_merge_value(conf->internal, prev->internal, 0);
ngx_conf_merge_value(conf->client_body_in_file_only,
prev->client_body_in_file_only, 0);
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 99b5bd310..032d07a6b 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -299,6 +299,7 @@ struct ngx_http_core_loc_conf_s {
time_t keepalive_header; /* keepalive_timeout */
ngx_uint_t satisfy; /* satisfy */
+ ngx_uint_t if_modified_since; /* if_modified_since */
ngx_flag_t internal; /* internal */
ngx_flag_t client_body_in_file_only; /* client_body_in_file_only */
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 31468fc7a..d5b6ae7ec 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -1114,62 +1114,59 @@ ngx_http_upstream_process_header(ngx_event_t *rev)
#endif
}
- n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last);
+ for ( ;; ) {
+
+ n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last);
- if (n == NGX_AGAIN) {
+ if (n == NGX_AGAIN) {
#if 0
- ngx_add_timer(rev, u->read_timeout);
+ ngx_add_timer(rev, u->read_timeout);
#endif
- if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
- ngx_http_upstream_finalize_request(r, u,
+ if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
+ ngx_http_upstream_finalize_request(r, u,
NGX_HTTP_INTERNAL_SERVER_ERROR);
+ return;
+ }
+
return;
}
- return;
- }
-
- if (n == 0) {
- ngx_log_error(NGX_LOG_ERR, rev->log, 0,
- "upstream prematurely closed connection");
- }
+ if (n == 0) {
+ ngx_log_error(NGX_LOG_ERR, rev->log, 0,
+ "upstream prematurely closed connection");
+ }
- if (n == NGX_ERROR || n == 0) {
- ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
- return;
- }
+ if (n == NGX_ERROR || n == 0) {
+ ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
+ return;
+ }
- u->buffer.last += n;
+ u->buffer.last += n;
#if 0
- u->valid_header_in = 0;
+ u->valid_header_in = 0;
- u->peer.cached = 0;
+ u->peer.cached = 0;
#endif
- rc = u->process_header(r);
+ rc = u->process_header(r);
- if (rc == NGX_AGAIN) {
-#if 0
- ngx_add_timer(rev, u->read_timeout);
-#endif
+ if (rc == NGX_AGAIN) {
- if (u->buffer.pos == u->buffer.end) {
- ngx_log_error(NGX_LOG_ERR, rev->log, 0,
- "upstream sent too big header");
+ if (u->buffer.pos == u->buffer.end) {
+ ngx_log_error(NGX_LOG_ERR, rev->log, 0,
+ "upstream sent too big header");
- ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_INVALID_HEADER);
- return;
- }
+ ngx_http_upstream_next(r, u,
+ NGX_HTTP_UPSTREAM_FT_INVALID_HEADER);
+ return;
+ }
- if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
- ngx_http_upstream_finalize_request(r, u,
- NGX_HTTP_INTERNAL_SERVER_ERROR);
- return;
+ continue;
}
- return;
+ break;
}
if (rc == NGX_HTTP_UPSTREAM_INVALID_HEADER) {
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index aad541e81..998c4ce35 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -25,6 +25,8 @@ static ngx_int_t ngx_http_variable_unknown_header_in(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_unknown_header_out(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_cookie(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_argument(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
@@ -490,7 +492,7 @@ ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
if (ngx_strncmp(name->data, "cookie_", 7) == 0) {
- if (ngx_http_variable_argument(r, vv, (uintptr_t) name) == NGX_OK) {
+ if (ngx_http_variable_cookie(r, vv, (uintptr_t) name) == NGX_OK) {
return vv;
}