libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit ced72bc239834da12bbd5faaf5812967b7c1fcfa
parent c9320b2dbf64b81848bf40822681480657f1fafc
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 19 Jan 2012 21:17:29 +0000

hopefully fixing #1967

Diffstat:
MChangeLog | 12++++++++++--
Msrc/daemon/daemon.c | 14+++++++++++---
2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,13 @@ -Thu Jan 19 17:46:05 CET 2012 - Fixing use of uninitialized 'earliest_deadline' variable in +Thu Jan 19 22:11:12 CET 2012 + Switch to non-blocking sockets for all systems but Cygwin + (we already used non-blocking sockets for GNU/Linux); also + use non-blocking sockets on Cygwin for HTTPS as this is + required to avoid DoS-by-partial-record via gnutls. On + Cygwin, #1824 implies that we need to use blocking sockets + for HTTP on Cygwin for now. -CG + +Thu Jan 19 17:46:05 CET 2012 + Fixing use of uninitialized 'earliest_deadline' variable in MHD_get_timeout which can lead to returning an incorrect (too early) timeout (#2085). -tclaveirole diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c @@ -944,9 +944,18 @@ MHD_add_connection (struct MHD_Daemon *daemon, MHD_set_http_callbacks_ (connection); connection->recv_cls = &recv_param_adapter; connection->send_cls = &send_param_adapter; -#if LINUX + /* non-blocking sockets are required on most systems and for GNUtls; + however, they somehow cause serious problems on CYGWIN (#1824) */ +#ifdef CYGWIN + if +#if HTTPS_SUPPORT + (0 != (daemon->options & MHD_USE_SSL)) +#else + (0) +#endif +#endif { - /* non-blocking sockets perform better on Linux */ + /* make socket non-blocking */ int flags = fcntl (connection->socket_fd, F_GETFL); if ( (flags == -1) || (0 != fcntl (connection->socket_fd, F_SETFL, flags | O_NONBLOCK)) ) @@ -957,7 +966,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, #endif } } -#endif #if HTTPS_SUPPORT if (0 != (daemon->options & MHD_USE_SSL))