libmicrohttpd

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

commit b8e9408180f5adf70fb759350c073954084186b7
parent bf7418b3d9288e9e0175651a9e3cf3297e197942
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 25 Mar 2017 20:44:27 +0100

do not fail if MHD_OPTION_THREAD_POOL_SIZE is specified as 0 or 1 in combination with internal polling, that's OK (as a pool size of 0/1 means no pool)

Diffstat:
Msrc/microhttpd/daemon.c | 39+++++++++++++++++++++------------------
Msrc/microhttpd/test_upgrade.c | 16++++++++--------
2 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -4822,24 +4822,6 @@ parse_options_va (struct MHD_Daemon *daemon, void *); break; case MHD_OPTION_THREAD_POOL_SIZE: - if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) - { -#ifdef HAVE_MESSAGES - MHD_DLOG (daemon, - _("MHD_OPTION_THREAD_POOL_SIZE option is specified but " - "MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n")); -#endif - return MHD_NO; - } - if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) - { -#ifdef HAVE_MESSAGES - MHD_DLOG (daemon, - _("Both MHD_OPTION_THREAD_POOL_SIZE option and " - "MHD_USE_THREAD_PER_CONNECTION flag are specified.\n")); -#endif - return MHD_NO; - } daemon->worker_pool_size = va_arg (ap, unsigned int); if (0 == daemon->worker_pool_size) @@ -4868,6 +4850,27 @@ parse_options_va (struct MHD_Daemon *daemon, #endif return MHD_NO; } + else + { + if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_OPTION_THREAD_POOL_SIZE option is specified but " + "MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n")); +#endif + return MHD_NO; + } + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Both MHD_OPTION_THREAD_POOL_SIZE option and " + "MHD_USE_THREAD_PER_CONNECTION flag are specified.\n")); +#endif + return MHD_NO; + } + } break; #ifdef HTTPS_SUPPORT case MHD_OPTION_HTTPS_MEM_KEY: diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c @@ -990,14 +990,14 @@ test_upgrade (int flags, if (!test_tls) d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE, - 1080, - NULL, NULL, - &ahc_upgrade, NULL, - MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, - MHD_OPTION_NOTIFY_COMPLETED, &notify_completed_cb, NULL, - MHD_OPTION_NOTIFY_CONNECTION, &notify_connection_cb, NULL, - MHD_OPTION_THREAD_POOL_SIZE, pool, - MHD_OPTION_END); + 1080, + NULL, NULL, + &ahc_upgrade, NULL, + MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &notify_completed_cb, NULL, + MHD_OPTION_NOTIFY_CONNECTION, &notify_connection_cb, NULL, + MHD_OPTION_THREAD_POOL_SIZE, pool, + MHD_OPTION_END); #ifdef HTTPS_SUPPORT else d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE | MHD_USE_TLS,