Welcome! Log In Create A New Profile

Advanced

A bug when Host header contain IPv6 address

August 31, 2011 03:37AM
For a request with an IPv6 Host header like:

Host: Host: [2001:250:1800:1::88]

The function "ngx_http_validate_host" will consider the trailing ":88]" as a port number and trim it. Therefore the value of "r->headers_in.server" and "$host" will become:

[2001:250:1800:1:

Test (in Nginx - 1.1.1):
Test config:

listen [::]:80
location / {
add_header MYHEADER $host;
return 200;
}

Test input:
telnet 2001:250:1800:1::88
Trying 2001:250:1800:1::88...
Connected to 2001:250:1800:1::88.
Escape character is '^]'.
GET / HTTP/1.0
Host: [2001:250:1800:1::88]

Test output:
HTTP/1.1 200 OK
Server: nginx/1.0.3
Date: Wed, 24 Aug 2011 12:11:07 GMT
Content-Type: application/octet-stream
Content-Length: 0
Connection: close
MYHEADER: [2001:250:1800:1:
Subject Author Posted

A bug when Host header contain IPv6 address

speedfirst August 31, 2011 03:37AM

Re: A bug when Host header contain IPv6 address

speedfirst August 31, 2011 03:49AM

Re: A bug when Host header contain IPv6 address

Maxim Dounin August 31, 2011 05:10AM

Re: A bug when Host header contain IPv6 address

speedfirst August 31, 2011 11:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 60
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready