Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: hide_headers_hash handling at http level.

Maxim Dounin
October 14, 2016 02:16PM
details: http://hg.nginx.org/nginx/rev/93121485c39b
branches:
changeset: 6745:93121485c39b
user: Maxim Dounin <mdounin@mdounin.ru>
date: Fri Oct 14 19:48:26 2016 +0300
description:
Upstream: hide_headers_hash handling at http level.

When headers to hide are set at the "http" level and not redefined in
a server block, we now preserve compiled headers hash into the "http"
section configuration to inherit this hash to all servers.

diffstat:

src/http/ngx_http_upstream.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)

diffs (28 lines):

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -6106,7 +6106,23 @@ ngx_http_upstream_hide_headers_hash(ngx_
hash->pool = cf->pool;
hash->temp_pool = NULL;

- return ngx_hash_init(hash, hide_headers.elts, hide_headers.nelts);
+ if (ngx_hash_init(hash, hide_headers.elts, hide_headers.nelts) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
+ /*
+ * special handling to preserve conf->hide_headers_hash
+ * in the "http" section to inherit it to all servers
+ */
+
+ if (prev->hide_headers_hash.buckets == NULL
+ && conf->hide_headers == prev->hide_headers
+ && conf->pass_headers == prev->pass_headers)
+ {
+ prev->hide_headers_hash = conf->hide_headers_hash;
+ }
+
+ return NGX_OK;
}



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

[nginx] Upstream: hide_headers_hash handling at http level.

Maxim Dounin 206 October 14, 2016 02:16PM



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

Online Users

Guests: 92
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