summaryrefslogtreecommitdiff
path: root/src/http/modules
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-07-05 15:24:02 +0000
committerJonathan Kolb <jon@b0g.us>2010-07-05 15:24:02 +0000
commiteca0feeb4654215e90ddc20151ff0f8157be89b5 (patch)
treeae43ad5cdab1ac258bef2e47f92c2ff5e28af6f5 /src/http/modules
parentb7854e35967b1aa6241be5b85b9722efc8c94a3f (diff)
downloadnginx-eca0feeb4654215e90ddc20151ff0f8157be89b5.tar.gz
Changes with nginx 0.8.44 05 Jul 2010v0.8.44
*) Change: now nginx does not cache by default backend responses, if they have a "Set-Cookie" header line. *) Feature: the "listen" directive supports the "setfib" parameter. Thanks to Andrew Filonov. *) Bugfix: the "sub_filter" directive might change character case on partial match. *) Bugfix: compatibility with HP/UX. *) Bugfix: compatibility with AIX xcl_r compiler. *) Bugfix: nginx treated a large SSLv2 packets as plain requests. Thanks to Miroslaw Jaworski.
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_fastcgi_module.c37
-rw-r--r--src/http/modules/ngx_http_proxy_module.c39
-rw-r--r--src/http/modules/ngx_http_scgi_module.c37
-rw-r--r--src/http/modules/ngx_http_sub_filter_module.c53
-rw-r--r--src/http/modules/ngx_http_uwsgi_module.c36
-rw-r--r--src/http/modules/perl/nginx.pm2
6 files changed, 45 insertions, 159 deletions
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index e5d2af0b8..16d2bf8a0 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -183,15 +183,6 @@ static ngx_conf_bitmask_t ngx_http_fastcgi_next_upstream_masks[] = {
};
-static ngx_conf_bitmask_t ngx_http_fastcgi_ignore_headers_masks[] = {
- { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
- { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
- { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
- { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
- { ngx_null_string, 0 }
-};
-
-
ngx_module_t ngx_http_fastcgi_module;
@@ -430,7 +421,7 @@ static ngx_command_t ngx_http_fastcgi_commands[] = {
ngx_conf_set_bitmask_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_fastcgi_loc_conf_t, upstream.ignore_headers),
- &ngx_http_fastcgi_ignore_headers_masks },
+ &ngx_http_upstream_ignore_headers_masks },
{ ngx_string("fastcgi_catch_stderr"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
@@ -524,19 +515,6 @@ static ngx_str_t ngx_http_fastcgi_hide_headers[] = {
#if (NGX_HTTP_CACHE)
-static ngx_str_t ngx_http_fastcgi_hide_cache_headers[] = {
- ngx_string("Status"),
- ngx_string("X-Accel-Expires"),
- ngx_string("X-Accel-Redirect"),
- ngx_string("X-Accel-Limit-Rate"),
- ngx_string("X-Accel-Buffering"),
- ngx_string("X-Accel-Charset"),
- ngx_string("Set-Cookie"),
- ngx_string("P3P"),
- ngx_null_string
-};
-
-
static ngx_keyval_t ngx_http_fastcgi_cache_headers[] = {
{ ngx_string("HTTP_IF_MODIFIED_SINCE"), ngx_string("") },
{ ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") },
@@ -2034,7 +2012,6 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
u_char *p;
size_t size;
uintptr_t *code;
- ngx_str_t *hide;
ngx_uint_t i;
ngx_array_t headers_names;
ngx_keyval_t *src;
@@ -2260,18 +2237,8 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
hash.bucket_size = ngx_align(64, ngx_cacheline_size);
hash.name = "fastcgi_hide_headers_hash";
-#if (NGX_HTTP_CACHE)
-
- hide = conf->upstream.cache ? ngx_http_fastcgi_hide_cache_headers:
- ngx_http_fastcgi_hide_headers;
-#else
-
- hide = ngx_http_fastcgi_hide_headers;
-
-#endif
-
if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
- &prev->upstream, hide, &hash)
+ &prev->upstream, ngx_http_fastcgi_hide_headers, &hash)
!= NGX_OK)
{
return NGX_CONF_ERROR;
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index de591a7fc..fcae88e12 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -157,15 +157,6 @@ static ngx_conf_bitmask_t ngx_http_proxy_next_upstream_masks[] = {
};
-static ngx_conf_bitmask_t ngx_http_proxy_ignore_headers_masks[] = {
- { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
- { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
- { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
- { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
- { ngx_null_string, 0 }
-};
-
-
ngx_module_t ngx_http_proxy_module;
@@ -432,7 +423,7 @@ static ngx_command_t ngx_http_proxy_commands[] = {
ngx_conf_set_bitmask_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_proxy_loc_conf_t, upstream.ignore_headers),
- &ngx_http_proxy_ignore_headers_masks },
+ &ngx_http_upstream_ignore_headers_masks },
#if (NGX_HTTP_SSL)
@@ -521,21 +512,6 @@ static ngx_keyval_t ngx_http_proxy_cache_headers[] = {
{ ngx_null_string, ngx_null_string }
};
-
-static ngx_str_t ngx_http_proxy_hide_cache_headers[] = {
- ngx_string("Date"),
- ngx_string("Server"),
- ngx_string("X-Pad"),
- ngx_string("X-Accel-Expires"),
- ngx_string("X-Accel-Redirect"),
- ngx_string("X-Accel-Limit-Rate"),
- ngx_string("X-Accel-Buffering"),
- ngx_string("X-Accel-Charset"),
- ngx_string("Set-Cookie"),
- ngx_string("P3P"),
- ngx_null_string
-};
-
#endif
@@ -1734,7 +1710,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_http_proxy_loc_conf_t *conf = child;
size_t size;
- ngx_str_t *h;
ngx_keyval_t *s;
ngx_hash_init_t hash;
ngx_http_proxy_redirect_t *pr;
@@ -2018,18 +1993,8 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
hash.bucket_size = conf->headers_hash_bucket_size;
hash.name = "proxy_headers_hash";
-#if (NGX_HTTP_CACHE)
-
- h = conf->upstream.cache ? ngx_http_proxy_hide_cache_headers:
- ngx_http_proxy_hide_headers;
-#else
-
- h = ngx_http_proxy_hide_headers;
-
-#endif
-
if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
- &prev->upstream, h, &hash)
+ &prev->upstream, ngx_http_proxy_hide_headers, &hash)
!= NGX_OK)
{
return NGX_CONF_ERROR;
diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
index 546bce066..c6d848e4b 100644
--- a/src/http/modules/ngx_http_scgi_module.c
+++ b/src/http/modules/ngx_http_scgi_module.c
@@ -70,15 +70,6 @@ static ngx_conf_bitmask_t ngx_http_scgi_next_upstream_masks[] = {
};
-static ngx_conf_bitmask_t ngx_http_scgi_ignore_headers_masks[] = {
- { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
- { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
- { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
- { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
- { ngx_null_string, 0 }
-};
-
-
ngx_module_t ngx_http_scgi_module;
@@ -296,7 +287,7 @@ static ngx_command_t ngx_http_scgi_commands[] = {
ngx_conf_set_bitmask_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_scgi_loc_conf_t, upstream.ignore_headers),
- &ngx_http_scgi_ignore_headers_masks },
+ &ngx_http_upstream_ignore_headers_masks },
ngx_null_command
};
@@ -346,19 +337,6 @@ static ngx_str_t ngx_http_scgi_hide_headers[] = {
#if (NGX_HTTP_CACHE)
-static ngx_str_t ngx_http_scgi_hide_cache_headers[] = {
- ngx_string("Status"),
- ngx_string("X-Accel-Expires"),
- ngx_string("X-Accel-Redirect"),
- ngx_string("X-Accel-Limit-Rate"),
- ngx_string("X-Accel-Buffering"),
- ngx_string("X-Accel-Charset"),
- ngx_string("Set-Cookie"),
- ngx_string("P3P"),
- ngx_null_string
-};
-
-
static ngx_keyval_t ngx_http_scgi_cache_headers[] = {
{ ngx_string("HTTP_IF_MODIFIED_SINCE"), ngx_string("") },
{ ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") },
@@ -1061,7 +1039,6 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
u_char *p;
size_t size;
uintptr_t *code;
- ngx_str_t *hide;
ngx_uint_t i;
ngx_array_t headers_names;
ngx_keyval_t *src;
@@ -1280,18 +1257,8 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
hash.bucket_size = ngx_align(64, ngx_cacheline_size);
hash.name = "scgi_hide_headers_hash";
-#if (NGX_HTTP_CACHE)
-
- hide = conf->upstream.cache ? ngx_http_scgi_hide_cache_headers:
- ngx_http_scgi_hide_headers;
-#else
-
- hide = ngx_http_scgi_hide_headers;
-
-#endif
-
if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
- &prev->upstream, hide, &hash)
+ &prev->upstream, ngx_http_scgi_hide_headers, &hash)
!= NGX_OK)
{
return NGX_CONF_ERROR;
diff --git a/src/http/modules/ngx_http_sub_filter_module.c b/src/http/modules/ngx_http_sub_filter_module.c
index d12ed8fe2..ddc69ba52 100644
--- a/src/http/modules/ngx_http_sub_filter_module.c
+++ b/src/http/modules/ngx_http_sub_filter_module.c
@@ -29,6 +29,8 @@ typedef enum {
typedef struct {
ngx_str_t match;
+ ngx_str_t saved;
+ ngx_str_t looked;
ngx_uint_t once; /* unsigned once:1 */
@@ -47,8 +49,6 @@ typedef struct {
ngx_str_t sub;
ngx_uint_t state;
- size_t saved;
- size_t looked;
} ngx_http_sub_ctx_t;
@@ -147,6 +147,16 @@ ngx_http_sub_header_filter(ngx_http_request_t *r)
return NGX_ERROR;
}
+ ctx->saved.data = ngx_pnalloc(r->pool, slcf->match.len);
+ if (ctx->saved.data == NULL) {
+ return NGX_ERROR;
+ }
+
+ ctx->looked.data = ngx_pnalloc(r->pool, slcf->match.len);
+ if (ctx->looked.data == NULL) {
+ return NGX_ERROR;
+ }
+
ngx_http_set_ctx(r, ctx, ngx_http_sub_filter_module);
ctx->match = slcf->match;
@@ -226,13 +236,13 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
while (ctx->pos < ctx->buf->last) {
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "saved: %d state: %d", ctx->saved, ctx->state);
+ "saved: \"%V\" state: %d", &ctx->saved, ctx->state);
rc = ngx_http_sub_parse(r, ctx);
ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "parse: %d, looked: %d %p-%p",
- rc, ctx->looked, ctx->copy_start, ctx->copy_end);
+ "parse: %d, looked: \"%V\" %p-%p",
+ rc, &ctx->looked, ctx->copy_start, ctx->copy_end);
if (rc == NGX_ERROR) {
return rc;
@@ -241,9 +251,9 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
if (ctx->copy_start != ctx->copy_end) {
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "saved: %d", ctx->saved);
+ "saved: \"%V\"", &ctx->saved);
- if (ctx->saved) {
+ if (ctx->saved.len) {
if (ctx->free) {
cl = ctx->free;
@@ -265,14 +275,19 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
cl->buf = b;
}
+ b->pos = ngx_pnalloc(r->pool, ctx->saved.len);
+ if (b->pos == NULL) {
+ return NGX_ERROR;
+ }
+
+ ngx_memcpy(b->pos, ctx->saved.data, ctx->saved.len);
+ b->last = b->pos + ctx->saved.len;
b->memory = 1;
- b->pos = ctx->match.data;
- b->last = ctx->match.data + ctx->saved;
*ctx->last_out = cl;
ctx->last_out = &cl->next;
- ctx->saved = 0;
+ ctx->saved.len = 0;
}
if (ctx->free) {
@@ -405,7 +420,8 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
ctx->buf = NULL;
- ctx->saved = ctx->looked;
+ ctx->saved.len = ctx->looked.len;
+ ngx_memcpy(ctx->saved.data, ctx->looked.data, ctx->looked.len);
}
if (ctx->out == NULL && ctx->busy == NULL) {
@@ -496,7 +512,7 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
ctx->copy_start = ctx->pos;
ctx->copy_end = ctx->buf->last;
ctx->pos = ctx->buf->last;
- ctx->looked = 0;
+ ctx->looked.len = 0;
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "once");
@@ -504,7 +520,7 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
}
state = ctx->state;
- looked = ctx->looked;
+ looked = ctx->looked.len;
last = ctx->buf->last;
copy_end = ctx->copy_end;
@@ -522,6 +538,7 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
for ( ;; ) {
if (ch == match) {
copy_end = p;
+ ctx->looked.data[0] = *p;
looked = 1;
state = sub_match_state;
@@ -538,7 +555,7 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
ctx->state = state;
ctx->pos = p;
- ctx->looked = looked;
+ ctx->looked.len = looked;
ctx->copy_end = p;
if (ctx->copy_start == NULL) {
@@ -555,16 +572,17 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
/* state == sub_match_state */
if (ch == ctx->match.data[looked]) {
+ ctx->looked.data[looked] = *p;
looked++;
if (looked == ctx->match.len) {
if ((size_t) (p - ctx->pos) < looked) {
- ctx->saved = 0;
+ ctx->saved.len = 0;
}
ctx->state = sub_start_state;
ctx->pos = p + 1;
- ctx->looked = 0;
+ ctx->looked.len = 0;
ctx->copy_end = copy_end;
if (ctx->copy_start == NULL && copy_end) {
@@ -576,6 +594,7 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
} else if (ch == ctx->match.data[0]) {
copy_end = p;
+ ctx->looked.data[0] = *p;
looked = 1;
} else {
@@ -587,7 +606,7 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
ctx->state = state;
ctx->pos = p;
- ctx->looked = looked;
+ ctx->looked.len = looked;
ctx->copy_end = (state == sub_start_state) ? p : copy_end;
diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c
index 6597ee289..466d34be0 100644
--- a/src/http/modules/ngx_http_uwsgi_module.c
+++ b/src/http/modules/ngx_http_uwsgi_module.c
@@ -83,15 +83,6 @@ static ngx_conf_bitmask_t ngx_http_uwsgi_next_upstream_masks[] = {
};
-static ngx_conf_bitmask_t ngx_http_uwsgi_ignore_headers_masks[] = {
- { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
- { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
- { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
- { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
- { ngx_null_string, 0 }
-};
-
-
ngx_module_t ngx_http_uwsgi_module;
@@ -330,7 +321,7 @@ static ngx_command_t ngx_http_uwsgi_commands[] = {
ngx_conf_set_bitmask_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_uwsgi_loc_conf_t, upstream.ignore_headers),
- &ngx_http_uwsgi_ignore_headers_masks },
+ &ngx_http_upstream_ignore_headers_masks },
ngx_null_command
};
@@ -379,18 +370,6 @@ static ngx_str_t ngx_http_uwsgi_hide_headers[] = {
#if (NGX_HTTP_CACHE)
-static ngx_str_t ngx_http_uwsgi_hide_cache_headers[] = {
- ngx_string("X-Accel-Expires"),
- ngx_string("X-Accel-Redirect"),
- ngx_string("X-Accel-Limit-Rate"),
- ngx_string("X-Accel-Buffering"),
- ngx_string("X-Accel-Charset"),
- ngx_string("Set-Cookie"),
- ngx_string("P3P"),
- ngx_null_string
-};
-
-
static ngx_keyval_t ngx_http_uwsgi_cache_headers[] = {
{ ngx_string("HTTP_IF_MODIFIED_SINCE"), ngx_string("") },
{ ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") },
@@ -1113,7 +1092,6 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
u_char *p;
size_t size;
uintptr_t *code;
- ngx_str_t *hide;
ngx_uint_t i;
ngx_array_t headers_names;
ngx_keyval_t *src;
@@ -1334,18 +1312,8 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
hash.bucket_size = ngx_align(64, ngx_cacheline_size);
hash.name = "uwsgi_hide_headers_hash";
-#if (NGX_HTTP_CACHE)
-
- hide = conf->upstream.cache ? ngx_http_uwsgi_hide_cache_headers:
- ngx_http_uwsgi_hide_headers;
-#else
-
- hide = ngx_http_uwsgi_hide_headers;
-
-#endif
-
if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
- &prev->upstream, hide, &hash)
+ &prev->upstream, ngx_http_uwsgi_hide_headers, &hash)
!= NGX_OK)
{
return NGX_CONF_ERROR;
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index 500840249..c3f4c2e76 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -48,7 +48,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '0.8.43';
+our $VERSION = '0.8.44';
require XSLoader;
XSLoader::load('nginx', $VERSION);