Welcome! Log In Create A New Profile

Advanced

[nginx] Proxy: do not create conf->headers_source when not needed.

Maxim Dounin
October 14, 2016 02:16PM
details: http://hg.nginx.org/nginx/rev/63991ab67b3a
branches:
changeset: 6746:63991ab67b3a
user: Maxim Dounin <mdounin@mdounin.ru>
date: Fri Oct 14 19:48:26 2016 +0300
description:
Proxy: do not create conf->headers_source when not needed.

diffstat:

src/http/modules/ngx_http_proxy_module.c | 27 +++++++++++----------------
1 files changed, 11 insertions(+), 16 deletions(-)

diffs (45 lines):

diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
--- 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 *
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 *
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;
+ if (conf->headers_source) {
+
+ 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;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Proxy: do not create conf->headers_source when not needed.

Maxim Dounin 145 October 14, 2016 02:16PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 72
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready