Mercurial > hg > nginx-quic
comparison src/http/ngx_http_upstream.c @ 3669:1f5841b1fcd7
treat Set-Cookie as a header that forbids caching
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 02 Jul 2010 09:49:27 +0000 |
parents | 12bd9e26fadb |
children | 045ea40cbfe8 |
comparison
equal
deleted
inserted
replaced
3668:1d4c7aaed5d2 | 3669:1f5841b1fcd7 |
---|---|
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 }, |
358 ngx_conf_bitmask_t ngx_http_upstream_ignore_headers_masks[] = { | 360 ngx_conf_bitmask_t ngx_http_upstream_ignore_headers_masks[] = { |
359 { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT }, | 361 { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT }, |
360 { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES }, | 362 { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES }, |
361 { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES }, | 363 { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES }, |
362 { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL }, | 364 { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL }, |
365 { ngx_string("Set-Cookie"), NGX_HTTP_UPSTREAM_IGN_SET_COOKIE }, | |
363 { ngx_null_string, 0 } | 366 { ngx_null_string, 0 } |
364 }; | 367 }; |
365 | 368 |
366 | 369 |
367 ngx_int_t | 370 ngx_int_t |
2992 return NGX_OK; | 2995 return NGX_OK; |
2993 } | 2996 } |
2994 | 2997 |
2995 | 2998 |
2996 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 | |
2997 ngx_http_upstream_process_cache_control(ngx_http_request_t *r, | 3018 ngx_http_upstream_process_cache_control(ngx_http_request_t *r, |
2998 ngx_table_elt_t *h, ngx_uint_t offset) | 3019 ngx_table_elt_t *h, ngx_uint_t offset) |
2999 { | 3020 { |
3000 ngx_array_t *pa; | 3021 ngx_array_t *pa; |
3001 ngx_table_elt_t **ph; | 3022 ngx_table_elt_t **ph; |