comparison src/http/modules/ngx_http_proxy_module.c @ 484:ed5e10fb40fc NGINX_0_7_54

nginx 0.7.54 *) Feature: the ngx_http_image_filter_module. *) Feature: the "proxy_ignore_headers" and "fastcgi_ignore_headers" directives. *) Bugfix: a segmentation fault might occur in worker process, if an "open_file_cache_errors off" directive was used; the bug had appeared in 0.7.53. *) Bugfix: the "port_in_redirect off" directive did not work; the bug had appeared in 0.7.39. *) Bugfix: improve handling of "select" method errors. *) Bugfix: of "select() failed (10022: ...)" error in nginx/Windows. *) Bugfix: in error text descriptions in nginx/Windows; the bug had appeared in 0.7.53.
author Igor Sysoev <http://sysoev.ru>
date Fri, 01 May 2009 00:00:00 +0400
parents 392c16f2d858
children 499474178a11
comparison
equal deleted inserted replaced
483:0a2f4b42ddad 484:ed5e10fb40fc
170 { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF }, 170 { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF },
171 { ngx_null_string, 0 } 171 { ngx_null_string, 0 }
172 }; 172 };
173 173
174 174
175 static ngx_conf_bitmask_t ngx_http_proxy_ignore_headers_masks[] = {
176 { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
177 { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
178 { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
179 { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
180 { ngx_null_string, 0 }
181 };
182
183
175 ngx_module_t ngx_http_proxy_module; 184 ngx_module_t ngx_http_proxy_module;
176 185
177 186
178 static ngx_command_t ngx_http_proxy_commands[] = { 187 static ngx_command_t ngx_http_proxy_commands[] = {
179 188
423 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, 432 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
424 ngx_conf_set_str_array_slot, 433 ngx_conf_set_str_array_slot,
425 NGX_HTTP_LOC_CONF_OFFSET, 434 NGX_HTTP_LOC_CONF_OFFSET,
426 offsetof(ngx_http_proxy_loc_conf_t, upstream.hide_headers), 435 offsetof(ngx_http_proxy_loc_conf_t, upstream.hide_headers),
427 NULL }, 436 NULL },
437
438 { ngx_string("proxy_ignore_headers"),
439 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
440 ngx_conf_set_bitmask_slot,
441 NGX_HTTP_LOC_CONF_OFFSET,
442 offsetof(ngx_http_proxy_loc_conf_t, upstream.ignore_headers),
443 &ngx_http_proxy_ignore_headers_masks },
428 444
429 #if (NGX_HTTP_SSL) 445 #if (NGX_HTTP_SSL)
430 446
431 { ngx_string("proxy_ssl_session_reuse"), 447 { ngx_string("proxy_ssl_session_reuse"),
432 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, 448 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
1865 1881
1866 /* 1882 /*
1867 * set by ngx_pcalloc(): 1883 * set by ngx_pcalloc():
1868 * 1884 *
1869 * conf->upstream.bufs.num = 0; 1885 * conf->upstream.bufs.num = 0;
1886 * conf->upstream.ignore_headers = 0;
1870 * conf->upstream.next_upstream = 0; 1887 * conf->upstream.next_upstream = 0;
1871 * conf->upstream.use_stale_cache = 0; 1888 * conf->upstream.use_stale_cache = 0;
1872 * conf->upstream.temp_path = NULL; 1889 * conf->upstream.temp_path = NULL;
1873 * conf->upstream.hide_headers_hash = { NULL, 0 }; 1890 * conf->upstream.hide_headers_hash = { NULL, 0 };
1874 * conf->upstream.uri = { 0, NULL }; 1891 * conf->upstream.uri = { 0, NULL };
2070 2087
2071 return NGX_CONF_ERROR; 2088 return NGX_CONF_ERROR;
2072 } 2089 }
2073 2090
2074 2091
2092 ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers,
2093 prev->upstream.ignore_headers,
2094 NGX_CONF_BITMASK_SET);
2095
2096
2075 ngx_conf_merge_bitmask_value(conf->upstream.next_upstream, 2097 ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
2076 prev->upstream.next_upstream, 2098 prev->upstream.next_upstream,
2077 (NGX_CONF_BITMASK_SET 2099 (NGX_CONF_BITMASK_SET
2078 |NGX_HTTP_UPSTREAM_FT_ERROR 2100 |NGX_HTTP_UPSTREAM_FT_ERROR
2079 |NGX_HTTP_UPSTREAM_FT_TIMEOUT)); 2101 |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
2673 return NGX_CONF_OK; 2695 return NGX_CONF_OK;
2674 } 2696 }
2675 2697
2676 value = cf->args->elts; 2698 value = cf->args->elts;
2677 2699
2678 if (ngx_strcmp(value[1].data, "off") == 0) { 2700 if (cf->args->nelts == 2) {
2679 plcf->redirect = 0; 2701 if (ngx_strcmp(value[1].data, "off") == 0) {
2680 plcf->redirects = NULL; 2702 plcf->redirect = 0;
2681 return NGX_CONF_OK; 2703 plcf->redirects = NULL;
2704 return NGX_CONF_OK;
2705 }
2706
2707 if (ngx_strcmp(value[1].data, "false") == 0) {
2708 ngx_conf_log_error(NGX_LOG_ERR, cf, 0,
2709 "invalid parameter \"false\", use \"off\" instead");
2710 plcf->redirect = 0;
2711 plcf->redirects = NULL;
2712 return NGX_CONF_OK;
2713 }
2714
2715 if (ngx_strcmp(value[1].data, "default") != 0) {
2716 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2717 "invalid parameter \"%V\"", &value[1]);
2718 return NGX_CONF_ERROR;
2719 }
2682 } 2720 }
2683 2721
2684 if (plcf->redirects == NULL) { 2722 if (plcf->redirects == NULL) {
2685 plcf->redirects = ngx_array_create(cf->pool, 1, 2723 plcf->redirects = ngx_array_create(cf->pool, 1,
2686 sizeof(ngx_http_proxy_redirect_t)); 2724 sizeof(ngx_http_proxy_redirect_t));
2692 pr = ngx_array_push(plcf->redirects); 2730 pr = ngx_array_push(plcf->redirects);
2693 if (pr == NULL) { 2731 if (pr == NULL) {
2694 return NGX_CONF_ERROR; 2732 return NGX_CONF_ERROR;
2695 } 2733 }
2696 2734
2697 if (cf->args->nelts == 2 && ngx_strcmp(value[1].data, "default") == 0) { 2735 if (ngx_strcmp(value[1].data, "default") == 0) {
2698 if (plcf->url.data == NULL) { 2736 if (plcf->url.data == NULL) {
2699 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2737 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2700 "\"proxy_rewrite_location default\" must go " 2738 "\"proxy_rewrite_location default\" must go "
2701 "after the \"proxy_pass\" directive"); 2739 "after the \"proxy_pass\" directive");
2702 return NGX_CONF_ERROR; 2740 return NGX_CONF_ERROR;