comparison src/http/modules/ngx_http_scgi_module.c @ 5907:195561ef367f

Upstream: moved header initializations to separate functions. No functional changes.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 19 Nov 2014 17:33:21 +0300
parents 548f704c1907
children f8e80f8c7fc7
comparison
equal deleted inserted replaced
5906:548f704c1907 5907:195561ef367f
41 static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc); 41 static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
42 42
43 static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf); 43 static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf);
44 static char *ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, 44 static char *ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
45 void *child); 45 void *child);
46 static ngx_int_t ngx_http_scgi_merge_params(ngx_conf_t *cf, 46 static ngx_int_t ngx_http_scgi_init_params(ngx_conf_t *cf,
47 ngx_http_scgi_loc_conf_t *conf, ngx_http_scgi_loc_conf_t *prev); 47 ngx_http_scgi_loc_conf_t *conf);
48 48
49 static char *ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 49 static char *ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
50 static char *ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd, 50 static char *ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd,
51 void *conf); 51 void *conf);
52 52
1441 if (clcf->handler == NULL && clcf->lmt_excpt) { 1441 if (clcf->handler == NULL && clcf->lmt_excpt) {
1442 clcf->handler = ngx_http_scgi_handler; 1442 clcf->handler = ngx_http_scgi_handler;
1443 } 1443 }
1444 } 1444 }
1445 1445
1446 if (ngx_http_scgi_merge_params(cf, conf, prev) != NGX_OK) { 1446 if (conf->params_source == NULL) {
1447 conf->params_source = prev->params_source;
1448
1449 #if (NGX_HTTP_CACHE)
1450 if ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
1451 #endif
1452 {
1453 conf->flushes = prev->flushes;
1454 conf->params_len = prev->params_len;
1455 conf->params = prev->params;
1456 conf->headers_hash = prev->headers_hash;
1457 conf->header_params = prev->header_params;
1458 }
1459 }
1460
1461 if (ngx_http_scgi_init_params(cf, conf) != NGX_OK) {
1447 return NGX_CONF_ERROR; 1462 return NGX_CONF_ERROR;
1448 } 1463 }
1449 1464
1450 return NGX_CONF_OK; 1465 return NGX_CONF_OK;
1451 } 1466 }
1452 1467
1453 1468
1454 static ngx_int_t 1469 static ngx_int_t
1455 ngx_http_scgi_merge_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf, 1470 ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
1456 ngx_http_scgi_loc_conf_t *prev)
1457 { 1471 {
1458 u_char *p; 1472 u_char *p;
1459 size_t size; 1473 size_t size;
1460 uintptr_t *code; 1474 uintptr_t *code;
1461 ngx_uint_t i, nsrc; 1475 ngx_uint_t i, nsrc;
1467 ngx_hash_init_t hash; 1481 ngx_hash_init_t hash;
1468 ngx_http_upstream_param_t *src; 1482 ngx_http_upstream_param_t *src;
1469 ngx_http_script_compile_t sc; 1483 ngx_http_script_compile_t sc;
1470 ngx_http_script_copy_code_t *copy; 1484 ngx_http_script_copy_code_t *copy;
1471 1485
1472 if (conf->params_source == NULL) { 1486 if (conf->headers_hash.buckets) {
1473 conf->params_source = prev->params_source; 1487 return NGX_OK;
1474
1475 if (prev->headers_hash.buckets
1476 #if (NGX_HTTP_CACHE)
1477 && ((conf->upstream.cache == NULL)
1478 == (prev->upstream.cache == NULL))
1479 #endif
1480 )
1481 {
1482 conf->flushes = prev->flushes;
1483 conf->params_len = prev->params_len;
1484 conf->params = prev->params;
1485 conf->headers_hash = prev->headers_hash;
1486 conf->header_params = prev->header_params;
1487
1488 return NGX_OK;
1489 }
1490 } 1488 }
1491 1489
1492 if (conf->params_source == NULL 1490 if (conf->params_source == NULL
1493 #if (NGX_HTTP_CACHE) 1491 #if (NGX_HTTP_CACHE)
1494 && (conf->upstream.cache == NULL) 1492 && (conf->upstream.cache == NULL)