libmicrohttpd

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

commit 69cacd7e02d39553bc8b0c0fd4a74352aa010911
parent 5209abc6767c484ac1d24a740149b4d41c2bbd08
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 19 Jun 2014 15:35:25 +0000

-fix lack of adding listen FD to epoll set for external select before first call to MHD_run (see mailinglist)

Diffstat:
MChangeLog | 6++++++
Msrc/include/microhttpd.h | 2+-
Msrc/microhttpd/daemon.c | 55++++++++++++++++++++++++++++---------------------------
3 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jun 19 17:32:32 CEST 2014 + Ensure that listen FD is bound to epoll FD even before + MHD_run() is called if running with MHD_USE_EPOLL_LINUX_ONLY + in combination with 'external select' mode. Thanks to + Marcos Pindado Sebastian for reporting. -CG + Sun Jun 8 15:10:44 CEST 2014 Add 'MHD_set_response_options' as a way to set per-response flags. Add flag to force HTTP 1.0-only conservative diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -130,7 +130,7 @@ typedef intptr_t ssize_t; * Current version of the library. * 0x01093001 = 1.9.30-1. */ -#define MHD_VERSION 0x00093701 +#define MHD_VERSION 0x00093702 /** * MHD-internal return code for "YES". diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -3521,37 +3521,11 @@ MHD_start_daemon_va (unsigned int flags, goto free_and_fail; } #endif -#if EPOLL_SUPPORT - if ( (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) && - (0 == daemon->worker_pool_size) && - (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) ) - { - if (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL_LINUX_ONLY is not supported.\n"); -#endif - goto free_and_fail; - } - if (MHD_YES != setup_epoll_to_listen (daemon)) - goto free_and_fail; - } -#else - if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "epoll is not supported on this platform by this build.\n"); -#endif - goto free_and_fail; - } -#endif if ( (MHD_INVALID_SOCKET == daemon->socket_fd) && (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) ) { /* try to open listen socket */ - if ((flags & MHD_USE_IPv6) != 0) + if (0 != (flags & MHD_USE_IPv6)) socket_fd = create_socket (daemon, PF_INET6, SOCK_STREAM, 0); else @@ -3724,6 +3698,33 @@ MHD_start_daemon_va (unsigned int flags, } #endif +#if EPOLL_SUPPORT + if ( (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) && + (0 == daemon->worker_pool_size) && + (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) ) + { + if (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) + { +#if HAVE_MESSAGES + MHD_DLOG (daemon, + "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL_LINUX_ONLY is not supported.\n"); +#endif + goto free_and_fail; + } + if (MHD_YES != setup_epoll_to_listen (daemon)) + goto free_and_fail; + } +#else + if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) + { +#if HAVE_MESSAGES + MHD_DLOG (daemon, + "epoll is not supported on this platform by this build.\n"); +#endif + goto free_and_fail; + } +#endif + if (MHD_YES != MHD_mutex_create_ (&daemon->per_ip_connection_mutex)) { #if HAVE_MESSAGES