# HG changeset patch # User Maxim Dounin # Date 1476463706 -10800 # Node ID 93121485c39b328faea64edb0ebdb995b8e47953 # Parent 7e5199f172fb5f8a813234981b48af8030130b98 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. 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; }