comparison src/http/ngx_http_upstream.c @ 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 563a1ee345a4
comparison
equal deleted inserted replaced
6744:7e5199f172fb 6745:93121485c39b
6104 hash->hash = &conf->hide_headers_hash; 6104 hash->hash = &conf->hide_headers_hash;
6105 hash->key = ngx_hash_key_lc; 6105 hash->key = ngx_hash_key_lc;
6106 hash->pool = cf->pool; 6106 hash->pool = cf->pool;
6107 hash->temp_pool = NULL; 6107 hash->temp_pool = NULL;
6108 6108
6109 return ngx_hash_init(hash, hide_headers.elts, hide_headers.nelts); 6109 if (ngx_hash_init(hash, hide_headers.elts, hide_headers.nelts) != NGX_OK) {
6110 return NGX_ERROR;
6111 }
6112
6113 /*
6114 * special handling to preserve conf->hide_headers_hash
6115 * in the "http" section to inherit it to all servers
6116 */
6117
6118 if (prev->hide_headers_hash.buckets == NULL
6119 && conf->hide_headers == prev->hide_headers
6120 && conf->pass_headers == prev->pass_headers)
6121 {
6122 prev->hide_headers_hash = conf->hide_headers_hash;
6123 }
6124
6125 return NGX_OK;
6110 } 6126 }
6111 6127
6112 6128
6113 static void * 6129 static void *
6114 ngx_http_upstream_create_main_conf(ngx_conf_t *cf) 6130 ngx_http_upstream_create_main_conf(ngx_conf_t *cf)