Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_proxy_module.c @ 1180:1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 22 Apr 2007 20:21:59 +0000 |
parents | 2d978e1443ed |
children | 99914ee62b48 |
comparison
equal
deleted
inserted
replaced
1179:6e2216ad2c87 | 1180:1666b7b0bafc |
---|---|
52 ngx_str_t method; | 52 ngx_str_t method; |
53 ngx_str_t host_header; | 53 ngx_str_t host_header; |
54 ngx_str_t port; | 54 ngx_str_t port; |
55 | 55 |
56 ngx_flag_t redirect; | 56 ngx_flag_t redirect; |
57 | |
58 ngx_uint_t headers_hash_max_size; | |
59 ngx_uint_t headers_hash_bucket_size; | |
57 } ngx_http_proxy_loc_conf_t; | 60 } ngx_http_proxy_loc_conf_t; |
58 | 61 |
59 | 62 |
60 typedef struct { | 63 typedef struct { |
61 ngx_uint_t status; | 64 ngx_uint_t status; |
203 { ngx_string("proxy_set_header"), | 206 { ngx_string("proxy_set_header"), |
204 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, | 207 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, |
205 ngx_conf_set_keyval_slot, | 208 ngx_conf_set_keyval_slot, |
206 NGX_HTTP_LOC_CONF_OFFSET, | 209 NGX_HTTP_LOC_CONF_OFFSET, |
207 offsetof(ngx_http_proxy_loc_conf_t, headers_source), | 210 offsetof(ngx_http_proxy_loc_conf_t, headers_source), |
211 NULL }, | |
212 | |
213 { ngx_string("proxy_headers_hash_max_size"), | |
214 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
215 ngx_conf_set_num_slot, | |
216 NGX_HTTP_LOC_CONF_OFFSET, | |
217 offsetof(ngx_http_proxy_loc_conf_t, headers_hash_max_size), | |
218 NULL }, | |
219 | |
220 { ngx_string("proxy_headers_hash_bucket_size"), | |
221 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
222 ngx_conf_set_num_slot, | |
223 NGX_HTTP_LOC_CONF_OFFSET, | |
224 offsetof(ngx_http_proxy_loc_conf_t, headers_hash_bucket_size), | |
208 NULL }, | 225 NULL }, |
209 | 226 |
210 { ngx_string("proxy_set_body"), | 227 { ngx_string("proxy_set_body"), |
211 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 228 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
212 ngx_conf_set_str_slot, | 229 ngx_conf_set_str_slot, |
1508 conf->upstream.cyclic_temp_file = 0; | 1525 conf->upstream.cyclic_temp_file = 0; |
1509 | 1526 |
1510 conf->redirect = NGX_CONF_UNSET; | 1527 conf->redirect = NGX_CONF_UNSET; |
1511 conf->upstream.change_buffering = 1; | 1528 conf->upstream.change_buffering = 1; |
1512 | 1529 |
1530 conf->headers_hash_max_size = NGX_CONF_UNSET_UINT; | |
1531 conf->headers_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
1532 | |
1513 return conf; | 1533 return conf; |
1514 } | 1534 } |
1515 | 1535 |
1516 | 1536 |
1517 static char * | 1537 static char * |
1710 pr->replacement.text.data = NULL; | 1730 pr->replacement.text.data = NULL; |
1711 } | 1731 } |
1712 } | 1732 } |
1713 } | 1733 } |
1714 | 1734 |
1735 ngx_conf_merge_uint_value(conf->headers_hash_max_size, | |
1736 prev->headers_hash_max_size, 512); | |
1737 | |
1738 ngx_conf_merge_uint_value(conf->headers_hash_bucket_size, | |
1739 prev->headers_hash_bucket_size, 64); | |
1740 | |
1741 conf->headers_hash_bucket_size = ngx_align(conf->headers_hash_bucket_size, | |
1742 ngx_cacheline_size); | |
1743 | |
1715 if (conf->upstream.hide_headers == NULL | 1744 if (conf->upstream.hide_headers == NULL |
1716 && conf->upstream.pass_headers == NULL) | 1745 && conf->upstream.pass_headers == NULL) |
1717 { | 1746 { |
1718 conf->upstream.hide_headers = prev->upstream.hide_headers; | 1747 conf->upstream.hide_headers = prev->upstream.hide_headers; |
1719 conf->upstream.pass_headers = prev->upstream.pass_headers; | 1748 conf->upstream.pass_headers = prev->upstream.pass_headers; |
1799 } | 1828 } |
1800 } | 1829 } |
1801 | 1830 |
1802 hash.hash = &conf->upstream.hide_headers_hash; | 1831 hash.hash = &conf->upstream.hide_headers_hash; |
1803 hash.key = ngx_hash_key_lc; | 1832 hash.key = ngx_hash_key_lc; |
1804 hash.max_size = 512; | 1833 hash.max_size = conf->headers_hash_max_size; |
1805 hash.bucket_size = ngx_align(64, ngx_cacheline_size); | 1834 hash.bucket_size = conf->headers_hash_bucket_size; |
1806 hash.name = "proxy_hide_headers_hash"; | 1835 hash.name = "proxy_headers_hash"; |
1807 hash.pool = cf->pool; | 1836 hash.pool = cf->pool; |
1808 hash.temp_pool = NULL; | 1837 hash.temp_pool = NULL; |
1809 | 1838 |
1810 if (ngx_hash_init(&hash, hide_headers.elts, hide_headers.nelts) != NGX_OK) { | 1839 if (ngx_hash_init(&hash, hide_headers.elts, hide_headers.nelts) != NGX_OK) { |
1811 return NGX_CONF_ERROR; | 1840 return NGX_CONF_ERROR; |
2069 *code = (uintptr_t) NULL; | 2098 *code = (uintptr_t) NULL; |
2070 | 2099 |
2071 | 2100 |
2072 hash.hash = &conf->headers_set_hash; | 2101 hash.hash = &conf->headers_set_hash; |
2073 hash.key = ngx_hash_key_lc; | 2102 hash.key = ngx_hash_key_lc; |
2074 hash.max_size = 512; | 2103 hash.max_size = conf->headers_hash_max_size; |
2075 hash.bucket_size = ngx_cacheline_size; | 2104 hash.bucket_size = conf->headers_hash_bucket_size; |
2076 hash.name = "proxy_set_header_hash"; | 2105 hash.name = "proxy_headers_hash"; |
2077 hash.pool = cf->pool; | 2106 hash.pool = cf->pool; |
2078 hash.temp_pool = NULL; | 2107 hash.temp_pool = NULL; |
2079 | 2108 |
2080 if (ngx_hash_init(&hash, conf->headers_names->elts, | 2109 if (ngx_hash_init(&hash, conf->headers_names->elts, |
2081 conf->headers_names->nelts) | 2110 conf->headers_names->nelts) |