Welcome! Log In Create A New Profile

Advanced

[PATCH] Make Nginx Parse URL to IPv6

March 02, 2011 03:58AM
This is a new implementation according to your comments.

Here is my comments to this patch

1. ngx_inet_sock_addr is removed. You are right, ngx_parse_url can do that
job. So no need to change ngx_inet.h

2. the old "gethostbyname" implementation will be used if "--with-ipv6" is
not set; when "--with-ipv6" is set, "getaddrinfo" will be used

3. now when "ngx_inet_parse_url" find u->host might be a hostname, it will
invoke new added function "ngx_inet_resolve_hostname".

4. seems there is a bug in old file's line 829. Only when uri is NULL, len =
last - port.

5. now "ngx_inet6_parse_url" will finally invoke new added
"ngx_inet6_resolve_host", just like what "ngx_inet_parse_url" does. I think
it should be done but the old code doesn't do that. Please confirm this is
valid.

6. I try to remove duplicated code as much as possible, so the
"ngx_inet_resolve_host" is almost rewritten. Now, it will first handle the
u->host as it's an IP; if not, it will try to resolve them.

7. In "ngx_inet_parse_url", it firstly assume it's AF_INET and allocate the
memory. I think it's not suitable in the new implementation, but I didn't
touch this part of code.

8. All the fix are tested as before (with and without "--with-ipv6"), all
test are passed.

9. I make this implementation based on 0.9.3. I compare the ngx_inet.c in
official 0.9.3 and 0.9.5, and find there is a difference:

- for (i = 0; i < u->naddrs; i++) {
+ for (i = 0; h->h_addr_list[i] != NULL; i++) {

Since my implementation use "getaddrinfo", h_addr_list[i] will be invalid
when "--with-ipv6" is set.

Thanks.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Make Nginx Parse URL to IPv6

speedfirst 1589 March 02, 2011 03:58AM

Re: [PATCH] Make Nginx Parse URL to IPv6

Maxim Dounin 534 March 03, 2011 06:06AM

Re: [PATCH] Make Nginx Parse URL to IPv6

speedfirst 835 March 03, 2011 07:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 89
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