Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_proxy_module.c @ 2944:f892042956e3 stable-0.7
merge r2895, r2896, r2926, r2927, r2928, r2930, and r2936:
various proxy/fastcgi cache features and fixes:
*) report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
*) delete useless r->cache->uses
*) proxy_cache_use_stale/fastcgi_cache_use_stale updating
*) inherit proxy_set_header, proxy_hide_header, and fastcgi_hide_header
only if cache settings are similar
*) add response file uniq while loading cold cache on demand
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 15 Jun 2009 09:30:59 +0000 |
parents | 6e1941b321b7 |
children | 31526449835f |
comparison
equal
deleted
inserted
replaced
2943:5da043342fe4 | 2944:f892042956e3 |
---|---|
165 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 }, | 165 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 }, |
166 { ngx_string("http_502"), NGX_HTTP_UPSTREAM_FT_HTTP_502 }, | 166 { ngx_string("http_502"), NGX_HTTP_UPSTREAM_FT_HTTP_502 }, |
167 { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 }, | 167 { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 }, |
168 { ngx_string("http_504"), NGX_HTTP_UPSTREAM_FT_HTTP_504 }, | 168 { ngx_string("http_504"), NGX_HTTP_UPSTREAM_FT_HTTP_504 }, |
169 { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 }, | 169 { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 }, |
170 { ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING }, | |
170 { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF }, | 171 { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF }, |
171 { ngx_null_string, 0 } | 172 { ngx_null_string, 0 } |
172 }; | 173 }; |
173 | 174 |
174 | 175 |
1971 ngx_http_proxy_redirect_t *pr; | 1972 ngx_http_proxy_redirect_t *pr; |
1972 ngx_http_script_compile_t sc; | 1973 ngx_http_script_compile_t sc; |
1973 | 1974 |
1974 if (conf->upstream.store != 0) { | 1975 if (conf->upstream.store != 0) { |
1975 ngx_conf_merge_value(conf->upstream.store, | 1976 ngx_conf_merge_value(conf->upstream.store, |
1976 prev->upstream.store, 0); | 1977 prev->upstream.store, 0); |
1977 | 1978 |
1978 if (conf->upstream.store_lengths == NULL) { | 1979 if (conf->upstream.store_lengths == NULL) { |
1979 conf->upstream.store_lengths = prev->upstream.store_lengths; | 1980 conf->upstream.store_lengths = prev->upstream.store_lengths; |
1980 conf->upstream.store_values = prev->upstream.store_values; | 1981 conf->upstream.store_values = prev->upstream.store_values; |
1981 } | 1982 } |
2339 conf->headers_set = prev->headers_set; | 2340 conf->headers_set = prev->headers_set; |
2340 conf->headers_set_hash = prev->headers_set_hash; | 2341 conf->headers_set_hash = prev->headers_set_hash; |
2341 conf->headers_source = prev->headers_source; | 2342 conf->headers_source = prev->headers_source; |
2342 } | 2343 } |
2343 | 2344 |
2344 if (conf->headers_set_hash.buckets) { | 2345 if (conf->headers_set_hash.buckets |
2346 && ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))) | |
2347 { | |
2345 return NGX_OK; | 2348 return NGX_OK; |
2346 } | 2349 } |
2347 | 2350 |
2348 | 2351 |
2349 conf->headers_names = ngx_array_create(cf->pool, 4, sizeof(ngx_hash_key_t)); | 2352 conf->headers_names = ngx_array_create(cf->pool, 4, sizeof(ngx_hash_key_t)); |
2807 ngx_http_proxy_loc_conf_t *plcf = conf; | 2810 ngx_http_proxy_loc_conf_t *plcf = conf; |
2808 | 2811 |
2809 ngx_str_t *value; | 2812 ngx_str_t *value; |
2810 ngx_http_script_compile_t sc; | 2813 ngx_http_script_compile_t sc; |
2811 | 2814 |
2812 if (plcf->upstream.store != NGX_CONF_UNSET || plcf->upstream.store_lengths) | 2815 if (plcf->upstream.store != NGX_CONF_UNSET |
2816 || plcf->upstream.store_lengths) | |
2813 { | 2817 { |
2814 return "is duplicate"; | 2818 return "is duplicate"; |
2815 } | 2819 } |
2816 | 2820 |
2817 value = cf->args->elts; | 2821 value = cf->args->elts; |
2818 | 2822 |
2823 if (ngx_strcmp(value[1].data, "off") == 0) { | |
2824 plcf->upstream.store = 0; | |
2825 return NGX_CONF_OK; | |
2826 } | |
2827 | |
2828 #if (NGX_HTTP_CACHE) | |
2829 | |
2830 if (plcf->upstream.cache != NGX_CONF_UNSET_PTR | |
2831 && plcf->upstream.cache != NULL) | |
2832 { | |
2833 return "is incompatible with \"proxy_cache\""; | |
2834 } | |
2835 | |
2836 #endif | |
2837 | |
2819 if (ngx_strcmp(value[1].data, "on") == 0) { | 2838 if (ngx_strcmp(value[1].data, "on") == 0) { |
2820 plcf->upstream.store = 1; | 2839 plcf->upstream.store = 1; |
2821 return NGX_CONF_OK; | |
2822 } | |
2823 | |
2824 if (ngx_strcmp(value[1].data, "off") == 0) { | |
2825 plcf->upstream.store = 0; | |
2826 return NGX_CONF_OK; | 2840 return NGX_CONF_OK; |
2827 } | 2841 } |
2828 | 2842 |
2829 /* include the terminating '\0' into script */ | 2843 /* include the terminating '\0' into script */ |
2830 value[1].len++; | 2844 value[1].len++; |
2863 } | 2877 } |
2864 | 2878 |
2865 if (ngx_strcmp(value[1].data, "off") == 0) { | 2879 if (ngx_strcmp(value[1].data, "off") == 0) { |
2866 plcf->upstream.cache = NULL; | 2880 plcf->upstream.cache = NULL; |
2867 return NGX_CONF_OK; | 2881 return NGX_CONF_OK; |
2882 } | |
2883 | |
2884 if (plcf->upstream.store > 0 || plcf->upstream.store_lengths) { | |
2885 return "is incompatible with \"proxy_store\""; | |
2868 } | 2886 } |
2869 | 2887 |
2870 plcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, | 2888 plcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, |
2871 &ngx_http_proxy_module); | 2889 &ngx_http_proxy_module); |
2872 if (plcf->upstream.cache == NULL) { | 2890 if (plcf->upstream.cache == NULL) { |