Welcome! Log In Create A New Profile

Advanced

wether there is a bug to parse ipv6 url or not?

February 17, 2011 03:01AM
I'm reading the nginx0.9.1 source code.
now I find a bug when I read the "ngx_parse_inet6_url" function at 914 line in ngx_inet.c.
the code don't correctly get the length of port when parsing the url.
for example:
the ipv6 url is : "[::FFFF:129.144.52.38]:8080/index.html"

the code: plz see the red color part
host = u->url.data + 1;
last = u->url.data + u->url.len;

p = ngx_strlchr(host, last, ']');

if (p == NULL) {
u->err = "invalid host";
return NGX_ERROR;
}

if (last - p) {

port = p + 1;

uri = ngx_strlchr(port, last, '/');

if (uri) {
if (u->listen || !u->uri_part) {
u->err = "invalid host";
return NGX_ERROR;
}

u->uri.len = last - uri;
u->uri.data = uri;
}

if (*port == ':') {
port++;

[color=#FF0033]len = last - port; //here......... last is the end of url ,but not the position of 8080 [/color]
......
"
Subject Author Posted

wether there is a bug to parse ipv6 url or not?

garry.lgr February 17, 2011 03:01AM

Re: wether there is a bug to parse ipv6 url or not?

Maxim Dounin February 17, 2011 10:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 227
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready