Mercurial > hg > nginx
changeset 6745:93121485c39b
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 14 Oct 2016 19:48:26 +0300 |
parents | 7e5199f172fb |
children | 63991ab67b3a |
files | src/http/ngx_http_upstream.c |
diffstat | 1 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c Fri Oct 14 19:48:26 2016 +0300 +++ b/src/http/ngx_http_upstream.c Fri Oct 14 19:48:26 2016 +0300 @@ -6106,7 +6106,23 @@ 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; }