changeset 2814:219aa0b0fd58

IPv6 for Win32
author Igor Sysoev <igor@sysoev.ru>
date Thu, 07 May 2009 13:05:04 +0000
parents c00763aa5e1b
children 304bfc6faf07
files auto/os/win32 src/core/ngx_inet.c
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/auto/os/win32
+++ b/auto/os/win32
@@ -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
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -649,8 +649,22 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ng
 
     (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) {