mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 14:13:33 -06:00
Upstream: moved header initializations to separate functions.
No functional changes.
This commit is contained in:
parent
3b33056522
commit
62dfdf1814
@ -150,8 +150,8 @@ static ngx_int_t ngx_http_fastcgi_add_variables(ngx_conf_t *cf);
|
|||||||
static void *ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf);
|
static void *ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf);
|
||||||
static char *ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf,
|
static char *ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf,
|
||||||
void *parent, void *child);
|
void *parent, void *child);
|
||||||
static ngx_int_t ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
|
static ngx_int_t ngx_http_fastcgi_init_params(ngx_conf_t *cf,
|
||||||
ngx_http_fastcgi_loc_conf_t *conf, ngx_http_fastcgi_loc_conf_t *prev);
|
ngx_http_fastcgi_loc_conf_t *conf);
|
||||||
|
|
||||||
static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r,
|
static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r,
|
||||||
ngx_http_variable_value_t *v, uintptr_t data);
|
ngx_http_variable_value_t *v, uintptr_t data);
|
||||||
@ -2703,7 +2703,22 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ngx_http_fastcgi_merge_params(cf, conf, prev) != NGX_OK) {
|
if (conf->params_source == NULL) {
|
||||||
|
conf->params_source = prev->params_source;
|
||||||
|
|
||||||
|
#if (NGX_HTTP_CACHE)
|
||||||
|
if ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
conf->flushes = prev->flushes;
|
||||||
|
conf->params_len = prev->params_len;
|
||||||
|
conf->params = prev->params;
|
||||||
|
conf->headers_hash = prev->headers_hash;
|
||||||
|
conf->header_params = prev->header_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ngx_http_fastcgi_init_params(cf, conf) != NGX_OK) {
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2712,8 +2727,7 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
|
|
||||||
|
|
||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
|
ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||||
ngx_http_fastcgi_loc_conf_t *conf, ngx_http_fastcgi_loc_conf_t *prev)
|
|
||||||
{
|
{
|
||||||
u_char *p;
|
u_char *p;
|
||||||
size_t size;
|
size_t size;
|
||||||
@ -2729,24 +2743,8 @@ ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
|
|||||||
ngx_http_script_compile_t sc;
|
ngx_http_script_compile_t sc;
|
||||||
ngx_http_script_copy_code_t *copy;
|
ngx_http_script_copy_code_t *copy;
|
||||||
|
|
||||||
if (conf->params_source == NULL) {
|
if (conf->headers_hash.buckets) {
|
||||||
conf->params_source = prev->params_source;
|
return NGX_OK;
|
||||||
|
|
||||||
if (prev->headers_hash.buckets
|
|
||||||
#if (NGX_HTTP_CACHE)
|
|
||||||
&& ((conf->upstream.cache == NULL)
|
|
||||||
== (prev->upstream.cache == NULL))
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
conf->flushes = prev->flushes;
|
|
||||||
conf->params_len = prev->params_len;
|
|
||||||
conf->params = prev->params;
|
|
||||||
conf->headers_hash = prev->headers_hash;
|
|
||||||
conf->header_params = prev->header_params;
|
|
||||||
|
|
||||||
return NGX_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conf->params_source == NULL
|
if (conf->params_source == NULL
|
||||||
|
@ -146,8 +146,8 @@ static ngx_int_t ngx_http_proxy_add_variables(ngx_conf_t *cf);
|
|||||||
static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf);
|
static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf);
|
||||||
static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf,
|
static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf,
|
||||||
void *parent, void *child);
|
void *parent, void *child);
|
||||||
static ngx_int_t ngx_http_proxy_merge_headers(ngx_conf_t *cf,
|
static ngx_int_t ngx_http_proxy_init_headers(ngx_conf_t *cf,
|
||||||
ngx_http_proxy_loc_conf_t *conf, ngx_http_proxy_loc_conf_t *prev);
|
ngx_http_proxy_loc_conf_t *conf);
|
||||||
|
|
||||||
static char *ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
static char *ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||||
void *conf);
|
void *conf);
|
||||||
@ -3015,7 +3015,21 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_http_proxy_merge_headers(cf, conf, prev) != NGX_OK) {
|
if (conf->headers_source == NULL) {
|
||||||
|
conf->flushes = prev->flushes;
|
||||||
|
conf->headers_set_len = prev->headers_set_len;
|
||||||
|
conf->headers_set = prev->headers_set;
|
||||||
|
conf->headers_set_hash = prev->headers_set_hash;
|
||||||
|
conf->headers_source = prev->headers_source;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if (NGX_HTTP_CACHE)
|
||||||
|
if ((conf->upstream.cache == NULL) != (prev->upstream.cache == NULL)) {
|
||||||
|
conf->headers_set_hash.buckets = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (ngx_http_proxy_init_headers(cf, conf) != NGX_OK) {
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3024,8 +3038,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
|
|
||||||
|
|
||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||||
ngx_http_proxy_loc_conf_t *prev)
|
|
||||||
{
|
{
|
||||||
u_char *p;
|
u_char *p;
|
||||||
size_t size;
|
size_t size;
|
||||||
@ -3038,24 +3051,10 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|||||||
ngx_http_script_compile_t sc;
|
ngx_http_script_compile_t sc;
|
||||||
ngx_http_script_copy_code_t *copy;
|
ngx_http_script_copy_code_t *copy;
|
||||||
|
|
||||||
if (conf->headers_source == NULL) {
|
if (conf->headers_set_hash.buckets) {
|
||||||
conf->flushes = prev->flushes;
|
|
||||||
conf->headers_set_len = prev->headers_set_len;
|
|
||||||
conf->headers_set = prev->headers_set;
|
|
||||||
conf->headers_set_hash = prev->headers_set_hash;
|
|
||||||
conf->headers_source = prev->headers_source;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conf->headers_set_hash.buckets
|
|
||||||
#if (NGX_HTTP_CACHE)
|
|
||||||
&& ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
|
if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
|
||||||
!= NGX_OK)
|
!= NGX_OK)
|
||||||
{
|
{
|
||||||
|
@ -43,8 +43,8 @@ static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
|
|||||||
static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf);
|
static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf);
|
||||||
static char *ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
|
static char *ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
|
||||||
void *child);
|
void *child);
|
||||||
static ngx_int_t ngx_http_scgi_merge_params(ngx_conf_t *cf,
|
static ngx_int_t ngx_http_scgi_init_params(ngx_conf_t *cf,
|
||||||
ngx_http_scgi_loc_conf_t *conf, ngx_http_scgi_loc_conf_t *prev);
|
ngx_http_scgi_loc_conf_t *conf);
|
||||||
|
|
||||||
static char *ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
static char *ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||||
static char *ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd,
|
static char *ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||||
@ -1443,7 +1443,22 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_http_scgi_merge_params(cf, conf, prev) != NGX_OK) {
|
if (conf->params_source == NULL) {
|
||||||
|
conf->params_source = prev->params_source;
|
||||||
|
|
||||||
|
#if (NGX_HTTP_CACHE)
|
||||||
|
if ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
conf->flushes = prev->flushes;
|
||||||
|
conf->params_len = prev->params_len;
|
||||||
|
conf->params = prev->params;
|
||||||
|
conf->headers_hash = prev->headers_hash;
|
||||||
|
conf->header_params = prev->header_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ngx_http_scgi_init_params(cf, conf) != NGX_OK) {
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1452,8 +1467,7 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
|
|
||||||
|
|
||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_http_scgi_merge_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf,
|
ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
|
||||||
ngx_http_scgi_loc_conf_t *prev)
|
|
||||||
{
|
{
|
||||||
u_char *p;
|
u_char *p;
|
||||||
size_t size;
|
size_t size;
|
||||||
@ -1469,24 +1483,8 @@ ngx_http_scgi_merge_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf,
|
|||||||
ngx_http_script_compile_t sc;
|
ngx_http_script_compile_t sc;
|
||||||
ngx_http_script_copy_code_t *copy;
|
ngx_http_script_copy_code_t *copy;
|
||||||
|
|
||||||
if (conf->params_source == NULL) {
|
if (conf->headers_hash.buckets) {
|
||||||
conf->params_source = prev->params_source;
|
return NGX_OK;
|
||||||
|
|
||||||
if (prev->headers_hash.buckets
|
|
||||||
#if (NGX_HTTP_CACHE)
|
|
||||||
&& ((conf->upstream.cache == NULL)
|
|
||||||
== (prev->upstream.cache == NULL))
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
conf->flushes = prev->flushes;
|
|
||||||
conf->params_len = prev->params_len;
|
|
||||||
conf->params = prev->params;
|
|
||||||
conf->headers_hash = prev->headers_hash;
|
|
||||||
conf->header_params = prev->header_params;
|
|
||||||
|
|
||||||
return NGX_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conf->params_source == NULL
|
if (conf->params_source == NULL
|
||||||
|
@ -62,8 +62,8 @@ static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r,
|
|||||||
static void *ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf);
|
static void *ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf);
|
||||||
static char *ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
|
static char *ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
|
||||||
void *child);
|
void *child);
|
||||||
static ngx_int_t ngx_http_uwsgi_merge_params(ngx_conf_t *cf,
|
static ngx_int_t ngx_http_uwsgi_init_params(ngx_conf_t *cf,
|
||||||
ngx_http_uwsgi_loc_conf_t *conf, ngx_http_uwsgi_loc_conf_t *prev);
|
ngx_http_uwsgi_loc_conf_t *conf);
|
||||||
|
|
||||||
static char *ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
static char *ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||||
void *conf);
|
void *conf);
|
||||||
@ -1705,7 +1705,22 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0);
|
ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0);
|
||||||
ngx_conf_merge_uint_value(conf->modifier2, prev->modifier2, 0);
|
ngx_conf_merge_uint_value(conf->modifier2, prev->modifier2, 0);
|
||||||
|
|
||||||
if (ngx_http_uwsgi_merge_params(cf, conf, prev) != NGX_OK) {
|
if (conf->params_source == NULL) {
|
||||||
|
conf->params_source = prev->params_source;
|
||||||
|
|
||||||
|
#if (NGX_HTTP_CACHE)
|
||||||
|
if ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
conf->flushes = prev->flushes;
|
||||||
|
conf->params_len = prev->params_len;
|
||||||
|
conf->params = prev->params;
|
||||||
|
conf->headers_hash = prev->headers_hash;
|
||||||
|
conf->header_params = prev->header_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ngx_http_uwsgi_init_params(cf, conf) != NGX_OK) {
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1714,8 +1729,7 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
|
|
||||||
|
|
||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_http_uwsgi_merge_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf,
|
ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf)
|
||||||
ngx_http_uwsgi_loc_conf_t *prev)
|
|
||||||
{
|
{
|
||||||
u_char *p;
|
u_char *p;
|
||||||
size_t size;
|
size_t size;
|
||||||
@ -1731,24 +1745,8 @@ ngx_http_uwsgi_merge_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf,
|
|||||||
ngx_http_script_compile_t sc;
|
ngx_http_script_compile_t sc;
|
||||||
ngx_http_script_copy_code_t *copy;
|
ngx_http_script_copy_code_t *copy;
|
||||||
|
|
||||||
if (conf->params_source == NULL) {
|
if (conf->headers_hash.buckets) {
|
||||||
conf->params_source = prev->params_source;
|
return NGX_OK;
|
||||||
|
|
||||||
if (prev->headers_hash.buckets
|
|
||||||
#if (NGX_HTTP_CACHE)
|
|
||||||
&& ((conf->upstream.cache == NULL)
|
|
||||||
== (prev->upstream.cache == NULL))
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
conf->flushes = prev->flushes;
|
|
||||||
conf->params_len = prev->params_len;
|
|
||||||
conf->params = prev->params;
|
|
||||||
conf->headers_hash = prev->headers_hash;
|
|
||||||
conf->header_params = prev->header_params;
|
|
||||||
|
|
||||||
return NGX_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conf->params_source == NULL
|
if (conf->params_source == NULL
|
||||||
|
Loading…
Reference in New Issue
Block a user