Sfoglia il codice sorgente

Luke-Jr wrote:

MHD_USE_DUAL_STACK in libmicrohttpd currently just *inhibits setting* the 
IPV6_V6ONLY socket option, but per Microsoft's documentation 
http://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx
the default on Windows is that this is enabled, thus MHD_USE_DUAL_STACK will 
not work (since it leaves the default). libmicrohttpd should probably just 
unconditionally set IPV6_V6ONLY to the desired value when the option is 
available.

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 0a33b77..3cbf28e 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3493,8 +3493,7 @@ MHD_start_daemon_va (unsigned int flags,
 	}
       daemon->socket_fd = socket_fd;
 
-      if ( (0 != (flags & MHD_USE_IPv6)) &&
-	   (MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK)) )
+      if (0 != (flags & MHD_USE_IPv6))
 	{
 #ifdef IPPROTO_IPV6
 #ifdef IPV6_V6ONLY
@@ -3503,10 +3502,11 @@ MHD_start_daemon_va (unsigned int flags,
 	     and may also be missing on older POSIX systems; good luck if you have 
any of those,
 	     your IPv6 socket may then also bind against IPv4 anyway... */
 #ifndef WINDOWS
-	  const int on = 1;
+	  const int
 #else
-	  const char on = 1;
+	  const char
 #endif
+		 on = (MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK));
 	  if ( (0 > SETSOCKOPT (socket_fd,
 				IPPROTO_IPV6, IPV6_V6ONLY,
 				&on, sizeof (on))) &&
Christian Grothoff 12 anni fa
parent
commit
dd902f337b
3 ha cambiato i file con 14 aggiunte e 5 eliminazioni
  1. 2 1
      AUTHORS
  2. 8 0
      ChangeLog
  3. 4 4
      src/microhttpd/daemon.c

+ 2 - 1
AUTHORS

@@ -22,7 +22,7 @@ Matthew Moore
 Colin Caughie <[email protected]>
 David Carvalho <[email protected]>
 David Reiss <[email protected]>
-Matt Holiday 
+Matt Holiday
 Michael Cronenworth <[email protected]>
 Mika Raento <[email protected]>
 Mike Crowe <[email protected]>
@@ -45,6 +45,7 @@ Jan Janak <[email protected]>
 Matthew Mundell <[email protected]>
 Scott Goldman <[email protected]>
 Jared Cantwell
+Luke-Jr <[email protected]>
 
 Documentation contributions also came from:
 Marco Maggi <[email protected]>

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+Wed Jan 22 09:44:33 CET 2014
+	MHD_USE_DUAL_STACK in libmicrohttpd currently just *inhibits
+	setting* the IPV6_V6ONLY socket option, but per Microsoft's
+	documentation the default on Windows is that this is enabled, thus
+	MHD_USE_DUAL_STACK will not work (since it leaves the
+	default). libmicrohttpd should probably just unconditionally set
+	IPV6_V6ONLY to the desired value when the option is available. -LJ
+
 Wed Jan  1 21:38:18 CET 2014
 	Allow Keep-Alive with HTTP 1.0 (if explicitly requested),
 	and automatically set "Connection: Keep-Alive" in response

+ 4 - 4
src/microhttpd/daemon.c

@@ -3493,8 +3493,7 @@ MHD_start_daemon_va (unsigned int flags,
 	}
       daemon->socket_fd = socket_fd;
 
-      if ( (0 != (flags & MHD_USE_IPv6)) &&
-	   (MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK)) )
+      if (0 != (flags & MHD_USE_IPv6))
 	{
 #ifdef IPPROTO_IPV6
 #ifdef IPV6_V6ONLY
@@ -3503,10 +3502,11 @@ MHD_start_daemon_va (unsigned int flags,
 	     and may also be missing on older POSIX systems; good luck if you have any of those,
 	     your IPv6 socket may then also bind against IPv4 anyway... */
 #ifndef WINDOWS
-	  const int on = 1;
+	  const int
 #else
-	  const char on = 1;
+	  const char
 #endif
+            on = (MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK));
 	  if ( (0 > SETSOCKOPT (socket_fd,
 				IPPROTO_IPV6, IPV6_V6ONLY,
 				&on, sizeof (on))) &&