comparison 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
comparison
equal deleted inserted replaced
583:39e50617266a 584:016632f0fb18
70 static void ngx_http_upstream_finalize_request(ngx_http_request_t *r, 70 static void ngx_http_upstream_finalize_request(ngx_http_request_t *r,
71 ngx_http_upstream_t *u, ngx_int_t rc); 71 ngx_http_upstream_t *u, ngx_int_t rc);
72 72
73 static ngx_int_t ngx_http_upstream_process_header_line(ngx_http_request_t *r, 73 static ngx_int_t ngx_http_upstream_process_header_line(ngx_http_request_t *r,
74 ngx_table_elt_t *h, ngx_uint_t offset); 74 ngx_table_elt_t *h, ngx_uint_t offset);
75 static ngx_int_t ngx_http_upstream_process_set_cookie(ngx_http_request_t *r,
76 ngx_table_elt_t *h, ngx_uint_t offset);
75 static ngx_int_t 77 static ngx_int_t
76 ngx_http_upstream_process_cache_control(ngx_http_request_t *r, 78 ngx_http_upstream_process_cache_control(ngx_http_request_t *r,
77 ngx_table_elt_t *h, ngx_uint_t offset); 79 ngx_table_elt_t *h, ngx_uint_t offset);
78 static ngx_int_t ngx_http_upstream_ignore_header_line(ngx_http_request_t *r, 80 static ngx_int_t ngx_http_upstream_ignore_header_line(ngx_http_request_t *r,
79 ngx_table_elt_t *h, ngx_uint_t offset); 81 ngx_table_elt_t *h, ngx_uint_t offset);
187 { ngx_string("Refresh"), 189 { ngx_string("Refresh"),
188 ngx_http_upstream_ignore_header_line, 0, 190 ngx_http_upstream_ignore_header_line, 0,
189 ngx_http_upstream_rewrite_refresh, 0, 0 }, 191 ngx_http_upstream_rewrite_refresh, 0, 0 },
190 192
191 { ngx_string("Set-Cookie"), 193 { ngx_string("Set-Cookie"),
192 ngx_http_upstream_ignore_header_line, 0, 194 ngx_http_upstream_process_set_cookie, 0,
193 ngx_http_upstream_copy_header_line, 0, 1 }, 195 ngx_http_upstream_copy_header_line, 0, 1 },
194 196
195 { ngx_string("Content-Disposition"), 197 { ngx_string("Content-Disposition"),
196 ngx_http_upstream_ignore_header_line, 0, 198 ngx_http_upstream_ignore_header_line, 0,
197 ngx_http_upstream_copy_header_line, 0, 1 }, 199 ngx_http_upstream_copy_header_line, 0, 1 },
353 { ngx_string("POST"), NGX_HTTP_POST }, 355 { ngx_string("POST"), NGX_HTTP_POST },
354 { ngx_null_string, 0 } 356 { ngx_null_string, 0 }
355 }; 357 };
356 358
357 359
360 ngx_conf_bitmask_t ngx_http_upstream_ignore_headers_masks[] = {
361 { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
362 { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
363 { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
364 { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
365 { ngx_string("Set-Cookie"), NGX_HTTP_UPSTREAM_IGN_SET_COOKIE },
366 { ngx_null_string, 0 }
367 };
368
369
358 ngx_int_t 370 ngx_int_t
359 ngx_http_upstream_create(ngx_http_request_t *r) 371 ngx_http_upstream_create(ngx_http_request_t *r)
360 { 372 {
361 ngx_http_upstream_t *u; 373 ngx_http_upstream_t *u;
362 374
2983 return NGX_OK; 2995 return NGX_OK;
2984 } 2996 }
2985 2997
2986 2998
2987 static ngx_int_t 2999 static ngx_int_t
3000 ngx_http_upstream_process_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h,
3001 ngx_uint_t offset)
3002 {
3003 #if (NGX_HTTP_CACHE)
3004 ngx_http_upstream_t *u;
3005
3006 u = r->upstream;
3007
3008 if (!(u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_SET_COOKIE)) {
3009 u->cacheable = 0;
3010 }
3011 #endif
3012
3013 return NGX_OK;
3014 }
3015
3016
3017 static ngx_int_t
2988 ngx_http_upstream_process_cache_control(ngx_http_request_t *r, 3018 ngx_http_upstream_process_cache_control(ngx_http_request_t *r,
2989 ngx_table_elt_t *h, ngx_uint_t offset) 3019 ngx_table_elt_t *h, ngx_uint_t offset)
2990 { 3020 {
2991 ngx_array_t *pa; 3021 ngx_array_t *pa;
2992 ngx_table_elt_t **ph; 3022 ngx_table_elt_t **ph;