libmicrohttpd

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

commit 67b1cdc29dfb1f260e0d31df3121e01d8ecad027
parent b05555f8372fd848698d87133d8ed194820ede1e
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Tue, 21 Nov 2023 17:33:58 +0300

Tests: added use of MHD_USE_NO_THREAD_SAFETY flag

Diffstat:
Msrc/microhttpd/test_client_put_stop.c | 3++-
Msrc/microhttpd/test_daemon.c | 9++++++---
Msrc/microhttpd/test_options.c | 21+++++++++++----------
Msrc/microhttpd/test_set_panic.c | 3++-
Msrc/microhttpd/test_start_stop.c | 23++++++++++++++++++++---
Msrc/microhttpd/test_upgrade.c | 5+++--
Msrc/testcurl/https/test_https_get_select.c | 4+++-
Msrc/testcurl/perf_get.c | 2+-
Msrc/testcurl/test_add_conn.c | 3+--
Msrc/testcurl/test_basicauth.c | 2+-
Msrc/testcurl/test_callback.c | 2+-
Msrc/testcurl/test_delete.c | 2+-
Msrc/testcurl/test_digestauth2.c | 2+-
Msrc/testcurl/test_digestauth_emu_ext.c | 2+-
Msrc/testcurl/test_get.c | 15+++++++++++----
Msrc/testcurl/test_get_chunked.c | 2+-
Msrc/testcurl/test_get_close_keep_alive.c | 2+-
Msrc/testcurl/test_get_iovec.c | 8+++++---
Msrc/testcurl/test_get_sendfile.c | 8+++++---
Msrc/testcurl/test_head.c | 2+-
Msrc/testcurl/test_large_put.c | 2+-
Msrc/testcurl/test_parse_cookies.c | 2+-
Msrc/testcurl/test_patch.c | 2+-
Msrc/testcurl/test_post.c | 2+-
Msrc/testcurl/test_post_loop.c | 2+-
Msrc/testcurl/test_postform.c | 2+-
Msrc/testcurl/test_process_arguments.c | 2+-
Msrc/testcurl/test_process_headers.c | 2+-
Msrc/testcurl/test_put.c | 2+-
Msrc/testcurl/test_put_broken_len.c | 2+-
Msrc/testcurl/test_put_header_fold.c | 2+-
Msrc/testcurl/test_toolarge.c | 3++-
Msrc/testcurl/test_tricky.c | 3++-
Msrc/testzzuf/test_get.c | 10+++++++---
34 files changed, 100 insertions(+), 58 deletions(-)

