hopefully fixing #1967

This commit is contained in:
Christian Grothoff
2012-01-19 21:17:29 +00:00
parent c9320b2dbf
commit ced72bc239
2 changed files with 21 additions and 5 deletions
+10 -2
View File
@@ -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
+11 -3
View File
@@ -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))