aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2016-10-14 19:48:26 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2016-10-14 19:48:26 +0300
commitc541cf70cff6f384f1d95e992e735af63f916482 (patch)
treeed54c22b9c81cf74f5b7650184bfd43d13e8fc0f /src
parentf5dcb06f28a813e4ee01a7ab25882bbfa8193eb3 (diff)
downloadnginx-c541cf70cff6f384f1d95e992e735af63f916482.tar.gz
nginx-c541cf70cff6f384f1d95e992e735af63f916482.zip
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 (limited to 'src')
-rw-r--r--src/http/ngx_http_upstream.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index c2afa0cd5..4d5bea35e 100644
--- 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_conf_t *cf,
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;
}