[nginx] svn commit: r4723 - in branches/stable-1.2: . src/core
mdounin at mdounin.ru
mdounin at mdounin.ru
Mon Jul 2 16:16:27 UTC 2012
Author: mdounin
Date: 2012-07-02 16:16:27 +0000 (Mon, 02 Jul 2012)
New Revision: 4723
URL: http://trac.nginx.org/nginx/changeset/4723/nginx
Log:
Merge of r4671: support for IPv6 literals in proxy_pass and so on.
Modified:
branches/stable-1.2/
branches/stable-1.2/src/core/ngx_inet.c
Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2 2012-07-02 16:11:02 UTC (rev 4722)
+++ branches/stable-1.2 2012-07-02 16:16:27 UTC (rev 4723)
Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4653,4674-4676
+/trunk:4611-4632,4636-4653,4671,4674-4676
\ No newline at end of property
Modified: branches/stable-1.2/src/core/ngx_inet.c
===================================================================
--- branches/stable-1.2/src/core/ngx_inet.c 2012-07-02 16:11:02 UTC (rev 4722)
+++ branches/stable-1.2/src/core/ngx_inet.c 2012-07-02 16:16:27 UTC (rev 4723)
@@ -808,6 +808,8 @@
u->uri.len = last - uri;
u->uri.data = uri;
+
+ last = uri;
}
if (*port == ':') {
@@ -840,8 +842,8 @@
return NGX_ERROR;
}
- u->host.len = len;
- u->host.data = host;
+ u->host.len = len + 2;
+ u->host.data = host - 1;
if (ngx_inet6_addr(host, len, sin6->sin6_addr.s6_addr) != NGX_OK) {
u->err = "invalid IPv6 address";
@@ -852,17 +854,38 @@
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;
- if (u->no_resolve) {
- return NGX_OK;
+ u->addrs = ngx_pcalloc(pool, sizeof(ngx_addr_t));
+ if (u->addrs == NULL) {
+ return NGX_ERROR;
}
- if (u->no_port) {
- u->port = u->default_port;
- sin6->sin6_port = htons(u->default_port);
+ sin6 = ngx_pcalloc(pool, sizeof(struct sockaddr_in6));
+ if (sin6 == NULL) {
+ return NGX_ERROR;
}
+ ngx_memcpy(sin6, u->sockaddr, sizeof(struct sockaddr_in6));
+
+ u->addrs[0].sockaddr = (struct sockaddr *) sin6;
+ u->addrs[0].socklen = sizeof(struct sockaddr_in6);
+
+ p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1);
+ if (p == NULL) {
+ return NGX_ERROR;
+ }
+
+ u->addrs[0].name.len = ngx_sprintf(p, "%V:%d",
+ &u->host, u->port) - p;
+ u->addrs[0].name.data = p;
+
return NGX_OK;
#else
More information about the nginx-devel
mailing list