diff --git a/auto/modules b/auto/modules index 09bfcb08..645eb897 100644 --- a/auto/modules +++ b/auto/modules @@ -438,6 +438,10 @@ if [ $HTTP = YES ]; then . auto/module fi + if [ $HTTP_V2_HPACK_ENC = YES ]; then + have=NGX_HTTP_V2_HPACK_ENC . auto/have + fi + if :; then ngx_module_name=ngx_http_static_module ngx_module_incs= diff --git a/auto/options b/auto/options index d8b421b0..55b339e6 100644 --- a/auto/options +++ b/auto/options @@ -59,6 +59,7 @@ HTTP_CHARSET=YES HTTP_GZIP=YES HTTP_SSL=NO HTTP_V2=NO +HTTP_V2_HPACK_ENC=NO HTTP_SSI=YES HTTP_POSTPONE=NO HTTP_REALIP=NO @@ -225,6 +226,7 @@ $0: warning: the \"--with-ipv6\" option is deprecated" --with-http_ssl_module) HTTP_SSL=YES ;; --with-http_v2_module) HTTP_V2=YES ;; + --with-http_v2_hpack_enc) HTTP_V2_HPACK_ENC=YES ;; --with-http_realip_module) HTTP_REALIP=YES ;; --with-http_addition_module) HTTP_ADDITION=YES ;; --with-http_xslt_module) HTTP_XSLT=YES ;; @@ -440,6 +442,7 @@ cat << END --with-http_ssl_module enable ngx_http_ssl_module --with-http_v2_module enable ngx_http_v2_module + --with-http_v2_hpack_enc enable ngx_http_v2_hpack_enc --with-http_realip_module enable ngx_http_realip_module --with-http_addition_module enable ngx_http_addition_module --with-http_xslt_module enable ngx_http_xslt_module diff --git a/src/core/ngx_murmurhash.c b/src/core/ngx_murmurhash.c index 5ade658d..4932f20d 100644 --- a/src/core/ngx_murmurhash.c +++ b/src/core/ngx_murmurhash.c @@ -50,3 +50,63 @@ ngx_murmur_hash2(u_char *data, size_t len) return h; } + + +uint64_t +ngx_murmur_hash2_64(u_char *data, size_t len, uint64_t seed) +{ + uint64_t h, k; + + h = seed ^ len; + + while (len >= 8) { + k = data[0]; + k |= data[1] << 8; + k |= data[2] << 16; + k |= data[3] << 24; + k |= (uint64_t)data[4] << 32; + k |= (uint64_t)data[5] << 40; + k |= (uint64_t)data[6] << 48; + k |= (uint64_t)data[7] << 56; + + k *= 0xc6a4a7935bd1e995ull; + k ^= k >> 47; + k *= 0xc6a4a7935bd1e995ull; + + h ^= k; + h *= 0xc6a4a7935bd1e995ull; + + data += 8; + len -= 8; + } + + switch (len) { + case 7: + h ^= (uint64_t)data[6] << 48; + /* fall through */ + case 6: + h ^= (uint64_t)data[5] << 40; + /* fall through */ + case 5: + h ^= (uint64_t)data[4] << 32; + /* fall through */ + case 4: + h ^= data[3] << 24; + /* fall through */ + case 3: + h ^= data[2] << 16; + /* fall through */ + case 2: + h ^= data[1] << 8; + /* fall through */ + case 1: + h ^= data[0]; + h *= 0xc6a4a7935bd1e995ull; + } + + h ^= h >> 47; + h *= 0xc6a4a7935bd1e995ull; + h ^= h >> 47; + + return h; +} diff --git a/src/core/ngx_murmurhash.h b/src/core/ngx_murmurhash.h index 54e867d3..322b3df9 100644 --- a/src/core/ngx_murmurhash.h +++ b/src/core/ngx_murmurhash.h @@ -15,5 +15,7 @@ uint32_t ngx_murmur_hash2(u_char *data, size_t len); +uint64_t ngx_murmur_hash2_64(u_char *data, size_t len, uint64_t seed); + #endif /* _NGX_MURMURHASH_H_INCLUDED_ */ diff --git a/src/http/ngx_http_header_filter_module.c b/src/http/ngx_http_header_filter_module.c index 9b894059..1a07dace 100644 --- a/src/http/ngx_http_header_filter_module.c +++ b/src/http/ngx_http_header_filter_module.c @@ -46,11 +46,6 @@ ngx_module_t ngx_http_header_filter_module = { }; -static u_char ngx_http_server_string[] = "Server: nginx" CRLF; -static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF; -static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF; - - static ngx_str_t ngx_http_status_lines[] = { ngx_string("200 OK"), @@ -279,18 +274,6 @@ ngx_http_header_filter(ngx_http_request_t *r) clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - if (r->headers_out.server == NULL) { - if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) { - len += sizeof(ngx_http_server_full_string) - 1; - - } else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) { - len += sizeof(ngx_http_server_build_string) - 1; - - } else { - len += sizeof(ngx_http_server_string) - 1; - } - } - if (r->headers_out.date == NULL) { len += sizeof("Date: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1; } @@ -448,23 +431,6 @@ ngx_http_header_filter(ngx_http_request_t *r) } *b->last++ = CR; *b->last++ = LF; - if (r->headers_out.server == NULL) { - if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) { - p = ngx_http_server_full_string; - len = sizeof(ngx_http_server_full_string) - 1; - - } else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) { - p = ngx_http_server_build_string; - len = sizeof(ngx_http_server_build_string) - 1; - - } else { - p = ngx_http_server_string; - len = sizeof(ngx_http_server_string) - 1; - } - - b->last = ngx_cpymem(b->last, p, len); - } - if (r->headers_out.date == NULL) { b->last = ngx_cpymem(b->last, "Date: ", sizeof("Date: ") - 1); b->last = ngx_cpymem(b->last, ngx_cached_http_time.data, diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c index 2c1ff174..34f3b5c5 100644 --- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c @@ -19,21 +19,18 @@ static ngx_int_t ngx_http_send_refresh(ngx_http_request_t *r); static u_char ngx_http_error_full_tail[] = -"