diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-01-22 08:47:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-01-22 08:47:48 +0000 |
commit | dd902f337ba25c4d0093e4a89bc4edf1fb897611 (patch) | |
tree | 177704a0f512081d333a6df140b828303a7bbc85 | |
parent | 5534659f202f3ba5fe5b9155fc742e63518aefc9 (diff) | |
download | libmicrohttpd-dd902f337ba25c4d0093e4a89bc4edf1fb897611.tar.gz libmicrohttpd-dd902f337ba25c4d0093e4a89bc4edf1fb897611.zip |
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))) &&
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 8 |
3 files changed, 14 insertions, 5 deletions
@@ -22,7 +22,7 @@ Matthew Moore | |||
22 | Colin Caughie <c.caughie@indigovision.com> | 22 | Colin Caughie <c.caughie@indigovision.com> |
23 | David Carvalho <andaris@gmail.com> | 23 | David Carvalho <andaris@gmail.com> |
24 | David Reiss <dreiss@facebook.com> | 24 | David Reiss <dreiss@facebook.com> |
25 | Matt Holiday | 25 | Matt Holiday |
26 | Michael Cronenworth <mike@cchtml.com> | 26 | Michael Cronenworth <mike@cchtml.com> |
27 | Mika Raento <mikie@iki.fi> | 27 | Mika Raento <mikie@iki.fi> |
28 | Mike Crowe <mac@mcrowe.com> | 28 | Mike Crowe <mac@mcrowe.com> |
@@ -45,6 +45,7 @@ Jan Janak <jan@janakj.org> | |||
45 | Matthew Mundell <matthew.mundell@greenbone.net> | 45 | Matthew Mundell <matthew.mundell@greenbone.net> |
46 | Scott Goldman <scottjg@github.com> | 46 | Scott Goldman <scottjg@github.com> |
47 | Jared Cantwell | 47 | Jared Cantwell |
48 | Luke-Jr <luke@dashjr.org> | ||
48 | 49 | ||
49 | Documentation contributions also came from: | 50 | Documentation contributions also came from: |
50 | Marco Maggi <marco.maggi-ipsu@poste.it> | 51 | Marco Maggi <marco.maggi-ipsu@poste.it> |
@@ -1,3 +1,11 @@ | |||
1 | Wed Jan 22 09:44:33 CET 2014 | ||
2 | MHD_USE_DUAL_STACK in libmicrohttpd currently just *inhibits | ||
3 | setting* the IPV6_V6ONLY socket option, but per Microsoft's | ||
4 | documentation the default on Windows is that this is enabled, thus | ||
5 | MHD_USE_DUAL_STACK will not work (since it leaves the | ||
6 | default). libmicrohttpd should probably just unconditionally set | ||
7 | IPV6_V6ONLY to the desired value when the option is available. -LJ | ||
8 | |||
1 | Wed Jan 1 21:38:18 CET 2014 | 9 | Wed Jan 1 21:38:18 CET 2014 |
2 | Allow Keep-Alive with HTTP 1.0 (if explicitly requested), | 10 | Allow Keep-Alive with HTTP 1.0 (if explicitly requested), |
3 | and automatically set "Connection: Keep-Alive" in response | 11 | and automatically set "Connection: Keep-Alive" in response |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 0a33b773..fb7eb145 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -3493,8 +3493,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
3493 | } | 3493 | } |
3494 | daemon->socket_fd = socket_fd; | 3494 | daemon->socket_fd = socket_fd; |
3495 | 3495 | ||
3496 | if ( (0 != (flags & MHD_USE_IPv6)) && | 3496 | if (0 != (flags & MHD_USE_IPv6)) |
3497 | (MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK)) ) | ||
3498 | { | 3497 | { |
3499 | #ifdef IPPROTO_IPV6 | 3498 | #ifdef IPPROTO_IPV6 |
3500 | #ifdef IPV6_V6ONLY | 3499 | #ifdef IPV6_V6ONLY |
@@ -3503,10 +3502,11 @@ MHD_start_daemon_va (unsigned int flags, | |||
3503 | and may also be missing on older POSIX systems; good luck if you have any of those, | 3502 | and may also be missing on older POSIX systems; good luck if you have any of those, |
3504 | your IPv6 socket may then also bind against IPv4 anyway... */ | 3503 | your IPv6 socket may then also bind against IPv4 anyway... */ |
3505 | #ifndef WINDOWS | 3504 | #ifndef WINDOWS |
3506 | const int on = 1; | 3505 | const int |
3507 | #else | 3506 | #else |
3508 | const char on = 1; | 3507 | const char |
3509 | #endif | 3508 | #endif |
3509 | on = (MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK)); | ||
3510 | if ( (0 > SETSOCKOPT (socket_fd, | 3510 | if ( (0 > SETSOCKOPT (socket_fd, |
3511 | IPPROTO_IPV6, IPV6_V6ONLY, | 3511 | IPPROTO_IPV6, IPV6_V6ONLY, |
3512 | &on, sizeof (on))) && | 3512 | &on, sizeof (on))) && |