Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_proxy_module.c @ 2706:f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 15 Apr 2009 11:42:49 +0000 |
parents | d040c3786239 |
children | d5896f6608e8 |
comparison
equal
deleted
inserted
replaced
2705:d040c3786239 | 2706:f905a6ab0ca8 |
---|---|
482 { ngx_string("Expect"), ngx_string("") }, | 482 { ngx_string("Expect"), ngx_string("") }, |
483 { ngx_null_string, ngx_null_string } | 483 { ngx_null_string, ngx_null_string } |
484 }; | 484 }; |
485 | 485 |
486 | 486 |
487 static ngx_str_t ngx_http_proxy_hide_headers[] = { | |
488 ngx_string("Date"), | |
489 ngx_string("Server"), | |
490 ngx_string("X-Pad"), | |
491 ngx_string("X-Accel-Expires"), | |
492 ngx_string("X-Accel-Redirect"), | |
493 ngx_string("X-Accel-Limit-Rate"), | |
494 ngx_string("X-Accel-Buffering"), | |
495 ngx_string("X-Accel-Charset"), | |
496 ngx_null_string | |
497 }; | |
498 | |
499 | |
487 #if (NGX_HTTP_CACHE) | 500 #if (NGX_HTTP_CACHE) |
488 | 501 |
489 static ngx_keyval_t ngx_http_proxy_cache_headers[] = { | 502 static ngx_keyval_t ngx_http_proxy_cache_headers[] = { |
490 { ngx_string("Host"), ngx_string("$proxy_host") }, | 503 { ngx_string("Host"), ngx_string("$proxy_host") }, |
491 { ngx_string("Connection"), ngx_string("close") }, | 504 { ngx_string("Connection"), ngx_string("close") }, |
498 { ngx_string("Range"), ngx_string("") }, | 511 { ngx_string("Range"), ngx_string("") }, |
499 { ngx_string("If-Range"), ngx_string("") }, | 512 { ngx_string("If-Range"), ngx_string("") }, |
500 { ngx_null_string, ngx_null_string } | 513 { ngx_null_string, ngx_null_string } |
501 }; | 514 }; |
502 | 515 |
503 #endif | 516 |
504 | 517 static ngx_str_t ngx_http_proxy_hide_cache_headers[] = { |
505 | |
506 static ngx_str_t ngx_http_proxy_hide_headers[] = { | |
507 ngx_string("Date"), | 518 ngx_string("Date"), |
508 ngx_string("Server"), | 519 ngx_string("Server"), |
509 ngx_string("X-Pad"), | 520 ngx_string("X-Pad"), |
510 ngx_string("X-Accel-Expires"), | 521 ngx_string("X-Accel-Expires"), |
511 ngx_string("X-Accel-Redirect"), | 522 ngx_string("X-Accel-Redirect"), |
512 ngx_string("X-Accel-Limit-Rate"), | 523 ngx_string("X-Accel-Limit-Rate"), |
513 ngx_string("X-Accel-Buffering"), | 524 ngx_string("X-Accel-Buffering"), |
514 ngx_string("X-Accel-Charset"), | 525 ngx_string("X-Accel-Charset"), |
526 ngx_string("Set-Cookie"), | |
527 ngx_string("P3P"), | |
515 ngx_null_string | 528 ngx_null_string |
516 }; | 529 }; |
530 | |
531 #endif | |
517 | 532 |
518 | 533 |
519 static ngx_http_variable_t ngx_http_proxy_vars[] = { | 534 static ngx_http_variable_t ngx_http_proxy_vars[] = { |
520 | 535 |
521 { ngx_string("proxy_host"), NULL, ngx_http_proxy_host_variable, 0, | 536 { ngx_string("proxy_host"), NULL, ngx_http_proxy_host_variable, 0, |
1923 { | 1938 { |
1924 ngx_http_proxy_loc_conf_t *prev = parent; | 1939 ngx_http_proxy_loc_conf_t *prev = parent; |
1925 ngx_http_proxy_loc_conf_t *conf = child; | 1940 ngx_http_proxy_loc_conf_t *conf = child; |
1926 | 1941 |
1927 size_t size; | 1942 size_t size; |
1943 ngx_str_t *h; | |
1928 ngx_keyval_t *s; | 1944 ngx_keyval_t *s; |
1929 ngx_hash_init_t hash; | 1945 ngx_hash_init_t hash; |
1930 ngx_http_proxy_redirect_t *pr; | 1946 ngx_http_proxy_redirect_t *pr; |
1931 ngx_http_script_compile_t sc; | 1947 ngx_http_script_compile_t sc; |
1932 | 1948 |
2187 | 2203 |
2188 hash.max_size = conf->headers_hash_max_size; | 2204 hash.max_size = conf->headers_hash_max_size; |
2189 hash.bucket_size = conf->headers_hash_bucket_size; | 2205 hash.bucket_size = conf->headers_hash_bucket_size; |
2190 hash.name = "proxy_headers_hash"; | 2206 hash.name = "proxy_headers_hash"; |
2191 | 2207 |
2208 #if (NGX_HTTP_CACHE) | |
2209 | |
2210 h = conf->upstream.cache ? ngx_http_proxy_hide_cache_headers: | |
2211 ngx_http_proxy_hide_headers; | |
2212 #else | |
2213 | |
2214 h = ngx_http_proxy_hide_headers; | |
2215 | |
2216 #endif | |
2217 | |
2192 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream, | 2218 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream, |
2193 &prev->upstream, | 2219 &prev->upstream, h, &hash) |
2194 ngx_http_proxy_hide_headers, &hash) | |
2195 != NGX_OK) | 2220 != NGX_OK) |
2196 { | 2221 { |
2197 return NGX_CONF_ERROR; | 2222 return NGX_CONF_ERROR; |
2198 } | 2223 } |
2199 | 2224 |