diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2016-10-14 19:48:26 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2016-10-14 19:48:26 +0300 |
commit | 97fc4ab790a564ea35aabdb6573ff2afd30e83e0 (patch) | |
tree | 166158708c79c88e68697c292269fb23b83ec56c /src/http/modules/ngx_http_proxy_module.c | |
parent | c541cf70cff6f384f1d95e992e735af63f916482 (diff) |
Proxy: do not create conf->headers_source when not needed.
Diffstat (limited to 'src/http/modules/ngx_http_proxy_module.c')
-rw-r--r-- | src/http/modules/ngx_http_proxy_module.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index 4f49a5276..f7f91d662 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -3392,14 +3392,6 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf, return NGX_ERROR; } - if (conf->headers_source == NULL) { - conf->headers_source = ngx_array_create(cf->pool, 4, - sizeof(ngx_keyval_t)); - if (conf->headers_source == NULL) { - return NGX_ERROR; - } - } - headers->lengths = ngx_array_create(cf->pool, 64, 1); if (headers->lengths == NULL) { return NGX_ERROR; @@ -3410,15 +3402,18 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf, return NGX_ERROR; } - src = conf->headers_source->elts; - for (i = 0; i < conf->headers_source->nelts; i++) { + if (conf->headers_source) { - s = ngx_array_push(&headers_merged); - if (s == NULL) { - return NGX_ERROR; - } + src = conf->headers_source->elts; + for (i = 0; i < conf->headers_source->nelts; i++) { + + s = ngx_array_push(&headers_merged); + if (s == NULL) { + return NGX_ERROR; + } - *s = src[i]; + *s = src[i]; + } } h = default_headers; |