comparison src/http/modules/ngx_http_proxy_module.c @ 7728:485dba3e2a01

Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR. With this change, it is now possible to use ngx_conf_merge_ptr_value() to merge keyval arrays. This change actually follows much earlier changes in ngx_conf_merge_ptr_value() and ngx_conf_set_str_array_slot() in 1452:cd586e963db0 (0.6.10) and 1701:40d004d95d88 (0.6.22). To preserve compatibility with existing 3rd party modules, both NULL and NGX_CONF_UNSET_PTR are accepted for now.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 22 Oct 2020 18:00:20 +0300
parents a88384c69d1e
children 1a719ee45526
comparison
equal deleted inserted replaced
7727:f1e6f65ddfeb 7728:485dba3e2a01
3266 * conf->upstream.ssl_name = NULL; 3266 * conf->upstream.ssl_name = NULL;
3267 * 3267 *
3268 * conf->method = NULL; 3268 * conf->method = NULL;
3269 * conf->location = NULL; 3269 * conf->location = NULL;
3270 * conf->url = { 0, NULL }; 3270 * conf->url = { 0, NULL };
3271 * conf->headers_source = NULL;
3272 * conf->headers.lengths = NULL; 3271 * conf->headers.lengths = NULL;
3273 * conf->headers.values = NULL; 3272 * conf->headers.values = NULL;
3274 * conf->headers.hash = { NULL, 0 }; 3273 * conf->headers.hash = { NULL, 0 };
3275 * conf->headers_cache.lengths = NULL; 3274 * conf->headers_cache.lengths = NULL;
3276 * conf->headers_cache.values = NULL; 3275 * conf->headers_cache.values = NULL;
3344 #endif 3343 #endif
3345 3344
3346 /* "proxy_cyclic_temp_file" is disabled */ 3345 /* "proxy_cyclic_temp_file" is disabled */
3347 conf->upstream.cyclic_temp_file = 0; 3346 conf->upstream.cyclic_temp_file = 0;
3348 3347
3348 conf->headers_source = NGX_CONF_UNSET_PTR;
3349
3349 conf->redirect = NGX_CONF_UNSET; 3350 conf->redirect = NGX_CONF_UNSET;
3350 conf->upstream.change_buffering = 1; 3351 conf->upstream.change_buffering = 1;
3351 3352
3352 conf->cookie_domains = NGX_CONF_UNSET_PTR; 3353 conf->cookie_domains = NGX_CONF_UNSET_PTR;
3353 conf->cookie_paths = NGX_CONF_UNSET_PTR; 3354 conf->cookie_paths = NGX_CONF_UNSET_PTR;
3817 if (ngx_http_script_compile(&sc) != NGX_OK) { 3818 if (ngx_http_script_compile(&sc) != NGX_OK) {
3818 return NGX_CONF_ERROR; 3819 return NGX_CONF_ERROR;
3819 } 3820 }
3820 } 3821 }
3821 3822
3822 if (conf->headers_source == NULL) { 3823 ngx_conf_merge_ptr_value(conf->headers_source, prev->headers_source, NULL);
3824
3825 if (conf->headers_source == prev->headers_source) {
3823 conf->headers = prev->headers; 3826 conf->headers = prev->headers;
3824 #if (NGX_HTTP_CACHE) 3827 #if (NGX_HTTP_CACHE)
3825 conf->headers_cache = prev->headers_cache; 3828 conf->headers_cache = prev->headers_cache;
3826 #endif 3829 #endif
3827 conf->headers_source = prev->headers_source;
3828 } 3830 }
3829 3831
3830 rc = ngx_http_proxy_init_headers(cf, conf, &conf->headers, 3832 rc = ngx_http_proxy_init_headers(cf, conf, &conf->headers,
3831 ngx_http_proxy_headers); 3833 ngx_http_proxy_headers);
3832 if (rc != NGX_OK) { 3834 if (rc != NGX_OK) {