comparison src/http/ngx_http_request.c @ 7627:4f18393a1d51

Disabled duplicate "Host" headers (ticket #1724). Duplicate "Host" headers were allowed in nginx 0.7.0 (revision b9de93d804ea) as a workaround for some broken Motorola phones which used to generate requests with two "Host" headers[1]. It is believed that this workaround is no longer relevant. [1] http://mailman.nginx.org/pipermail/nginx-ru/2008-May/017845.html
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 20 Feb 2020 16:51:07 +0300
parents fe5976aae0e3
children 2e3bfd696ecb
comparison
equal deleted inserted replaced
7626:fe5976aae0e3 7627:4f18393a1d51
1753 ngx_uint_t offset) 1753 ngx_uint_t offset)
1754 { 1754 {
1755 ngx_int_t rc; 1755 ngx_int_t rc;
1756 ngx_str_t host; 1756 ngx_str_t host;
1757 1757
1758 if (r->headers_in.host == NULL) { 1758 if (r->headers_in.host) {
1759 r->headers_in.host = h; 1759 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1760 } 1760 "client sent duplicate host header: \"%V: %V\", "
1761 "previous value: \"%V: %V\"",
1762 &h->key, &h->value, &r->headers_in.host->key,
1763 &r->headers_in.host->value);
1764 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
1765 return NGX_ERROR;
1766 }
1767
1768 r->headers_in.host = h;
1761 1769
1762 host = h->value; 1770 host = h->value;
1763 1771
1764 rc = ngx_http_validate_host(&host, r->pool, 0); 1772 rc = ngx_http_validate_host(&host, r->pool, 0);
1765 1773