Mercurial > hg > nginx-vendor-1-0
diff src/http/ngx_http_upstream.c @ 584:016632f0fb18 NGINX_0_8_44
nginx 0.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.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 05 Jul 2010 00:00:00 +0400 |
parents | ff463db0be31 |
children | b6a5942a4e6a |
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -72,6 +72,8 @@ static void ngx_http_upstream_finalize_r static ngx_int_t ngx_http_upstream_process_header_line(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset); +static ngx_int_t ngx_http_upstream_process_set_cookie(ngx_http_request_t *r, + ngx_table_elt_t *h, ngx_uint_t offset); static ngx_int_t ngx_http_upstream_process_cache_control(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset); @@ -189,7 +191,7 @@ ngx_http_upstream_header_t ngx_http_ups ngx_http_upstream_rewrite_refresh, 0, 0 }, { ngx_string("Set-Cookie"), - ngx_http_upstream_ignore_header_line, 0, + ngx_http_upstream_process_set_cookie, 0, ngx_http_upstream_copy_header_line, 0, 1 }, { ngx_string("Content-Disposition"), @@ -355,6 +357,16 @@ ngx_conf_bitmask_t ngx_http_upstream_ca }; +ngx_conf_bitmask_t ngx_http_upstream_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_string("Set-Cookie"), NGX_HTTP_UPSTREAM_IGN_SET_COOKIE }, + { ngx_null_string, 0 } +}; + + ngx_int_t ngx_http_upstream_create(ngx_http_request_t *r) { @@ -2985,6 +2997,24 @@ ngx_http_upstream_ignore_header_line(ngx static ngx_int_t +ngx_http_upstream_process_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h, + ngx_uint_t offset) +{ +#if (NGX_HTTP_CACHE) + ngx_http_upstream_t *u; + + u = r->upstream; + + if (!(u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_SET_COOKIE)) { + u->cacheable = 0; + } +#endif + + return NGX_OK; +} + + +static ngx_int_t ngx_http_upstream_process_cache_control(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset) {