comparison src/http/modules/ngx_http_grpc_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 39501ce97e29
children 1a719ee45526
comparison
equal deleted inserted replaced
7727:f1e6f65ddfeb 7728:485dba3e2a01
4322 * conf->upstream.ignore_headers = 0; 4322 * conf->upstream.ignore_headers = 0;
4323 * conf->upstream.next_upstream = 0; 4323 * conf->upstream.next_upstream = 0;
4324 * conf->upstream.hide_headers_hash = { NULL, 0 }; 4324 * conf->upstream.hide_headers_hash = { NULL, 0 };
4325 * conf->upstream.ssl_name = NULL; 4325 * conf->upstream.ssl_name = NULL;
4326 * 4326 *
4327 * conf->headers_source = NULL;
4328 * conf->headers.lengths = NULL; 4327 * conf->headers.lengths = NULL;
4329 * conf->headers.values = NULL; 4328 * conf->headers.values = NULL;
4330 * conf->headers.hash = { NULL, 0 }; 4329 * conf->headers.hash = { NULL, 0 };
4331 * conf->host = { 0, NULL }; 4330 * conf->host = { 0, NULL };
4332 * conf->host_set = 0; 4331 * conf->host_set = 0;
4375 conf->upstream.pass_request_body = 1; 4374 conf->upstream.pass_request_body = 1;
4376 conf->upstream.force_ranges = 0; 4375 conf->upstream.force_ranges = 0;
4377 conf->upstream.pass_trailers = 1; 4376 conf->upstream.pass_trailers = 1;
4378 conf->upstream.preserve_output = 1; 4377 conf->upstream.preserve_output = 1;
4379 4378
4379 conf->headers_source = NGX_CONF_UNSET_PTR;
4380
4380 ngx_str_set(&conf->upstream.module, "grpc"); 4381 ngx_str_set(&conf->upstream.module, "grpc");
4381 4382
4382 return conf; 4383 return conf;
4383 } 4384 }
4384 4385
4505 && (conf->upstream.upstream || conf->grpc_lengths)) 4506 && (conf->upstream.upstream || conf->grpc_lengths))
4506 { 4507 {
4507 clcf->handler = ngx_http_grpc_handler; 4508 clcf->handler = ngx_http_grpc_handler;
4508 } 4509 }
4509 4510
4510 if (conf->headers_source == NULL) { 4511 ngx_conf_merge_ptr_value(conf->headers_source, prev->headers_source, NULL);
4512
4513 if (conf->headers_source == prev->headers_source) {
4511 conf->headers = prev->headers; 4514 conf->headers = prev->headers;
4512 conf->headers_source = prev->headers_source;
4513 conf->host_set = prev->host_set; 4515 conf->host_set = prev->host_set;
4514 } 4516 }
4515 4517
4516 rc = ngx_http_grpc_init_headers(cf, conf, &conf->headers, 4518 rc = ngx_http_grpc_init_headers(cf, conf, &conf->headers,
4517 ngx_http_grpc_headers); 4519 ngx_http_grpc_headers);