IPv6 for Win32
diff --git a/auto/os/win32 b/auto/os/win32
index c4bcc6a..02b261c 100644
--- a/auto/os/win32
+++ b/auto/os/win32
@@ -20,5 +20,9 @@
     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
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index a5b137d..3debac3 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -649,8 +649,22 @@
 
     (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) {