diff --git a/src/microhttpd/test_client_put_stop.c b/src/microhttpd/test_client_put_stop.c @@ -1979,7 +1979,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType, if (testMhdThreadExternal == thrType) d = MHD_start_daemon (((unsigned int) pollType) - | (verbose ? MHD_USE_ERROR_LOG : 0), + | (verbose ? MHD_USE_ERROR_LOG : 0) + | MHD_USE_NO_THREAD_SAFETY, *pport, NULL, NULL, &ahcCheck, *ahc_param, MHD_OPTION_URI_LOG_CALLBACK, &check_uri_cb, diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c @@ -116,14 +116,15 @@ testStartStop (void) static unsigned int -testExternalRun (void) +testExternalRun (int use_no_thread_safe) { struct MHD_Daemon *d; fd_set rs; MHD_socket maxfd; int i; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG + | (use_no_thread_safe ? MHD_USE_NO_THREAD_SAFETY : 0), 0, &apc_all, NULL, &ahc_nothing, NULL, @@ -233,7 +234,9 @@ main (int argc, errorCount += testStartError (); if (has_threads_support) errorCount += testStartStop (); - errorCount += testExternalRun (); + if (has_threads_support) + errorCount += testExternalRun (0); + errorCount += testExternalRun (! 0); if (has_threads_support) { errorCount += testThread (); diff --git a/src/microhttpd/test_options.c b/src/microhttpd/test_options.c @@ -102,7 +102,7 @@ test_ip_addr_option (void) ret = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR, &daemon_ip_addr, MHD_OPTION_END); @@ -120,7 +120,7 @@ test_ip_addr_option (void) daemon_ip_addr.sin_port = htons (port4); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR_LEN, (socklen_t) sizeof(daemon_ip_addr), &daemon_ip_addr, @@ -138,7 +138,7 @@ test_ip_addr_option (void) MHD_stop_daemon (d); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR_LEN, (socklen_t) (sizeof(daemon_ip_addr) / 2), @@ -154,7 +154,7 @@ test_ip_addr_option (void) #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN daemon_ip_addr.sin_len = (socklen_t) sizeof(daemon_ip_addr); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR_LEN, (socklen_t) sizeof(daemon_ip_addr), &daemon_ip_addr, @@ -173,7 +173,7 @@ test_ip_addr_option (void) daemon_ip_addr.sin_len = (socklen_t) (sizeof(daemon_ip_addr) / 2); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR_LEN, (socklen_t) sizeof(daemon_ip_addr), &daemon_ip_addr, @@ -189,7 +189,8 @@ test_ip_addr_option (void) #if defined(HAVE_INET6) && defined(USE_IPV6_TESTING) - d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_IPv6, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_IPv6 + | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR, &daemon_ip_addr6, MHD_OPTION_END); @@ -207,7 +208,7 @@ test_ip_addr_option (void) daemon_ip_addr6.sin6_port = htons (port6); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR_LEN, (socklen_t) sizeof(daemon_ip_addr6), &daemon_ip_addr6, @@ -225,7 +226,7 @@ test_ip_addr_option (void) MHD_stop_daemon (d); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR_LEN, (socklen_t) (sizeof(daemon_ip_addr6) / 2), @@ -241,7 +242,7 @@ test_ip_addr_option (void) #if defined(HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN) daemon_ip_addr6.sin6_len = (socklen_t) sizeof(daemon_ip_addr6); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR_LEN, (socklen_t) sizeof(daemon_ip_addr6), &daemon_ip_addr6, @@ -260,7 +261,7 @@ test_ip_addr_option (void) daemon_ip_addr6.sin6_len = (socklen_t) (sizeof(daemon_ip_addr6) / 2); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR_LEN, (socklen_t) sizeof(daemon_ip_addr6), &daemon_ip_addr6, diff --git a/src/microhttpd/test_set_panic.c b/src/microhttpd/test_set_panic.c @@ -1469,7 +1469,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType, if (testMhdThreadExternal == thrType) d = MHD_start_daemon (((unsigned int) pollType) - | (verbose ? MHD_USE_ERROR_LOG : 0), + | (verbose ? MHD_USE_ERROR_LOG : 0) + | MHD_USE_NO_THREAD_SAFETY, *pport, NULL, NULL, &ahcCheck, *ahc_param, MHD_OPTION_NOTIFY_CONNECTION, &socket_cb, diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c @@ -101,15 +101,31 @@ testMultithreadedPoolGet (unsigned int poll_flag) } +static unsigned int +testExternalGet (void) +{ + struct MHD_Daemon *d; + + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + 0, NULL, NULL, + &ahc_echo, NULL, + MHD_OPTION_END); + if (NULL == d) + return 8; + MHD_stop_daemon (d); + return 0; +} + + #endif static unsigned int -testExternalGet (void) +testExternalGetSingleThread (void) { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); @@ -132,8 +148,9 @@ main (int argc, errorCount += testInternalGet (0); errorCount += testMultithreadedGet (0); errorCount += testMultithreadedPoolGet (0); -#endif errorCount += testExternalGet (); +#endif + errorCount += testExternalGetSingleThread (); #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_POLL)) { diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c @@ -1275,7 +1275,8 @@ test_upgrade (unsigned int flags, done = false; if (! test_tls) - d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE, + d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE + | MHD_USE_ITC, global_port, NULL, NULL, &ahc_upgrade, NULL, @@ -1289,7 +1290,7 @@ test_upgrade (unsigned int flags, #ifdef HTTPS_SUPPORT else d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE - | MHD_USE_TLS, + | MHD_USE_TLS | MHD_USE_ITC, global_port, NULL, NULL, &ahc_upgrade, NULL, diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c @@ -278,7 +278,9 @@ main (int argc, char *const *argv) #ifdef EPOLL_SUPPORT errorCount += testExternalGet (MHD_USE_EPOLL); #endif - errorCount += testExternalGet (0); + if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS)) + errorCount += testExternalGet (MHD_NO_FLAG); + errorCount += testExternalGet (MHD_USE_NO_THREAD_SAFETY); curl_global_cleanup (); if (errorCount != 0) fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount); diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c @@ -458,7 +458,7 @@ testExternalGet (uint16_t port) multi = NULL; cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c @@ -739,8 +739,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType, if (testMhdThreadExternal == thrType) d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType) - | (thrType == testMhdThreadExternal ? - 0 : MHD_USE_ITC) + | MHD_USE_NO_THREAD_SAFETY | (no_listen ? MHD_USE_NO_LISTEN_SOCKET : 0) | MHD_USE_ERROR_LOG, *pport, NULL, NULL, diff --git a/src/testcurl/test_basicauth.c b/src/testcurl/test_basicauth.c @@ -647,7 +647,7 @@ testBasicAuth (void) else port = 4210; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c @@ -141,7 +141,7 @@ main (int argc, char **argv) else port = 1140; - d = MHD_start_daemon (0, + d = MHD_start_daemon (MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c @@ -389,7 +389,7 @@ testExternalDelete (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_digestauth2.c b/src/testcurl/test_digestauth2.c @@ -1366,7 +1366,7 @@ testDigestAuth (void) if (test_bind_uri) dauth_nonce_bind |= MHD_DAUTH_BIND_NONCE_URI_PARAMS; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, &rq_tr, MHD_OPTION_DIGEST_AUTH_RANDOM_COPY, diff --git a/src/testcurl/test_digestauth_emu_ext.c b/src/testcurl/test_digestauth_emu_ext.c @@ -820,7 +820,7 @@ testDigestAuthEmu (void) else port = 4210; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c @@ -394,7 +394,7 @@ testMultithreadedPoolGet (uint32_t poll_flag) static unsigned int -testExternalGet (void) +testExternalGet (int thread_unsafe) { struct MHD_Daemon *d; CURL *c; @@ -424,7 +424,8 @@ testExternalGet (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG + | (thread_unsafe ? MHD_USE_NO_THREAD_SAFETY : 0), global_port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, @@ -890,14 +891,20 @@ main (int argc, char *const *argv) if (0 != curl_global_init (CURL_GLOBAL_WIN32)) return 2; global_port = 0; - test_result = testExternalGet (); + test_result = testExternalGet (! 0); if (test_result) - fprintf (stderr, "FAILED: testExternalGet () - %u.\n", test_result); + fprintf (stderr, "FAILED: testExternalGet (!0) - %u.\n", test_result); else if (verbose) printf ("PASSED: testExternalGet ().\n"); errorCount += test_result; if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS)) { + test_result += testExternalGet (0); + if (test_result) + fprintf (stderr, "FAILED: testExternalGet (0) - %u.\n", test_result); + else if (verbose) + printf ("PASSED: testExternalGet ().\n"); + errorCount += test_result; test_result += testInternalGet (0); if (test_result) fprintf (stderr, "FAILED: testInternalGet (0) - %u.\n", test_result); diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c @@ -591,7 +591,7 @@ testExternalGet (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, MHD_OPTION_END); diff --git a/src/testcurl/test_get_close_keep_alive.c b/src/testcurl/test_get_close_keep_alive.c @@ -958,7 +958,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType, if (testMhdThreadExternal == thrType) d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType) - | MHD_USE_ERROR_LOG, + | MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, *pport, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, diff --git a/src/testcurl/test_get_iovec.c b/src/testcurl/test_get_iovec.c @@ -481,7 +481,7 @@ testMultithreadedPoolGet (void) static unsigned int -testExternalGet (void) +testExternalGet (int thread_unsafe) { struct MHD_Daemon *d; CURL *c; @@ -516,7 +516,8 @@ testExternalGet (void) cbc.buf = (char *) readbuf; cbc.size = sizeof(readbuf); cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG + | (thread_unsafe ? MHD_USE_NO_THREAD_SAFETY : 0), port, NULL, NULL, &ahc_cont, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, MHD_OPTION_END); @@ -773,8 +774,9 @@ main (int argc, char *const *argv) errorCount += testMultithreadedGet (); errorCount += testMultithreadedPoolGet (); errorCount += testUnknownPortGet (); + errorCount += testExternalGet (0); } - errorCount += testExternalGet (); + errorCount += testExternalGet (! 0); if (errorCount != 0) fprintf (stderr, "Error (code: %u)\n", errorCount); curl_global_cleanup (); diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c @@ -337,7 +337,7 @@ testMultithreadedPoolGet (void) static unsigned int -testExternalGet (void) +testExternalGet (int thread_unsafe) { struct MHD_Daemon *d; CURL *c; @@ -373,7 +373,8 @@ testExternalGet (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG + | (thread_unsafe ? MHD_USE_NO_THREAD_SAFETY : 0), port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, MHD_OPTION_END); @@ -660,8 +661,9 @@ main (int argc, char *const *argv) errorCount += testMultithreadedGet (); errorCount += testMultithreadedPoolGet (); errorCount += testUnknownPortGet (); + errorCount += testExternalGet (0); } - errorCount += testExternalGet (); + errorCount += testExternalGet (! 0); if (errorCount != 0) fprintf (stderr, "Error (code: %u)\n", errorCount); curl_global_cleanup (); diff --git a/src/testcurl/test_head.c b/src/testcurl/test_head.c @@ -756,7 +756,7 @@ testHead (void) else port = 4220 + oneone ? 0 : 1; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahcCheck, &ahc_param, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c @@ -647,7 +647,7 @@ testPutExternal (void) cbc.size = 2048; cbc.pos = 0; multi = NULL; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_CONNECTION_MEMORY_LIMIT, diff --git a/src/testcurl/test_parse_cookies.c b/src/testcurl/test_parse_cookies.c @@ -1646,7 +1646,7 @@ testExternalPolling (void) else port = 1340 + oneone ? 0 : 6 + (uint16_t) (1 + discp_level); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahcCheck, &ahc_param, MHD_OPTION_CLIENT_DISCIPLINE_LVL, diff --git a/src/testcurl/test_patch.c b/src/testcurl/test_patch.c @@ -374,7 +374,7 @@ testExternalPut (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c @@ -433,7 +433,7 @@ testExternalPost (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c @@ -431,7 +431,7 @@ testExternalPost (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, MHD_OPTION_END); diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c @@ -557,7 +557,7 @@ testExternalPost (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_process_arguments.c b/src/testcurl/test_process_arguments.c @@ -149,7 +149,7 @@ testExternalGet (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, MHD_OPTION_END); diff --git a/src/testcurl/test_process_headers.c b/src/testcurl/test_process_headers.c @@ -406,7 +406,7 @@ testExternalGet (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, MHD_OPTION_END); diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c @@ -398,7 +398,7 @@ testExternalPut (void) cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_put_broken_len.c b/src/testcurl/test_put_broken_len.c @@ -628,7 +628,7 @@ performTest (void) else port = 4220 + oneone ? 0 : 1; - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahcCheck, &ahc_param, MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE, diff --git a/src/testcurl/test_put_header_fold.c b/src/testcurl/test_put_header_fold.c @@ -1147,7 +1147,7 @@ performCheck (void) mem_limit = (size_t) ((TEST_UPLOAD_DATA_SIZE * 4) / 3 + 2 + HEADERS_POINTERS_SIZE); - d = MHD_start_daemon (MHD_USE_ERROR_LOG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, port, NULL, NULL, &ahcCheck, &ahc_param, MHD_OPTION_CONNECTION_MEMORY_LIMIT, mem_limit, diff --git a/src/testcurl/test_toolarge.c b/src/testcurl/test_toolarge.c @@ -1453,7 +1453,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType, if (testMhdThreadExternal == thrType) d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType) - | (verbose ? MHD_USE_ERROR_LOG : 0), + | (verbose ? MHD_USE_ERROR_LOG : 0) + | MHD_USE_NO_THREAD_SAFETY, *pport, NULL, NULL, &ahcCheck, *ahc_param, MHD_OPTION_URI_LOG_CALLBACK, &check_uri_cb, diff --git a/src/testcurl/test_tricky.c b/src/testcurl/test_tricky.c @@ -964,7 +964,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType, if (testMhdThreadExternal == thrType) d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType) - | (verbose ? MHD_USE_ERROR_LOG : 0), + | (verbose ? MHD_USE_ERROR_LOG : 0) + | MHD_USE_NO_THREAD_SAFETY, *pport, NULL, NULL, &ahcCheck, *ahc_param, MHD_OPTION_URI_LOG_CALLBACK, &check_uri_cb, diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c @@ -1272,9 +1272,12 @@ print_test_starting (unsigned int daemon_flags) else { if (0 != (MHD_USE_EPOLL & daemon_flags)) - printf ("\nStarting test with external polling and internal 'epoll'.\n"); + printf ("\nStarting test with%s thread safety with external polling " + "and internal 'epoll'.\n", + ((0 != (MHD_USE_NO_THREAD_SAFETY & daemon_flags)) ? "out" : "")); else - printf ("\nStarting test with external polling.\n"); + printf ("\nStarting test with%s thread safety with external polling.\n", + ((0 != (MHD_USE_NO_THREAD_SAFETY & daemon_flags)) ? "out" : "")); } fflush (stdout); } @@ -1623,8 +1626,9 @@ run_all_checks (void) if ((77 == testRes) || (99 == testRes)) return testRes; } + testRes = testExternalPolling (&port, MHD_NO_FLAG); } - testRes = testExternalPolling (&port, MHD_NO_FLAG); + testRes = testExternalPolling (&port, MHD_USE_NO_THREAD_SAFETY); if ((77 == testRes) || (99 == testRes)) return testRes; ret += testRes;