summaryrefslogtreecommitdiff
path: root/src/http/modules
diff options
context:
space:
mode:
authorNGINX team <nginx@nginx.org>2012-02-29 14:54:20 +0000
committerJon Kolb <jon@b0g.us>2012-02-29 14:54:20 +0000
commit55ebd600fb4c3d0842a9d7ed29c7b8d3e56f848d (patch)
tree04f2471b3a7967b1c5809f6e024da8335f52c024 /src/http/modules
parent616d163c4ad4900518e06187809dab9d0dd6e2c9 (diff)
downloadnginx-55ebd600fb4c3d0842a9d7ed29c7b8d3e56f848d.tar.gz
Changes with nginx 1.1.16 29 Feb 2012v1.1.16
*) Change: the simultaneous subrequest limit has been raised to 200. *) Feature: the "from" parameter of the "disable_symlinks" directive. *) Feature: the "return" and "error_page" directives can be used to return 307 redirections. *) Bugfix: a segmentation fault might occur in a worker process if the "resolver" directive was used and there was no "error_log" directive specified at global level. Thanks to Roman Arutyunyan. *) Bugfix: a segmentation fault might occur in a worker process if the "proxy_http_version 1.1" or "fastcgi_keep_conn on" directives were used. *) Bugfix: memory leaks. Thanks to Lanshun Zhou. *) Bugfix: in the "disable_symlinks" directive. *) Bugfix: on ZFS filesystem disk cache size might be calculated incorrectly; the bug had appeared in 1.0.1. *) Bugfix: nginx could not be built by the icc 12.1 compiler. *) Bugfix: nginx could not be built by gcc on Solaris; the bug had appeared in 1.1.15.
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_autoindex_module.c4
-rw-r--r--src/http/modules/ngx_http_flv_module.c7
-rw-r--r--src/http/modules/ngx_http_gzip_static_module.c7
-rw-r--r--src/http/modules/ngx_http_headers_filter_module.c4
-rw-r--r--src/http/modules/ngx_http_index_module.c18
-rw-r--r--src/http/modules/ngx_http_limit_conn_module.c23
-rw-r--r--src/http/modules/ngx_http_limit_req_module.c57
-rw-r--r--src/http/modules/ngx_http_log_module.c34
-rw-r--r--src/http/modules/ngx_http_memcached_module.c4
-rw-r--r--src/http/modules/ngx_http_mp4_module.c7
-rw-r--r--src/http/modules/ngx_http_proxy_module.c4
-rw-r--r--src/http/modules/ngx_http_random_index_module.c4
-rw-r--r--src/http/modules/ngx_http_rewrite_module.c4
-rw-r--r--src/http/modules/ngx_http_static_module.c7
-rw-r--r--src/http/modules/ngx_http_userid_filter_module.c4
-rw-r--r--src/http/modules/perl/nginx.pm6
-rw-r--r--src/http/modules/perl/nginx.xs7
17 files changed, 104 insertions, 97 deletions
diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c
index 9b54d0cf9..450a48e50 100644
--- a/src/http/modules/ngx_http_autoindex_module.c
+++ b/src/http/modules/ngx_http_autoindex_module.c
@@ -95,8 +95,8 @@ static ngx_http_module_t ngx_http_autoindex_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_autoindex_create_loc_conf, /* create location configration */
- ngx_http_autoindex_merge_loc_conf /* merge location configration */
+ ngx_http_autoindex_create_loc_conf, /* create location configuration */
+ ngx_http_autoindex_merge_loc_conf /* merge location configuration */
};
diff --git a/src/http/modules/ngx_http_flv_module.c b/src/http/modules/ngx_http_flv_module.c
index 292e37013..719a01124 100644
--- a/src/http/modules/ngx_http_flv_module.c
+++ b/src/http/modules/ngx_http_flv_module.c
@@ -109,9 +109,10 @@ ngx_http_flv_handler(ngx_http_request_t *r)
of.min_uses = clcf->open_file_cache_min_uses;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
-#if (NGX_HAVE_OPENAT)
- of.disable_symlinks = clcf->disable_symlinks;
-#endif
+
+ if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
diff --git a/src/http/modules/ngx_http_gzip_static_module.c b/src/http/modules/ngx_http_gzip_static_module.c
index 2fad280e9..46ce8f3f3 100644
--- a/src/http/modules/ngx_http_gzip_static_module.c
+++ b/src/http/modules/ngx_http_gzip_static_module.c
@@ -129,9 +129,10 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
of.min_uses = clcf->open_file_cache_min_uses;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
-#if (NGX_HAVE_OPENAT)
- of.disable_symlinks = clcf->disable_symlinks;
-#endif
+
+ if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c
index ff33f1f78..e6cf3f423 100644
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -149,7 +149,9 @@ ngx_http_headers_filter(ngx_http_request_t *r)
&& r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT
&& r->headers_out.status != NGX_HTTP_MOVED_PERMANENTLY
&& r->headers_out.status != NGX_HTTP_MOVED_TEMPORARILY
- && r->headers_out.status != NGX_HTTP_NOT_MODIFIED))
+ && r->headers_out.status != NGX_HTTP_SEE_OTHER
+ && r->headers_out.status != NGX_HTTP_NOT_MODIFIED
+ && r->headers_out.status != NGX_HTTP_TEMPORARY_REDIRECT))
{
return ngx_http_next_header_filter(r);
}
diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c
index 7d99c18e5..cfe4ba6cc 100644
--- a/src/http/modules/ngx_http_index_module.c
+++ b/src/http/modules/ngx_http_index_module.c
@@ -62,8 +62,8 @@ static ngx_http_module_t ngx_http_index_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_index_create_loc_conf, /* create location configration */
- ngx_http_index_merge_loc_conf /* merge location configration */
+ ngx_http_index_create_loc_conf, /* create location configuration */
+ ngx_http_index_merge_loc_conf /* merge location configuration */
};
@@ -209,9 +209,10 @@ ngx_http_index_handler(ngx_http_request_t *r)
of.test_only = 1;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
-#if (NGX_HAVE_OPENAT)
- of.disable_symlinks = clcf->disable_symlinks;
-#endif
+
+ if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
@@ -307,9 +308,10 @@ ngx_http_index_test_dir(ngx_http_request_t *r, ngx_http_core_loc_conf_t *clcf,
of.test_only = 1;
of.valid = clcf->open_file_cache_valid;
of.errors = clcf->open_file_cache_errors;
-#if (NGX_HAVE_OPENAT)
- of.disable_symlinks = clcf->disable_symlinks;
-#endif
+
+ if (ngx_http_set_disable_symlinks(r, clcf, &dir, &of) != NGX_OK) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
if (ngx_open_cached_file(clcf->open_file_cache, &dir, &of, r->pool)
!= NGX_OK)
diff --git a/src/http/modules/ngx_http_limit_conn_module.c b/src/http/modules/ngx_http_limit_conn_module.c
index 6322fd682..c23c046ed 100644
--- a/src/http/modules/ngx_http_limit_conn_module.c
+++ b/src/http/modules/ngx_http_limit_conn_module.c
@@ -118,8 +118,8 @@ static ngx_http_module_t ngx_http_limit_conn_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_limit_conn_create_conf, /* create location configration */
- ngx_http_limit_conn_merge_conf /* merge location configration */
+ ngx_http_limit_conn_create_conf, /* create location configuration */
+ ngx_http_limit_conn_merge_conf /* merge location configuration */
};
@@ -325,20 +325,15 @@ ngx_http_limit_conn_lookup(ngx_rbtree_t *rbtree, ngx_http_variable_value_t *vv,
/* hash == node->key */
- do {
- lcn = (ngx_http_limit_conn_node_t *) &node->color;
-
- rc = ngx_memn2cmp(vv->data, lcn->data,
- (size_t) vv->len, (size_t) lcn->len);
- if (rc == 0) {
- return node;
- }
+ lcn = (ngx_http_limit_conn_node_t *) &node->color;
- node = (rc < 0) ? node->left : node->right;
-
- } while (node != sentinel && hash == node->key);
+ rc = ngx_memn2cmp(vv->data, lcn->data,
+ (size_t) vv->len, (size_t) lcn->len);
+ if (rc == 0) {
+ return node;
+ }
- break;
+ node = (rc < 0) ? node->left : node->right;
}
return NULL;
diff --git a/src/http/modules/ngx_http_limit_req_module.c b/src/http/modules/ngx_http_limit_req_module.c
index e4d90a98f..18db71549 100644
--- a/src/http/modules/ngx_http_limit_req_module.c
+++ b/src/http/modules/ngx_http_limit_req_module.c
@@ -121,8 +121,8 @@ static ngx_http_module_t ngx_http_limit_req_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_limit_req_create_conf, /* create location configration */
- ngx_http_limit_req_merge_conf /* merge location configration */
+ ngx_http_limit_req_create_conf, /* create location configuration */
+ ngx_http_limit_req_merge_conf /* merge location configuration */
};
@@ -385,47 +385,42 @@ ngx_http_limit_req_lookup(ngx_http_limit_req_limit_t *limit, ngx_uint_t hash,
/* hash == node->key */
- do {
- lr = (ngx_http_limit_req_node_t *) &node->color;
+ lr = (ngx_http_limit_req_node_t *) &node->color;
- rc = ngx_memn2cmp(data, lr->data, len, (size_t) lr->len);
+ rc = ngx_memn2cmp(data, lr->data, len, (size_t) lr->len);
- if (rc == 0) {
- ngx_queue_remove(&lr->queue);
- ngx_queue_insert_head(&ctx->sh->queue, &lr->queue);
+ if (rc == 0) {
+ ngx_queue_remove(&lr->queue);
+ ngx_queue_insert_head(&ctx->sh->queue, &lr->queue);
- ms = (ngx_msec_int_t) (now - lr->last);
-
- excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000;
-
- if (excess < 0) {
- excess = 0;
- }
-
- *ep = excess;
+ ms = (ngx_msec_int_t) (now - lr->last);
- if ((ngx_uint_t) excess > limit->burst) {
- return NGX_BUSY;
- }
+ excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000;
- if (account) {
- lr->excess = excess;
- lr->last = now;
- return NGX_OK;
- }
+ if (excess < 0) {
+ excess = 0;
+ }
- lr->count++;
+ *ep = excess;
- ctx->node = lr;
+ if ((ngx_uint_t) excess > limit->burst) {
+ return NGX_BUSY;
+ }
- return NGX_AGAIN;
+ if (account) {
+ lr->excess = excess;
+ lr->last = now;
+ return NGX_OK;
}
- node = (rc < 0) ? node->left : node->right;
+ lr->count++;
- } while (node != sentinel && hash == node->key);
+ ctx->node = lr;
+
+ return NGX_AGAIN;
+ }
- break;
+ node = (rc < 0) ? node->left : node->right;
}
*ep = 0;
diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c
index da3b33c96..2452f23b3 100644
--- a/src/http/modules/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -161,8 +161,8 @@ static ngx_http_module_t ngx_http_log_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_log_create_loc_conf, /* create location configration */
- ngx_http_log_merge_loc_conf /* merge location configration */
+ ngx_http_log_create_loc_conf, /* create location configuration */
+ ngx_http_log_merge_loc_conf /* merge location configuration */
};
@@ -377,10 +377,10 @@ ngx_http_log_script_write(ngx_http_request_t *r, ngx_http_log_script_t *script,
if (!r->root_tested) {
- /* test root directory existance */
+ /* test root directory existence */
if (ngx_http_map_uri_to_path(r, &path, &root, 0) == NULL) {
- /* simulate successfull logging */
+ /* simulate successful logging */
return len;
}
@@ -394,22 +394,24 @@ ngx_http_log_script_write(ngx_http_request_t *r, ngx_http_log_script_t *script,
of.test_only = 1;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
-#if (NGX_HAVE_OPENAT)
- of.disable_symlinks = clcf->disable_symlinks;
-#endif
+
+ if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
+ /* simulate successful logging */
+ return len;
+ }
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
{
if (of.err == 0) {
- /* simulate successfull logging */
+ /* simulate successful logging */
return len;
}
ngx_log_error(NGX_LOG_ERR, r->connection->log, of.err,
"testing \"%s\" existence failed", path.data);
- /* simulate successfull logging */
+ /* simulate successful logging */
return len;
}
@@ -417,7 +419,7 @@ ngx_http_log_script_write(ngx_http_request_t *r, ngx_http_log_script_t *script,
ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_ENOTDIR,
"testing \"%s\" existence failed", path.data);
- /* simulate successfull logging */
+ /* simulate successful logging */
return len;
}
}
@@ -426,7 +428,7 @@ ngx_http_log_script_write(ngx_http_request_t *r, ngx_http_log_script_t *script,
script->values->elts)
== NULL)
{
- /* simulate successfull logging */
+ /* simulate successful logging */
return len;
}
@@ -444,16 +446,18 @@ ngx_http_log_script_write(ngx_http_request_t *r, ngx_http_log_script_t *script,
of.valid = llcf->open_file_cache_valid;
of.min_uses = llcf->open_file_cache_min_uses;
of.directio = NGX_OPEN_FILE_DIRECTIO_OFF;
-#if (NGX_HAVE_OPENAT)
- of.disable_symlinks = clcf->disable_symlinks;
-#endif
+
+ if (ngx_http_set_disable_symlinks(r, clcf, &log, &of) != NGX_OK) {
+ /* simulate successful logging */
+ return len;
+ }
if (ngx_open_cached_file(llcf->open_file_cache, &log, &of, r->pool)
!= NGX_OK)
{
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
"%s \"%s\" failed", of.failed, log.data);
- /* simulate successfull logging */
+ /* simulate successful logging */
return len;
}
diff --git a/src/http/modules/ngx_http_memcached_module.c b/src/http/modules/ngx_http_memcached_module.c
index be45d4eeb..5077ded9a 100644
--- a/src/http/modules/ngx_http_memcached_module.c
+++ b/src/http/modules/ngx_http_memcached_module.c
@@ -115,8 +115,8 @@ static ngx_http_module_t ngx_http_memcached_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_memcached_create_loc_conf, /* create location configration */
- ngx_http_memcached_merge_loc_conf /* merge location configration */
+ ngx_http_memcached_create_loc_conf, /* create location configuration */
+ ngx_http_memcached_merge_loc_conf /* merge location configuration */
};
diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c
index f63b2bc56..384125a03 100644
--- a/src/http/modules/ngx_http_mp4_module.c
+++ b/src/http/modules/ngx_http_mp4_module.c
@@ -440,9 +440,10 @@ ngx_http_mp4_handler(ngx_http_request_t *r)
of.min_uses = clcf->open_file_cache_min_uses;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
-#if (NGX_HAVE_OPENAT)
- of.disable_symlinks = clcf->disable_symlinks;
-#endif
+
+ if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index f2bff3d3d..678c70e77 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -530,8 +530,8 @@ static ngx_http_module_t ngx_http_proxy_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_proxy_create_loc_conf, /* create location configration */
- ngx_http_proxy_merge_loc_conf /* merge location configration */
+ ngx_http_proxy_create_loc_conf, /* create location configuration */
+ ngx_http_proxy_merge_loc_conf /* merge location configuration */
};
diff --git a/src/http/modules/ngx_http_random_index_module.c b/src/http/modules/ngx_http_random_index_module.c
index 67f34f739..b0f0e0809 100644
--- a/src/http/modules/ngx_http_random_index_module.c
+++ b/src/http/modules/ngx_http_random_index_module.c
@@ -49,8 +49,8 @@ static ngx_http_module_t ngx_http_random_index_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_random_index_create_loc_conf, /* create location configration */
- ngx_http_random_index_merge_loc_conf /* merge location configration */
+ ngx_http_random_index_create_loc_conf, /* create location configuration */
+ ngx_http_random_index_merge_loc_conf /* merge location configuration */
};
diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c
index 98da67f27..74d26e524 100644
--- a/src/http/modules/ngx_http_rewrite_module.c
+++ b/src/http/modules/ngx_http_rewrite_module.c
@@ -112,8 +112,8 @@ static ngx_http_module_t ngx_http_rewrite_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_rewrite_create_loc_conf, /* create location configration */
- ngx_http_rewrite_merge_loc_conf /* merge location configration */
+ ngx_http_rewrite_create_loc_conf, /* create location configuration */
+ ngx_http_rewrite_merge_loc_conf /* merge location configuration */
};
diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c
index f4904fc00..9d77e43b1 100644
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -94,9 +94,10 @@ ngx_http_static_handler(ngx_http_request_t *r)
of.min_uses = clcf->open_file_cache_min_uses;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
-#if (NGX_HAVE_OPENAT)
- of.disable_symlinks = clcf->disable_symlinks;
-#endif
+
+ if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
diff --git a/src/http/modules/ngx_http_userid_filter_module.c b/src/http/modules/ngx_http_userid_filter_module.c
index 8713dd629..1487c091e 100644
--- a/src/http/modules/ngx_http_userid_filter_module.c
+++ b/src/http/modules/ngx_http_userid_filter_module.c
@@ -166,8 +166,8 @@ static ngx_http_module_t ngx_http_userid_filter_module_ctx = {
NULL, /* create server configuration */
NULL, /* merge server configuration */
- ngx_http_userid_create_conf, /* create location configration */
- ngx_http_userid_merge_conf /* merge location configration */
+ ngx_http_userid_create_conf, /* create location configuration */
+ ngx_http_userid_merge_conf /* merge location configuration */
};
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index b671c2dd0..b6fbdfd45 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -21,7 +21,9 @@ our @EXPORT = qw(
HTTP_MOVED_PERMANENTLY
HTTP_MOVED_TEMPORARILY
HTTP_REDIRECT
+ HTTP_SEE_OTHER
HTTP_NOT_MODIFIED
+ HTTP_TEMPORARY_REDIRECT
HTTP_BAD_REQUEST
HTTP_UNAUTHORIZED
@@ -48,7 +50,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '1.1.15';
+our $VERSION = '1.1.16';
require XSLoader;
XSLoader::load('nginx', $VERSION);
@@ -67,7 +69,9 @@ use constant HTTP_PARTIAL_CONTENT => 206;
use constant HTTP_MOVED_PERMANENTLY => 301;
use constant HTTP_MOVED_TEMPORARILY => 302;
use constant HTTP_REDIRECT => 302;
+use constant HTTP_SEE_OTHER => 303;
use constant HTTP_NOT_MODIFIED => 304;
+use constant HTTP_TEMPORARY_REDIRECT => 307;
use constant HTTP_BAD_REQUEST => 400;
use constant HTTP_UNAUTHORIZED => 401;
diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
index 8def03eb1..ecd11ffbc 100644
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -662,9 +662,10 @@ sendfile(r, filename, offset = -1, bytes = 0)
of.min_uses = clcf->open_file_cache_min_uses;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
-#if (NGX_HAVE_OPENAT)
- of.disable_symlinks = clcf->disable_symlinks;
-#endif
+
+ if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
+ XSRETURN_EMPTY;
+ }
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)