mirror of
https://github.com/nginx/nginx.git
synced 2024-12-02 20:09:01 +08:00
Upstream: moved header lists to separate structures.
No functional changes.
This commit is contained in:
parent
62dfdf1814
commit
bcf6b11a34
@ -10,23 +10,28 @@
|
||||
#include <ngx_http.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_array_t *flushes;
|
||||
ngx_array_t *lengths;
|
||||
ngx_array_t *values;
|
||||
ngx_uint_t number;
|
||||
ngx_hash_t hash;
|
||||
} ngx_http_fastcgi_params_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_http_upstream_conf_t upstream;
|
||||
|
||||
ngx_str_t index;
|
||||
|
||||
ngx_array_t *flushes;
|
||||
ngx_array_t *params_len;
|
||||
ngx_array_t *params;
|
||||
ngx_http_fastcgi_params_t params;
|
||||
|
||||
ngx_array_t *params_source;
|
||||
ngx_array_t *catch_stderr;
|
||||
|
||||
ngx_array_t *fastcgi_lengths;
|
||||
ngx_array_t *fastcgi_values;
|
||||
|
||||
ngx_hash_t headers_hash;
|
||||
ngx_uint_t header_params;
|
||||
|
||||
ngx_flag_t keep_conn;
|
||||
|
||||
#if (NGX_HTTP_CACHE)
|
||||
@ -151,7 +156,7 @@ static void *ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
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 *conf, ngx_http_fastcgi_params_t *params);
|
||||
|
||||
static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
@ -780,6 +785,7 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
|
||||
ngx_http_script_code_pt code;
|
||||
ngx_http_script_engine_t e, le;
|
||||
ngx_http_fastcgi_header_t *h;
|
||||
ngx_http_fastcgi_params_t *params;
|
||||
ngx_http_fastcgi_loc_conf_t *flcf;
|
||||
ngx_http_script_len_code_pt lcode;
|
||||
|
||||
@ -789,13 +795,15 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
|
||||
|
||||
flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
|
||||
|
||||
if (flcf->params_len) {
|
||||
params = &flcf->params;
|
||||
|
||||
if (params->lengths) {
|
||||
ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
|
||||
|
||||
ngx_http_script_flush_no_cacheable_variables(r, flcf->flushes);
|
||||
ngx_http_script_flush_no_cacheable_variables(r, params->flushes);
|
||||
le.flushed = 1;
|
||||
|
||||
le.ip = flcf->params_len->elts;
|
||||
le.ip = params->lengths->elts;
|
||||
le.request = r;
|
||||
|
||||
while (*(uintptr_t *) le.ip) {
|
||||
@ -824,7 +832,7 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
|
||||
allocated = 0;
|
||||
lowcase_key = NULL;
|
||||
|
||||
if (flcf->header_params) {
|
||||
if (params->number) {
|
||||
n = 0;
|
||||
part = &r->headers_in.headers.part;
|
||||
|
||||
@ -854,7 +862,7 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (flcf->header_params) {
|
||||
if (params->number) {
|
||||
if (allocated < header[i].key.len) {
|
||||
allocated = header[i].key.len + 16;
|
||||
lowcase_key = ngx_pnalloc(r->pool, allocated);
|
||||
@ -879,7 +887,7 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
|
||||
lowcase_key[n] = ch;
|
||||
}
|
||||
|
||||
if (ngx_hash_find(&flcf->headers_hash, hash, lowcase_key, n)) {
|
||||
if (ngx_hash_find(¶ms->hash, hash, lowcase_key, n)) {
|
||||
ignored[header_params++] = &header[i];
|
||||
continue;
|
||||
}
|
||||
@ -949,15 +957,15 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
|
||||
+ sizeof(ngx_http_fastcgi_header_t);
|
||||
|
||||
|
||||
if (flcf->params_len) {
|
||||
if (params->lengths) {
|
||||
ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
|
||||
|
||||
e.ip = flcf->params->elts;
|
||||
e.ip = params->values->elts;
|
||||
e.pos = b->last;
|
||||
e.request = r;
|
||||
e.flushed = 1;
|
||||
|
||||
le.ip = flcf->params_len->elts;
|
||||
le.ip = params->lengths->elts;
|
||||
|
||||
while (*(uintptr_t *) le.ip) {
|
||||
|
||||
@ -2710,15 +2718,11 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
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) {
|
||||
if (ngx_http_fastcgi_init_params(cf, conf, &conf->params) != NGX_OK) {
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
@ -2727,7 +2731,8 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||
ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf,
|
||||
ngx_http_fastcgi_params_t *params)
|
||||
{
|
||||
u_char *p;
|
||||
size_t size;
|
||||
@ -2743,7 +2748,7 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||
ngx_http_script_compile_t sc;
|
||||
ngx_http_script_copy_code_t *copy;
|
||||
|
||||
if (conf->headers_hash.buckets) {
|
||||
if (params->hash.buckets) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
@ -2753,17 +2758,17 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
conf->headers_hash.buckets = (void *) 1;
|
||||
params->hash.buckets = (void *) 1;
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
conf->params_len = ngx_array_create(cf->pool, 64, 1);
|
||||
if (conf->params_len == NULL) {
|
||||
params->lengths = ngx_array_create(cf->pool, 64, 1);
|
||||
if (params->lengths == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
conf->params = ngx_array_create(cf->pool, 512, 1);
|
||||
if (conf->params == NULL) {
|
||||
params->values = ngx_array_create(cf->pool, 512, 1);
|
||||
if (params->values == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -2858,7 +2863,7 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||
}
|
||||
}
|
||||
|
||||
copy = ngx_array_push_n(conf->params_len,
|
||||
copy = ngx_array_push_n(params->lengths,
|
||||
sizeof(ngx_http_script_copy_code_t));
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -2867,7 +2872,7 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||
copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].key.len;
|
||||
|
||||
copy = ngx_array_push_n(conf->params_len,
|
||||
copy = ngx_array_push_n(params->lengths,
|
||||
sizeof(ngx_http_script_copy_code_t));
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -2881,7 +2886,7 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||
+ src[i].key.len + sizeof(uintptr_t) - 1)
|
||||
& ~(sizeof(uintptr_t) - 1);
|
||||
|
||||
copy = ngx_array_push_n(conf->params, size);
|
||||
copy = ngx_array_push_n(params->values, size);
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -2897,15 +2902,15 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||
|
||||
sc.cf = cf;
|
||||
sc.source = &src[i].value;
|
||||
sc.flushes = &conf->flushes;
|
||||
sc.lengths = &conf->params_len;
|
||||
sc.values = &conf->params;
|
||||
sc.flushes = ¶ms->flushes;
|
||||
sc.lengths = ¶ms->lengths;
|
||||
sc.values = ¶ms->values;
|
||||
|
||||
if (ngx_http_script_compile(&sc) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -2913,7 +2918,7 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||
*code = (uintptr_t) NULL;
|
||||
|
||||
|
||||
code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(params->values, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -2921,16 +2926,16 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf)
|
||||
*code = (uintptr_t) NULL;
|
||||
}
|
||||
|
||||
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
*code = (uintptr_t) NULL;
|
||||
|
||||
conf->header_params = headers_names.nelts;
|
||||
params->number = headers_names.nelts;
|
||||
|
||||
hash.hash = &conf->headers_hash;
|
||||
hash.hash = ¶ms->hash;
|
||||
hash.key = ngx_hash_key_lc;
|
||||
hash.max_size = 512;
|
||||
hash.bucket_size = 64;
|
||||
|
@ -39,16 +39,22 @@ typedef struct {
|
||||
} ngx_http_proxy_vars_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_array_t *flushes;
|
||||
ngx_array_t *lengths;
|
||||
ngx_array_t *values;
|
||||
ngx_hash_t hash;
|
||||
} ngx_http_proxy_headers_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_http_upstream_conf_t upstream;
|
||||
|
||||
ngx_array_t *flushes;
|
||||
ngx_array_t *body_flushes;
|
||||
ngx_array_t *body_set_len;
|
||||
ngx_array_t *body_set;
|
||||
ngx_array_t *headers_set_len;
|
||||
ngx_array_t *headers_set;
|
||||
ngx_hash_t headers_set_hash;
|
||||
|
||||
ngx_http_proxy_headers_t headers;
|
||||
ngx_array_t *headers_source;
|
||||
|
||||
ngx_array_t *proxy_lengths;
|
||||
@ -147,7 +153,7 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
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 *conf, ngx_http_proxy_headers_t *headers);
|
||||
|
||||
static char *ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
void *conf);
|
||||
@ -1080,6 +1086,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
ngx_http_upstream_t *u;
|
||||
ngx_http_proxy_ctx_t *ctx;
|
||||
ngx_http_script_code_pt code;
|
||||
ngx_http_proxy_headers_t *headers;
|
||||
ngx_http_script_engine_t e, le;
|
||||
ngx_http_proxy_loc_conf_t *plcf;
|
||||
ngx_http_script_len_code_pt lcode;
|
||||
@ -1088,6 +1095,8 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
|
||||
plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
|
||||
|
||||
headers = &plcf->headers;
|
||||
|
||||
if (u->method.len) {
|
||||
/* HEAD was changed to GET to cache response */
|
||||
method = u->method;
|
||||
@ -1146,7 +1155,8 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
|
||||
ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
|
||||
|
||||
ngx_http_script_flush_no_cacheable_variables(r, plcf->flushes);
|
||||
ngx_http_script_flush_no_cacheable_variables(r, plcf->body_flushes);
|
||||
ngx_http_script_flush_no_cacheable_variables(r, headers->flushes);
|
||||
|
||||
if (plcf->body_set_len) {
|
||||
le.ip = plcf->body_set_len->elts;
|
||||
@ -1166,7 +1176,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
ctx->internal_body_length = r->headers_in.content_length_n;
|
||||
}
|
||||
|
||||
le.ip = plcf->headers_set_len->elts;
|
||||
le.ip = headers->lengths->elts;
|
||||
le.request = r;
|
||||
le.flushed = 1;
|
||||
|
||||
@ -1195,7 +1205,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (ngx_hash_find(&plcf->headers_set_hash, header[i].hash,
|
||||
if (ngx_hash_find(&headers->hash, header[i].hash,
|
||||
header[i].lowcase_key, header[i].key.len))
|
||||
{
|
||||
continue;
|
||||
@ -1266,12 +1276,12 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
|
||||
ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
|
||||
|
||||
e.ip = plcf->headers_set->elts;
|
||||
e.ip = headers->values->elts;
|
||||
e.pos = b->last;
|
||||
e.request = r;
|
||||
e.flushed = 1;
|
||||
|
||||
le.ip = plcf->headers_set_len->elts;
|
||||
le.ip = headers->lengths->elts;
|
||||
|
||||
while (*(uintptr_t *) le.ip) {
|
||||
lcode = *(ngx_http_script_len_code_pt *) le.ip;
|
||||
@ -1319,7 +1329,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (ngx_hash_find(&plcf->headers_set_hash, header[i].hash,
|
||||
if (ngx_hash_find(&headers->hash, header[i].hash,
|
||||
header[i].lowcase_key, header[i].key.len))
|
||||
{
|
||||
continue;
|
||||
@ -2502,9 +2512,9 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
||||
*
|
||||
* conf->method = { 0, NULL };
|
||||
* conf->headers_source = NULL;
|
||||
* conf->headers_set_len = NULL;
|
||||
* conf->headers_set = NULL;
|
||||
* conf->headers_set_hash = NULL;
|
||||
* conf->headers.lengths = NULL;
|
||||
* conf->headers.values = NULL;
|
||||
* conf->headers.hash = { NULL, 0 };
|
||||
* conf->body_set_len = NULL;
|
||||
* conf->body_set = NULL;
|
||||
* conf->body_source = { 0, NULL };
|
||||
@ -2993,6 +3003,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
}
|
||||
|
||||
if (conf->body_source.data == NULL) {
|
||||
conf->body_flushes = prev->body_flushes;
|
||||
conf->body_source = prev->body_source;
|
||||
conf->body_set_len = prev->body_set_len;
|
||||
conf->body_set = prev->body_set;
|
||||
@ -3004,7 +3015,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
|
||||
sc.cf = cf;
|
||||
sc.source = &conf->body_source;
|
||||
sc.flushes = &conf->flushes;
|
||||
sc.flushes = &conf->body_flushes;
|
||||
sc.lengths = &conf->body_set_len;
|
||||
sc.values = &conf->body_set;
|
||||
sc.complete_lengths = 1;
|
||||
@ -3016,20 +3027,17 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
}
|
||||
|
||||
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 = prev->headers;
|
||||
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;
|
||||
conf->headers.hash.buckets = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ngx_http_proxy_init_headers(cf, conf) != NGX_OK) {
|
||||
if (ngx_http_proxy_init_headers(cf, conf, &conf->headers) != NGX_OK) {
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
@ -3038,7 +3046,8 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_proxy_init_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_headers_t *headers)
|
||||
{
|
||||
u_char *p;
|
||||
size_t size;
|
||||
@ -3051,7 +3060,7 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
ngx_http_script_compile_t sc;
|
||||
ngx_http_script_copy_code_t *copy;
|
||||
|
||||
if (conf->headers_set_hash.buckets) {
|
||||
if (headers->hash.buckets) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
@ -3075,13 +3084,13 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
}
|
||||
}
|
||||
|
||||
conf->headers_set_len = ngx_array_create(cf->pool, 64, 1);
|
||||
if (conf->headers_set_len == NULL) {
|
||||
headers->lengths = ngx_array_create(cf->pool, 64, 1);
|
||||
if (headers->lengths == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
conf->headers_set = ngx_array_create(cf->pool, 512, 1);
|
||||
if (conf->headers_set == NULL) {
|
||||
headers->values = ngx_array_create(cf->pool, 512, 1);
|
||||
if (headers->values == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -3146,7 +3155,7 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
}
|
||||
|
||||
if (ngx_http_script_variables_count(&src[i].value) == 0) {
|
||||
copy = ngx_array_push_n(conf->headers_set_len,
|
||||
copy = ngx_array_push_n(headers->lengths,
|
||||
sizeof(ngx_http_script_copy_code_t));
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -3164,7 +3173,7 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
+ sizeof(uintptr_t) - 1)
|
||||
& ~(sizeof(uintptr_t) - 1);
|
||||
|
||||
copy = ngx_array_push_n(conf->headers_set, size);
|
||||
copy = ngx_array_push_n(headers->values, size);
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -3181,7 +3190,7 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
*p++ = CR; *p = LF;
|
||||
|
||||
} else {
|
||||
copy = ngx_array_push_n(conf->headers_set_len,
|
||||
copy = ngx_array_push_n(headers->lengths,
|
||||
sizeof(ngx_http_script_copy_code_t));
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -3196,7 +3205,7 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
+ src[i].key.len + sizeof(": ") - 1 + sizeof(uintptr_t) - 1)
|
||||
& ~(sizeof(uintptr_t) - 1);
|
||||
|
||||
copy = ngx_array_push_n(conf->headers_set, size);
|
||||
copy = ngx_array_push_n(headers->values, size);
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -3213,16 +3222,16 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
|
||||
sc.cf = cf;
|
||||
sc.source = &src[i].value;
|
||||
sc.flushes = &conf->flushes;
|
||||
sc.lengths = &conf->headers_set_len;
|
||||
sc.values = &conf->headers_set;
|
||||
sc.flushes = &headers->flushes;
|
||||
sc.lengths = &headers->lengths;
|
||||
sc.values = &headers->values;
|
||||
|
||||
if (ngx_http_script_compile(&sc) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
copy = ngx_array_push_n(conf->headers_set_len,
|
||||
copy = ngx_array_push_n(headers->lengths,
|
||||
sizeof(ngx_http_script_copy_code_t));
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -3237,7 +3246,7 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
+ sizeof(CRLF) - 1 + sizeof(uintptr_t) - 1)
|
||||
& ~(sizeof(uintptr_t) - 1);
|
||||
|
||||
copy = ngx_array_push_n(conf->headers_set, size);
|
||||
copy = ngx_array_push_n(headers->values, size);
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -3249,14 +3258,14 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
*p++ = CR; *p = LF;
|
||||
}
|
||||
|
||||
code = ngx_array_push_n(conf->headers_set_len, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
*code = (uintptr_t) NULL;
|
||||
|
||||
code = ngx_array_push_n(conf->headers_set, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(headers->values, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -3264,7 +3273,7 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
*code = (uintptr_t) NULL;
|
||||
}
|
||||
|
||||
code = ngx_array_push_n(conf->headers_set_len, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -3272,7 +3281,7 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf)
|
||||
*code = (uintptr_t) NULL;
|
||||
|
||||
|
||||
hash.hash = &conf->headers_set_hash;
|
||||
hash.hash = &headers->hash;
|
||||
hash.key = ngx_hash_key_lc;
|
||||
hash.max_size = conf->headers_hash_max_size;
|
||||
hash.bucket_size = conf->headers_hash_bucket_size;
|
||||
|
@ -11,17 +11,21 @@
|
||||
#include <ngx_http.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_array_t *flushes;
|
||||
ngx_array_t *lengths;
|
||||
ngx_array_t *values;
|
||||
ngx_uint_t number;
|
||||
ngx_hash_t hash;
|
||||
} ngx_http_scgi_params_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_http_upstream_conf_t upstream;
|
||||
|
||||
ngx_array_t *flushes;
|
||||
ngx_array_t *params_len;
|
||||
ngx_array_t *params;
|
||||
ngx_http_scgi_params_t params;
|
||||
ngx_array_t *params_source;
|
||||
|
||||
ngx_hash_t headers_hash;
|
||||
ngx_uint_t header_params;
|
||||
|
||||
ngx_array_t *scgi_lengths;
|
||||
ngx_array_t *scgi_values;
|
||||
|
||||
@ -44,7 +48,7 @@ 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,
|
||||
void *child);
|
||||
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 *conf, ngx_http_scgi_params_t *params);
|
||||
|
||||
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,
|
||||
@ -579,6 +583,7 @@ ngx_http_scgi_create_request(ngx_http_request_t *r)
|
||||
ngx_chain_t *cl, *body;
|
||||
ngx_list_part_t *part;
|
||||
ngx_table_elt_t *header, **ignored;
|
||||
ngx_http_scgi_params_t *params;
|
||||
ngx_http_script_code_pt code;
|
||||
ngx_http_script_engine_t e, le;
|
||||
ngx_http_scgi_loc_conf_t *scf;
|
||||
@ -603,13 +608,15 @@ ngx_http_scgi_create_request(ngx_http_request_t *r)
|
||||
|
||||
scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module);
|
||||
|
||||
if (scf->params_len) {
|
||||
params = &scf->params;
|
||||
|
||||
if (params->lengths) {
|
||||
ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
|
||||
|
||||
ngx_http_script_flush_no_cacheable_variables(r, scf->flushes);
|
||||
ngx_http_script_flush_no_cacheable_variables(r, params->flushes);
|
||||
le.flushed = 1;
|
||||
|
||||
le.ip = scf->params_len->elts;
|
||||
le.ip = params->lengths->elts;
|
||||
le.request = r;
|
||||
|
||||
while (*(uintptr_t *) le.ip) {
|
||||
@ -638,7 +645,7 @@ ngx_http_scgi_create_request(ngx_http_request_t *r)
|
||||
allocated = 0;
|
||||
lowcase_key = NULL;
|
||||
|
||||
if (scf->header_params) {
|
||||
if (params->number) {
|
||||
n = 0;
|
||||
part = &r->headers_in.headers.part;
|
||||
|
||||
@ -668,7 +675,7 @@ ngx_http_scgi_create_request(ngx_http_request_t *r)
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (scf->header_params) {
|
||||
if (params->number) {
|
||||
if (allocated < header[i].key.len) {
|
||||
allocated = header[i].key.len + 16;
|
||||
lowcase_key = ngx_pnalloc(r->pool, allocated);
|
||||
@ -693,7 +700,7 @@ ngx_http_scgi_create_request(ngx_http_request_t *r)
|
||||
lowcase_key[n] = ch;
|
||||
}
|
||||
|
||||
if (ngx_hash_find(&scf->headers_hash, hash, lowcase_key, n)) {
|
||||
if (ngx_hash_find(¶ms->hash, hash, lowcase_key, n)) {
|
||||
ignored[header_params++] = &header[i];
|
||||
continue;
|
||||
}
|
||||
@ -721,15 +728,15 @@ ngx_http_scgi_create_request(ngx_http_request_t *r)
|
||||
b->last = ngx_sprintf(b->last, "%ui:CONTENT_LENGTH%Z%V%Z",
|
||||
len, &content_length);
|
||||
|
||||
if (scf->params_len) {
|
||||
if (params->lengths) {
|
||||
ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
|
||||
|
||||
e.ip = scf->params->elts;
|
||||
e.ip = params->values->elts;
|
||||
e.pos = b->last;
|
||||
e.request = r;
|
||||
e.flushed = 1;
|
||||
|
||||
le.ip = scf->params_len->elts;
|
||||
le.ip = params->lengths->elts;
|
||||
|
||||
while (*(uintptr_t *) le.ip) {
|
||||
|
||||
@ -1450,15 +1457,11 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
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) {
|
||||
if (ngx_http_scgi_init_params(cf, conf, &conf->params) != NGX_OK) {
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
@ -1467,7 +1470,8 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_scgi_init_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_params_t *params)
|
||||
{
|
||||
u_char *p;
|
||||
size_t size;
|
||||
@ -1483,7 +1487,7 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
|
||||
ngx_http_script_compile_t sc;
|
||||
ngx_http_script_copy_code_t *copy;
|
||||
|
||||
if (conf->headers_hash.buckets) {
|
||||
if (params->hash.buckets) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
@ -1493,17 +1497,17 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
conf->headers_hash.buckets = (void *) 1;
|
||||
params->hash.buckets = (void *) 1;
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
conf->params_len = ngx_array_create(cf->pool, 64, 1);
|
||||
if (conf->params_len == NULL) {
|
||||
params->lengths = ngx_array_create(cf->pool, 64, 1);
|
||||
if (params->lengths == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
conf->params = ngx_array_create(cf->pool, 512, 1);
|
||||
if (conf->params == NULL) {
|
||||
params->values = ngx_array_create(cf->pool, 512, 1);
|
||||
if (params->values == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -1598,7 +1602,7 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
|
||||
}
|
||||
}
|
||||
|
||||
copy = ngx_array_push_n(conf->params_len,
|
||||
copy = ngx_array_push_n(params->lengths,
|
||||
sizeof(ngx_http_script_copy_code_t));
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -1607,7 +1611,7 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
|
||||
copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].key.len + 1;
|
||||
|
||||
copy = ngx_array_push_n(conf->params_len,
|
||||
copy = ngx_array_push_n(params->lengths,
|
||||
sizeof(ngx_http_script_copy_code_t));
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -1621,7 +1625,7 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
|
||||
+ src[i].key.len + 1 + sizeof(uintptr_t) - 1)
|
||||
& ~(sizeof(uintptr_t) - 1);
|
||||
|
||||
copy = ngx_array_push_n(conf->params, size);
|
||||
copy = ngx_array_push_n(params->values, size);
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -1637,15 +1641,15 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
|
||||
|
||||
sc.cf = cf;
|
||||
sc.source = &src[i].value;
|
||||
sc.flushes = &conf->flushes;
|
||||
sc.lengths = &conf->params_len;
|
||||
sc.values = &conf->params;
|
||||
sc.flushes = ¶ms->flushes;
|
||||
sc.lengths = ¶ms->lengths;
|
||||
sc.values = ¶ms->values;
|
||||
|
||||
if (ngx_http_script_compile(&sc) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -1653,7 +1657,7 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
|
||||
*code = (uintptr_t) NULL;
|
||||
|
||||
|
||||
code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(params->values, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -1661,16 +1665,16 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf)
|
||||
*code = (uintptr_t) NULL;
|
||||
}
|
||||
|
||||
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
*code = (uintptr_t) NULL;
|
||||
|
||||
conf->header_params = headers_names.nelts;
|
||||
params->number = headers_names.nelts;
|
||||
|
||||
hash.hash = &conf->headers_hash;
|
||||
hash.hash = ¶ms->hash;
|
||||
hash.key = ngx_hash_key_lc;
|
||||
hash.max_size = 512;
|
||||
hash.bucket_size = 64;
|
||||
|
@ -12,17 +12,21 @@
|
||||
#include <ngx_http.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_array_t *flushes;
|
||||
ngx_array_t *lengths;
|
||||
ngx_array_t *values;
|
||||
ngx_uint_t number;
|
||||
ngx_hash_t hash;
|
||||
} ngx_http_uwsgi_params_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_http_upstream_conf_t upstream;
|
||||
|
||||
ngx_array_t *flushes;
|
||||
ngx_array_t *params_len;
|
||||
ngx_array_t *params;
|
||||
ngx_http_uwsgi_params_t params;
|
||||
ngx_array_t *params_source;
|
||||
|
||||
ngx_hash_t headers_hash;
|
||||
ngx_uint_t header_params;
|
||||
|
||||
ngx_array_t *uwsgi_lengths;
|
||||
ngx_array_t *uwsgi_values;
|
||||
|
||||
@ -63,7 +67,7 @@ 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,
|
||||
void *child);
|
||||
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 *conf, ngx_http_uwsgi_params_t *params);
|
||||
|
||||
static char *ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
void *conf);
|
||||
@ -779,6 +783,7 @@ ngx_http_uwsgi_create_request(ngx_http_request_t *r)
|
||||
ngx_chain_t *cl, *body;
|
||||
ngx_list_part_t *part;
|
||||
ngx_table_elt_t *header, **ignored;
|
||||
ngx_http_uwsgi_params_t *params;
|
||||
ngx_http_script_code_pt code;
|
||||
ngx_http_script_engine_t e, le;
|
||||
ngx_http_uwsgi_loc_conf_t *uwcf;
|
||||
@ -790,13 +795,15 @@ ngx_http_uwsgi_create_request(ngx_http_request_t *r)
|
||||
|
||||
uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module);
|
||||
|
||||
if (uwcf->params_len) {
|
||||
params = &uwcf->params;
|
||||
|
||||
if (params->lengths) {
|
||||
ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
|
||||
|
||||
ngx_http_script_flush_no_cacheable_variables(r, uwcf->flushes);
|
||||
ngx_http_script_flush_no_cacheable_variables(r, params->flushes);
|
||||
le.flushed = 1;
|
||||
|
||||
le.ip = uwcf->params_len->elts;
|
||||
le.ip = params->lengths->elts;
|
||||
le.request = r;
|
||||
|
||||
while (*(uintptr_t *) le.ip) {
|
||||
@ -825,7 +832,7 @@ ngx_http_uwsgi_create_request(ngx_http_request_t *r)
|
||||
allocated = 0;
|
||||
lowcase_key = NULL;
|
||||
|
||||
if (uwcf->header_params) {
|
||||
if (params->number) {
|
||||
n = 0;
|
||||
part = &r->headers_in.headers.part;
|
||||
|
||||
@ -855,7 +862,7 @@ ngx_http_uwsgi_create_request(ngx_http_request_t *r)
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (uwcf->header_params) {
|
||||
if (params->number) {
|
||||
if (allocated < header[i].key.len) {
|
||||
allocated = header[i].key.len + 16;
|
||||
lowcase_key = ngx_pnalloc(r->pool, allocated);
|
||||
@ -880,7 +887,7 @@ ngx_http_uwsgi_create_request(ngx_http_request_t *r)
|
||||
lowcase_key[n] = ch;
|
||||
}
|
||||
|
||||
if (ngx_hash_find(&uwcf->headers_hash, hash, lowcase_key, n)) {
|
||||
if (ngx_hash_find(¶ms->hash, hash, lowcase_key, n)) {
|
||||
ignored[header_params++] = &header[i];
|
||||
continue;
|
||||
}
|
||||
@ -919,15 +926,15 @@ ngx_http_uwsgi_create_request(ngx_http_request_t *r)
|
||||
*b->last++ = (u_char) ((len >> 8) & 0xff);
|
||||
*b->last++ = (u_char) uwcf->modifier2;
|
||||
|
||||
if (uwcf->params_len) {
|
||||
if (params->lengths) {
|
||||
ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
|
||||
|
||||
e.ip = uwcf->params->elts;
|
||||
e.ip = params->values->elts;
|
||||
e.pos = b->last;
|
||||
e.request = r;
|
||||
e.flushed = 1;
|
||||
|
||||
le.ip = uwcf->params_len->elts;
|
||||
le.ip = params->lengths->elts;
|
||||
|
||||
while (*(uintptr_t *) le.ip) {
|
||||
|
||||
@ -1712,15 +1719,11 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
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) {
|
||||
if (ngx_http_uwsgi_init_params(cf, conf, &conf->params) != NGX_OK) {
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
@ -1729,7 +1732,8 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_uwsgi_init_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_params_t *params)
|
||||
{
|
||||
u_char *p;
|
||||
size_t size;
|
||||
@ -1745,7 +1749,7 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf)
|
||||
ngx_http_script_compile_t sc;
|
||||
ngx_http_script_copy_code_t *copy;
|
||||
|
||||
if (conf->headers_hash.buckets) {
|
||||
if (params->hash.buckets) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
@ -1755,17 +1759,17 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
conf->headers_hash.buckets = (void *) 1;
|
||||
params->hash.buckets = (void *) 1;
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
conf->params_len = ngx_array_create(cf->pool, 64, 1);
|
||||
if (conf->params_len == NULL) {
|
||||
params->lengths = ngx_array_create(cf->pool, 64, 1);
|
||||
if (params->lengths == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
conf->params = ngx_array_create(cf->pool, 512, 1);
|
||||
if (conf->params == NULL) {
|
||||
params->values = ngx_array_create(cf->pool, 512, 1);
|
||||
if (params->values == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -1860,7 +1864,7 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf)
|
||||
}
|
||||
}
|
||||
|
||||
copy = ngx_array_push_n(conf->params_len,
|
||||
copy = ngx_array_push_n(params->lengths,
|
||||
sizeof(ngx_http_script_copy_code_t));
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -1869,7 +1873,7 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf)
|
||||
copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].key.len;
|
||||
|
||||
copy = ngx_array_push_n(conf->params_len,
|
||||
copy = ngx_array_push_n(params->lengths,
|
||||
sizeof(ngx_http_script_copy_code_t));
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -1883,7 +1887,7 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf)
|
||||
+ src[i].key.len + sizeof(uintptr_t) - 1)
|
||||
& ~(sizeof(uintptr_t) - 1);
|
||||
|
||||
copy = ngx_array_push_n(conf->params, size);
|
||||
copy = ngx_array_push_n(params->values, size);
|
||||
if (copy == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -1899,15 +1903,15 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf)
|
||||
|
||||
sc.cf = cf;
|
||||
sc.source = &src[i].value;
|
||||
sc.flushes = &conf->flushes;
|
||||
sc.lengths = &conf->params_len;
|
||||
sc.values = &conf->params;
|
||||
sc.flushes = ¶ms->flushes;
|
||||
sc.lengths = ¶ms->lengths;
|
||||
sc.values = ¶ms->values;
|
||||
|
||||
if (ngx_http_script_compile(&sc) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -1915,7 +1919,7 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf)
|
||||
*code = (uintptr_t) NULL;
|
||||
|
||||
|
||||
code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(params->values, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -1923,16 +1927,16 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf)
|
||||
*code = (uintptr_t) NULL;
|
||||
}
|
||||
|
||||
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
|
||||
code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
|
||||
if (code == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
*code = (uintptr_t) NULL;
|
||||
|
||||
conf->header_params = headers_names.nelts;
|
||||
params->number = headers_names.nelts;
|
||||
|
||||
hash.hash = &conf->headers_hash;
|
||||
hash.hash = ¶ms->hash;
|
||||
hash.key = ngx_hash_key_lc;
|
||||
hash.max_size = 512;
|
||||
hash.bucket_size = 64;
|
||||
|
Loading…
Reference in New Issue
Block a user