]> git.kaiwu.me - nginx.git/commitdiff
Fixed URL parsing code.
authorRuslan Ermilov <ru@nginx.com>
Mon, 17 Dec 2012 09:44:46 +0000 (09:44 +0000)
committerRuslan Ermilov <ru@nginx.com>
Mon, 17 Dec 2012 09:44:46 +0000 (09:44 +0000)
The URL parsing code is not expected to initialize port from default port
when in "no_resolve" mode.  This got broken in r4671 for the case of IPv6
literals.

src/core/ngx_inet.c

index ea27fada82b7f7e1d70826f9e1c27b368821efa1..1fd1691ab44b94d3ec5a8c6dc6199d187aab9bc1 100644 (file)
@@ -828,6 +828,11 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
 
         } else {
             u->no_port = 1;
+
+            if (!u->no_resolve) {
+                u->port = u->default_port;
+                sin6->sin6_port = htons(u->default_port);
+            }
         }
     }
 
@@ -850,11 +855,6 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
         u->wildcard = 1;
     }
 
-    if (u->no_port) {
-        u->port = u->default_port;
-        sin6->sin6_port = htons(u->default_port);
-    }
-
     u->family = AF_INET6;
     u->naddrs = 1;