]> git.kaiwu.me - nginx.git/commitdiff
IPv6 for Win32
authorIgor Sysoev <igor@sysoev.ru>
Thu, 7 May 2009 13:05:04 +0000 (13:05 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 7 May 2009 13:05:04 +0000 (13:05 +0000)
auto/os/win32
src/core/ngx_inet.c

index c4bcc6ab24ec9660cdcd784c632f44bd7d3dc09c..02b261cea5f671832f0cf9b676a2321afe3ace0c 100644 (file)
@@ -20,5 +20,9 @@ if [ $EVENT_SELECT = NO ]; then
     EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE"
 fi
 
+if [ $NGX_IPV6 = YES ]; then
+    have=NGX_HAVE_INET6 . auto/have
+fi
+
 have=NGX_HAVE_AIO . auto/have
 have=NGX_HAVE_IOCP . auto/have
index a5b137d94b92ed03c6d643a460fed9f10c2ceb10..3debac37e027b839b7d0e3b2b535114a7abe231a 100644 (file)
@@ -649,8 +649,22 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
 
     (void) ngx_cpystrn(p, host, len);
 
+#if (NGX_WIN32)
+
+    rc = WSAStringToAddress((char *) p, AF_INET6, NULL,
+                            (SOCKADDR *) sin6, &u->socklen);
+    rc = !rc;
+
+    if (u->port) {
+        sin6->sin6_port = htons(u->port);
+    }
+
+#else
+
     rc = inet_pton(AF_INET6, (const char *) p, &sin6->sin6_addr);
 
+#endif
+
     ngx_free(p);
 
     if (rc == 0) {