Welcome! Log In Create A New Profile

Advanced

[PATCH] Make Nginx Parse URL to IPv6 [Please ignore the last mail]

March 02, 2011 05:58AM
sorry, the diff file in the last file is bad, use this one.

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 [Please ignore the last mail]

speedfirst 3141 March 02, 2011 05:58AM

Re: [PATCH] Make Nginx Parse URL to IPv6 [Please ignore the last mail]

speedfirst 1018 March 03, 2011 07:38AM

Re: [PATCH] Make Nginx Parse URL to IPv6 [Please ignore the last mail]

speedfirst 1231 March 04, 2011 01:02AM



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

Online Users

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