diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index a307d2a..f06f131 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -131,7 +131,7 @@ ngx_http_header_t ngx_http_headers_in[] = { { ngx_string("Transfer-Encoding"), offsetof(ngx_http_headers_in_t, transfer_encoding), - ngx_http_process_header_line }, + ngx_http_process_unique_header_line }, { ngx_string("TE"), offsetof(ngx_http_headers_in_t, te), @@ -1762,10 +1762,18 @@ ngx_http_process_host(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_int_t rc; ngx_str_t host; - if (r->headers_in.host == NULL) { - r->headers_in.host = h; + if (r->headers_in.host) { + ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, + "client sent duplicate host header: \"%V: %V\", " + "previous value: \"%V: %V\"", + &h->key, &h->value, &r->headers_in.host->key, + &r->headers_in.host->value); + ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); + return NGX_ERROR; } + r->headers_in.host = h; + host = h->value; rc = ngx_http_validate_host(&host, r->pool, 0); @@ -1962,10 +1970,7 @@ ngx_http_process_request_header(ngx_http_request_t *r) r->headers_in.content_length_n = -1; r->headers_in.chunked = 1; - } else if (r->headers_in.transfer_encoding->value.len != 8 - || ngx_strncasecmp(r->headers_in.transfer_encoding->value.data, - (u_char *) "identity", 8) != 0) - { + } else { ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, "client sent unknown \"Transfer-Encoding\": \"%V\"", &r->headers_in.transfer_encoding->value);