libmicrohttpd

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

commit c39f9bfb2696e0b7c04c6f4b90ea0ab8b646e064
parent fdf24fa69fb92db404db45f37563729947c9e380
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Tue,  8 Nov 2016 00:37:29 +0300

Specify that flag MHD_USE_INTERNAL_POLLING_THREAD is mandatory if MHD_USE_THREAD_PER_CONNECTION is used

Diffstat:
Mdoc/libmicrohttpd.texi | 22+++++++++++-----------
Msrc/include/microhttpd.h | 28+++++++++++++++++-----------
Msrc/microhttpd/daemon.c | 25+++++++++++++++++--------
Msrc/microhttpd/test_upgrade.c | 7+++----
Msrc/testcurl/https/test_https_get.c | 4++--
Msrc/testcurl/https/test_https_get_parallel_threads.c | 4++--
Msrc/testcurl/https/test_https_multi_daemon.c | 4++--
Msrc/testcurl/https/test_https_session_info.c | 2+-
Msrc/testcurl/https/test_https_sni.c | 2+-
Msrc/testcurl/https/test_https_time_out.c | 2+-
Msrc/testcurl/https/test_tls_authentication.c | 2+-
Msrc/testcurl/https/test_tls_extensions.c | 2+-
Msrc/testcurl/https/test_tls_options.c | 2+-
Msrc/testcurl/perf_get.c | 2+-
Msrc/testcurl/perf_get_concurrent.c | 2+-
Msrc/testcurl/test_concurrent_stop.c | 2+-
Msrc/testcurl/test_delete.c | 2+-
Msrc/testcurl/test_get.c | 4++--
Msrc/testcurl/test_get_chunked.c | 2+-
Msrc/testcurl/test_get_response_cleanup.c | 2+-
Msrc/testcurl/test_get_sendfile.c | 2+-
Msrc/testcurl/test_large_put.c | 2+-
Msrc/testcurl/test_post.c | 4++--
Msrc/testcurl/test_post_loop.c | 2+-
Msrc/testcurl/test_postform.c | 2+-
Msrc/testcurl/test_process_headers.c | 2+-
Msrc/testcurl/test_put.c | 2+-
Msrc/testcurl/test_put_chunked.c | 2+-
Msrc/testcurl/test_quiesce.c | 4++--
Msrc/testcurl/test_start_stop.c | 2+-
Msrc/testcurl/test_termination.c | 2+-
Msrc/testzzuf/test_get.c | 2+-
Msrc/testzzuf/test_get_chunked.c | 2+-
Msrc/testzzuf/test_post.c | 2+-
Msrc/testzzuf/test_post_form.c | 2+-
Msrc/testzzuf/test_put.c | 2+-
Msrc/testzzuf/test_put_chunked.c | 2+-
Msrc/testzzuf/test_put_large.c | 2+-
38 files changed, 88 insertions(+), 74 deletions(-)

diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi @@ -435,9 +435,10 @@ compiler). @deftp {Enumeration} MHD_FLAG Options for the MHD daemon. -Note that if neither @code{MHD_USE_THREAD_PER_CONNECTION} nor -@code{MHD_USE_INTERNAL_POLLING_THREAD} is used, the client wants control over -the process and will call the appropriate microhttpd callbacks. +Note that MHD will run automatically in background thread(s) only +if @code{MHD_USE_INTERNAL_POLLING_THREAD} is used. Otherwise caller +(application) must use @code{MHD_run} or @code{MHD_run_from_select} +to have MHD processed network connections and data. Starting the daemon may also fail if a particular option is not implemented or not supported on the target platform (i.e. no support for @@ -502,10 +503,9 @@ production. @cindex select Use @code{poll()} instead of @code{select()}. This allows sockets with descriptors @code{>= FD_SETSIZE}. This option currently only works in -conjunction with @code{MHD_USE_THREAD_PER_CONNECTION} or -@code{MHD_USE_INTERNAL_POLLING_THREAD} (at this point). If you specify -@code{MHD_USE_POLL} and the local platform does not support it, -@code{MHD_start_daemon} will return NULL. +conjunction with @code{MHD_USE_INTERNAL_POLLING_THREAD} (at this point). +If you specify @code{MHD_USE_POLL} and the local platform does not +support it, @code{MHD_start_daemon} will return NULL. @item MHD_USE_EPOLL @cindex FD_SETSIZE @@ -566,10 +566,10 @@ with using a thread pool; if it is used, @cindex quiesce Force MHD to use a signal inter-thread communication channel to notify the event loop (of threads) of our shutdown and other events. -This is required if an appliction uses -@code{MHD_USE_INTERNAL_POLLING_THREAD} or @code{MHD_USE_THREAD_PER_CONNECTION} -and then performs @code{MHD_quiesce_daemon} (which eliminates our -ability to signal termination via the listen socket). In these modes, +This is required if an application uses +@code{MHD_USE_INTERNAL_POLLING_THREAD} and then performs +@code{MHD_quiesce_daemon} (which eliminates our ability to signal +termination via the listen socket). In these modes, @code{MHD_quiesce_daemon} will fail if this option was not set. Also, use of this option is automatic (as in, you do not even have to specify it), if @code{MHD_USE_NO_LISTEN_SOCKET} is specified. In diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -516,9 +516,10 @@ struct MHD_PostProcessor; /** * @brief Flags for the `struct MHD_Daemon`. * - * Note that if neither #MHD_USE_THREAD_PER_CONNECTION nor - * #MHD_USE_INTERNAL_POLLING_THREAD is used, the client wants control over - * the process and will call the appropriate microhttpd callbacks. + * Note that MHD will run automatically in background thread(s) only + * if #MHD_USE_INTERNAL_POLLING_THREAD is used. Otherwise caller (application) + * must use #MHD_run() or #MHD_run_from_select() to have MHD processed + * network connections and data. * * Starting the daemon may also fail if a particular option is not * implemented or not supported on the target platform (i.e. no @@ -553,12 +554,18 @@ enum MHD_FLAG /** * Run using one thread per connection. + * Must be used only with #MHD_USE_INTERNAL_POLLING_THREAD. */ MHD_USE_THREAD_PER_CONNECTION = 4, /** * Run using an internal thread (or thread pool) for sockets sending - * and receiving and data processing. + * and receiving and data processing. Without this flag MHD will not + * run automatically in background thread(s). + * If this flag is set, #MHD_run() and #MHD_run_from_select() couldn't + * be used. + * This flag is set explicitly by #MHD_USE_POLL_INTERNAL_THREAD and + * by #MHD_USE_EPOLL_INTERNAL_THREAD. */ MHD_USE_INTERNAL_POLLING_THREAD = 8, @@ -666,9 +673,8 @@ enum MHD_FLAG /** * Use inter-thread communication channel. - * #MHD_USE_ITC can be used with internal select/poll/other - * or #MHD_USE_THREAD_PER_CONNECTION and is ignored with any - * "external" mode. + * #MHD_USE_ITC can be used with #MHD_USE_INTERNAL_POLLING_THREAD + * and is ignored with any "external" mode. * It's required for use of #MHD_quiesce_daemon * or #MHD_add_connection. * This option is enforced by #MHD_ALLOW_SUSPEND_RESUME or @@ -1832,10 +1838,10 @@ MHD_get_timeout (struct MHD_Daemon *daemon, * This function is a convenience method, which is useful if the * fd_sets from #MHD_get_fdset were not directly passed to `select()`; * with this function, MHD will internally do the appropriate `select()` - * call itself again. While it is always safe to call #MHD_run (in - * external select mode), you should call #MHD_run_from_select if - * performance is important (as it saves an expensive call to - * `select()`). + * call itself again. While it is always safe to call #MHD_run (if + * ::MHD_USE_INTERNAL_POLLING_THREAD is not set), you should call + * #MHD_run_from_select if performance is important (as it saves an + * expensive call to `select()`). * * @param daemon daemon to run * @return #MHD_YES on success, #MHD_NO if this diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -3903,7 +3903,6 @@ int MHD_run (struct MHD_Daemon *daemon) { if ( (MHD_YES == daemon->shutdown) || - (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) ) return MHD_NO; if (0 != (daemon->options & MHD_USE_POLL)) @@ -4089,7 +4088,7 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon) if (MHD_INVALID_SOCKET == ret) return MHD_INVALID_SOCKET; if ( (MHD_ITC_IS_INVALID_(daemon->itc)) && - (0 != (daemon->options & (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION))) ) + (0 != (daemon->options & (MHD_USE_INTERNAL_POLLING_THREAD))) ) { #ifdef HAVE_MESSAGES MHD_DLOG (daemon, @@ -4781,12 +4780,24 @@ MHD_start_daemon_va (unsigned int flags, daemon->custom_error_log = (MHD_LogCallback) &vfprintf; daemon->custom_error_log_cls = stderr; #endif + if ( (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) && + (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with " + "MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD " + "was added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.\n")); +#endif + flags |= MHD_USE_INTERNAL_POLLING_THREAD; + daemon->options |= MHD_USE_INTERNAL_POLLING_THREAD; + } #ifdef HAVE_LISTEN_SHUTDOWN use_itc = (0 != (daemon->options & (MHD_USE_NO_LISTEN_SOCKET | MHD_USE_ITC))); #else use_itc = 1; /* yes, must use ITC to signal thread */ #endif - if (0 == (flags & (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION))) + if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD)) use_itc = 0; /* useless if we are using 'external' select */ if (use_itc) { @@ -5233,9 +5244,8 @@ MHD_start_daemon_va (unsigned int flags, goto free_and_fail; } #endif /* HTTPS_SUPPORT */ - if ( ( (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) || - ( (0 != (flags & MHD_USE_INTERNAL_POLLING_THREAD)) && - (0 == daemon->worker_pool_size)) ) && + if ( ( (0 != (flags & MHD_USE_INTERNAL_POLLING_THREAD)) && + (0 == daemon->worker_pool_size) ) && (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) && (! MHD_create_named_thread_ (&daemon->pid, (flags & MHD_USE_THREAD_PER_CONNECTION) ? @@ -5619,8 +5629,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) fd = daemon->socket_fd; daemon->socket_fd = MHD_INVALID_SOCKET; - if ( (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || - (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) + if (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) { /* Separate thread(s) is used for select()/poll()/etc. */ if (NULL != daemon->worker_pool) diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c @@ -1064,8 +1064,7 @@ test_upgrade (int flags, &run_usock_client, &sock)) abort (); - if (0 == (flags & (MHD_USE_INTERNAL_POLLING_THREAD | - MHD_USE_THREAD_PER_CONNECTION)) ) + if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) ) run_mhd_loop (d, flags); pthread_join (pt_client, NULL); @@ -1158,7 +1157,7 @@ main (int argc, #endif /* Test thread-per-connection */ - res = test_upgrade (MHD_USE_THREAD_PER_CONNECTION, + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION, 0); error_count += res; if (res) @@ -1166,7 +1165,7 @@ main (int argc, else if (verbose) printf ("PASSED: Upgrade with thread per connection.\n"); #ifdef HAVE_POLL - res = test_upgrade (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL, + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL, 0); error_count += res; if (res) diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c @@ -46,7 +46,7 @@ test_cipher_option (FILE * test_fd, int ret; struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG, 4233, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, @@ -75,7 +75,7 @@ test_secure_get (FILE * test_fd, int ret; struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG, 4233, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, diff --git a/src/testcurl/https/test_https_get_parallel_threads.c b/src/testcurl/https/test_https_get_parallel_threads.c @@ -170,7 +170,7 @@ main (int argc, char *const *argv) errorCount += test_wrap ("multi threaded daemon, single client", &test_single_client, NULL, - MHD_USE_TLS | MHD_USE_DEBUG | MHD_USE_THREAD_PER_CONNECTION, + MHD_USE_TLS | MHD_USE_DEBUG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); @@ -178,7 +178,7 @@ main (int argc, char *const *argv) errorCount += test_wrap ("multi threaded daemon, parallel client", &test_parallel_clients, NULL, - MHD_USE_TLS | MHD_USE_DEBUG | MHD_USE_THREAD_PER_CONNECTION, + MHD_USE_TLS | MHD_USE_DEBUG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); diff --git a/src/testcurl/https/test_https_multi_daemon.c b/src/testcurl/https/test_https_multi_daemon.c @@ -50,7 +50,7 @@ test_concurent_daemon_pair (void *cls, struct MHD_Daemon *d1; struct MHD_Daemon *d2; - d1 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | + d1 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG, DEAMON_TEST_PORT, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, @@ -63,7 +63,7 @@ test_concurent_daemon_pair (void *cls, return -1; } - d2 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | + d2 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG, DEAMON_TEST_PORT + 1, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, diff --git a/src/testcurl/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c @@ -107,7 +107,7 @@ test_query_session () gen_test_file_url (url, DEAMON_TEST_PORT); /* setup test */ - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG, DEAMON_TEST_PORT, NULL, NULL, &query_session_ahc, NULL, MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:+ARCFOUR-128", diff --git a/src/testcurl/https/test_https_sni.c b/src/testcurl/https/test_https_sni.c @@ -260,7 +260,7 @@ main (int argc, char *const *argv) } load_keys ("host1", ABS_SRCDIR "/host1.crt", ABS_SRCDIR "/host1.key"); load_keys ("host2", ABS_SRCDIR "/host2.crt", ABS_SRCDIR "/host2.key"); - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG, 4233, NULL, NULL, &http_ahc, NULL, diff --git a/src/testcurl/https/test_https_time_out.c b/src/testcurl/https/test_https_time_out.c @@ -116,7 +116,7 @@ main (int argc, char *const *argv) gnutls_global_init (); gnutls_global_set_log_level (11); - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG, DEAMON_TEST_PORT, NULL, NULL, &http_dummy_ahc, NULL, MHD_OPTION_CONNECTION_TIMEOUT, TIME_OUT, diff --git a/src/testcurl/https/test_tls_authentication.c b/src/testcurl/https/test_tls_authentication.c @@ -49,7 +49,7 @@ test_secure_get (void * cls, char *cipher_suite, int proto_version) int ret; struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG, DEAMON_TEST_PORT, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, diff --git a/src/testcurl/https/test_tls_extensions.c b/src/testcurl/https/test_tls_extensions.c @@ -231,7 +231,7 @@ main (int argc, char *const *argv) return -1; } - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG, DEAMON_TEST_PORT, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, diff --git a/src/testcurl/https/test_tls_options.c b/src/testcurl/https/test_tls_options.c @@ -83,7 +83,7 @@ main (int argc, char *const *argv) unsigned int errorCount = 0; const char *ssl_version; int daemon_flags = - MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS | MHD_USE_DEBUG; + MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_DEBUG; gcry_control (GCRYCTL_DISABLE_SECMEM, 0); gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c @@ -252,7 +252,7 @@ testMultithreadedGet (int port, int poll_flag) cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG | poll_flag, port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c @@ -262,7 +262,7 @@ testMultithreadedGet (int port, int poll_flag) const char * const test_desc = poll_flag ? "thread with poll" : "thread with select"; const char * ret_val; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG | poll_flag, port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; diff --git a/src/testcurl/test_concurrent_stop.c b/src/testcurl/test_concurrent_stop.c @@ -210,7 +210,7 @@ testMultithreadedGet (int port, struct MHD_Daemon *d; pthread_t p; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG | poll_flag, port, NULL, NULL, &ahc_echo, "GET", diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c @@ -189,7 +189,7 @@ testMultithreadedDelete () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c @@ -170,7 +170,7 @@ testMultithreadedGet (int poll_flag) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG | poll_flag, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; @@ -473,7 +473,7 @@ testStopRace (int poll_flag) MHD_socket fd; struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG | poll_flag, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_CONNECTION_TIMEOUT, 5, MHD_OPTION_END); if (d == NULL) diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c @@ -206,7 +206,7 @@ testMultithreadedGet () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; diff --git a/src/testcurl/test_get_response_cleanup.c b/src/testcurl/test_get_response_cleanup.c @@ -171,7 +171,7 @@ testMultithreadedGet () struct MHD_Daemon *d; pid_t curl; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 2, MHD_OPTION_END); diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c @@ -175,7 +175,7 @@ testMultithreadedGet () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c @@ -210,7 +210,7 @@ testMultithreadedPut () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (1024*1024), diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c @@ -224,7 +224,7 @@ testMultithreadedPost () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); @@ -559,7 +559,7 @@ testMultithreadedPostCancelPart(int flags) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_cancel, NULL, MHD_OPTION_END); if (d == NULL) diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c @@ -183,7 +183,7 @@ testMultithreadedPost () cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); if (d == NULL) return 16; diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c @@ -239,7 +239,7 @@ testMultithreadedPost () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); diff --git a/src/testcurl/test_process_headers.c b/src/testcurl/test_process_headers.c @@ -206,7 +206,7 @@ testMultithreadedGet () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 21080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c @@ -187,7 +187,7 @@ testMultithreadedPut () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 1081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c @@ -197,7 +197,7 @@ testMultithreadedPut () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 11081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c @@ -488,13 +488,13 @@ main (int argc, char *const *argv) if (0 != curl_global_init (CURL_GLOBAL_WIN32)) return 2; errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, 0, 0); - errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION, 0, 0); + errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, 0, 0); errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, CPU_COUNT, 0); errorCount += testExternalGet (); if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL)) { errorCount += testGet(MHD_USE_INTERNAL_POLLING_THREAD, 0, MHD_USE_POLL); - errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION, 0, MHD_USE_POLL); + errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, 0, MHD_USE_POLL); errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, CPU_COUNT, MHD_USE_POLL); } if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) diff --git a/src/testcurl/test_start_stop.c b/src/testcurl/test_start_stop.c @@ -67,7 +67,7 @@ testMultithreadedGet (int poll_flag) { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG | poll_flag, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 2; diff --git a/src/testcurl/test_termination.c b/src/testcurl/test_termination.c @@ -91,7 +91,7 @@ main () { struct MHD_Daemon *daemon; - daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, PORT, NULL, NULL, connection_handler, NULL, MHD_OPTION_END); diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c @@ -148,7 +148,7 @@ testMultithreadedGet () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ , + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_DEBUG */ , 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; diff --git a/src/testzzuf/test_get_chunked.c b/src/testzzuf/test_get_chunked.c @@ -171,7 +171,7 @@ testMultithreadedGet () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ , + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_DEBUG */ , 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; diff --git a/src/testzzuf/test_post.c b/src/testzzuf/test_post.c @@ -208,7 +208,7 @@ testMultithreadedPost () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ , + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_DEBUG */ , 11080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); diff --git a/src/testzzuf/test_post_form.c b/src/testzzuf/test_post_form.c @@ -227,7 +227,7 @@ testMultithreadedPost () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ , + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_DEBUG */ , 11080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); diff --git a/src/testzzuf/test_put.c b/src/testzzuf/test_put.c @@ -179,7 +179,7 @@ testMultithreadedPut () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ , + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_DEBUG */ , 11080, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) diff --git a/src/testzzuf/test_put_chunked.c b/src/testzzuf/test_put_chunked.c @@ -185,7 +185,7 @@ testMultithreadedPut () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_DEBUG, 11081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) diff --git a/src/testzzuf/test_put_large.c b/src/testzzuf/test_put_large.c @@ -194,7 +194,7 @@ testMultithreadedPut () cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ , + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_DEBUG */ , 11080, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL)