comparison src/http/modules/ngx_http_proxy_module.c @ 572:ff463db0be31 NGINX_0_8_38

nginx 0.8.38 *) Feature: the "proxy_no_cache" and "fastcgi_no_cache" directives. *) Feature: now the "rewrite" directive does a redirect automatically if the $scheme variable is used. Thanks to Piotr Sikora. *) Bugfix: now "limit_req" delay directive conforms to the described algorithm. Thanks to Maxim Dounin. *) Bugfix: the $uid_got variable might not be used in the SSI and perl modules.
author Igor Sysoev <http://sysoev.ru>
date Mon, 24 May 2010 00:00:00 +0400
parents 8246d8a2c2be
children 01f2313e34f1
comparison
equal deleted inserted replaced
571:5b59e716792b 572:ff463db0be31
140 void *conf); 140 void *conf);
141 #endif 141 #endif
142 142
143 static char *ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data); 143 static char *ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data);
144 144
145 static char *ngx_http_proxy_upstream_max_fails_unsupported(ngx_conf_t *cf,
146 ngx_command_t *cmd, void *conf);
147 static char *ngx_http_proxy_upstream_fail_timeout_unsupported(ngx_conf_t *cf,
148 ngx_command_t *cmd, void *conf);
149
150 #if (NGX_HTTP_SSL) 145 #if (NGX_HTTP_SSL)
151 static ngx_int_t ngx_http_proxy_set_ssl(ngx_conf_t *cf, 146 static ngx_int_t ngx_http_proxy_set_ssl(ngx_conf_t *cf,
152 ngx_http_proxy_loc_conf_t *plcf); 147 ngx_http_proxy_loc_conf_t *plcf);
153 #endif 148 #endif
154 static void ngx_http_proxy_set_vars(ngx_url_t *u, ngx_http_proxy_vars_t *v); 149 static void ngx_http_proxy_set_vars(ngx_url_t *u, ngx_http_proxy_vars_t *v);
362 ngx_http_file_cache_set_slot, 357 ngx_http_file_cache_set_slot,
363 0, 358 0,
364 0, 359 0,
365 &ngx_http_proxy_module }, 360 &ngx_http_proxy_module },
366 361
362 { ngx_string("proxy_no_cache"),
363 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
364 ngx_http_no_cache_set_slot,
365 NGX_HTTP_LOC_CONF_OFFSET,
366 offsetof(ngx_http_proxy_loc_conf_t, upstream.no_cache),
367 NULL },
368
367 { ngx_string("proxy_cache_valid"), 369 { ngx_string("proxy_cache_valid"),
368 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, 370 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
369 ngx_http_file_cache_valid_set_slot, 371 ngx_http_file_cache_valid_set_slot,
370 NGX_HTTP_LOC_CONF_OFFSET, 372 NGX_HTTP_LOC_CONF_OFFSET,
371 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_valid), 373 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_valid),
419 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, 421 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
420 ngx_conf_set_bitmask_slot, 422 ngx_conf_set_bitmask_slot,
421 NGX_HTTP_LOC_CONF_OFFSET, 423 NGX_HTTP_LOC_CONF_OFFSET,
422 offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream), 424 offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream),
423 &ngx_http_proxy_next_upstream_masks }, 425 &ngx_http_proxy_next_upstream_masks },
424
425 { ngx_string("proxy_upstream_max_fails"),
426 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
427 ngx_http_proxy_upstream_max_fails_unsupported,
428 0,
429 0,
430 NULL },
431
432 { ngx_string("proxy_upstream_fail_timeout"),
433 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
434 ngx_http_proxy_upstream_fail_timeout_unsupported,
435 0,
436 0,
437 NULL },
438 426
439 { ngx_string("proxy_pass_header"), 427 { ngx_string("proxy_pass_header"),
440 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, 428 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
441 ngx_conf_set_str_array_slot, 429 ngx_conf_set_str_array_slot,
442 NGX_HTTP_LOC_CONF_OFFSET, 430 NGX_HTTP_LOC_CONF_OFFSET,
1934 conf->upstream.pass_request_body = NGX_CONF_UNSET; 1922 conf->upstream.pass_request_body = NGX_CONF_UNSET;
1935 1923
1936 #if (NGX_HTTP_CACHE) 1924 #if (NGX_HTTP_CACHE)
1937 conf->upstream.cache = NGX_CONF_UNSET_PTR; 1925 conf->upstream.cache = NGX_CONF_UNSET_PTR;
1938 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT; 1926 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
1927 conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
1939 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; 1928 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
1940 #endif 1929 #endif
1941 1930
1942 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR; 1931 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
1943 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR; 1932 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
2157 2146
2158 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) { 2147 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) {
2159 conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET 2148 conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET
2160 |NGX_HTTP_UPSTREAM_FT_OFF; 2149 |NGX_HTTP_UPSTREAM_FT_OFF;
2161 } 2150 }
2151
2152 ngx_conf_merge_ptr_value(conf->upstream.no_cache,
2153 prev->upstream.no_cache, NULL);
2162 2154
2163 ngx_conf_merge_ptr_value(conf->upstream.cache_valid, 2155 ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
2164 prev->upstream.cache_valid, NULL); 2156 prev->upstream.cache_valid, NULL);
2165 2157
2166 if (conf->cache_key.value.data == NULL) { 2158 if (conf->cache_key.value.data == NULL) {
2957 2949
2958 return NGX_CONF_OK; 2950 return NGX_CONF_OK;
2959 } 2951 }
2960 2952
2961 2953
2962 static char *
2963 ngx_http_proxy_upstream_max_fails_unsupported(ngx_conf_t *cf,
2964 ngx_command_t *cmd, void *conf)
2965 {
2966 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2967 "\"proxy_upstream_max_fails\" is not supported, "
2968 "use the \"max_fails\" parameter of the \"server\" directive ",
2969 "inside the \"upstream\" block");
2970
2971 return NGX_CONF_ERROR;
2972 }
2973
2974
2975 static char *
2976 ngx_http_proxy_upstream_fail_timeout_unsupported(ngx_conf_t *cf,
2977 ngx_command_t *cmd, void *conf)
2978 {
2979 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2980 "\"proxy_upstream_fail_timeout\" is not supported, "
2981 "use the \"fail_timeout\" parameter of the \"server\" directive ",
2982 "inside the \"upstream\" block");
2983
2984 return NGX_CONF_ERROR;
2985 }
2986
2987
2988 #if (NGX_HTTP_SSL) 2954 #if (NGX_HTTP_SSL)
2989 2955
2990 static ngx_int_t 2956 static ngx_int_t
2991 ngx_http_proxy_set_ssl(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *plcf) 2957 ngx_http_proxy_set_ssl(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *plcf)
2992 { 2958 {