From 0ea5d514477a8b109a922afe5cdd1343d94c63bd Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Sat, 15 Jan 2022 17:45:48 +0300 Subject: test_upgrade{,_large}: used the same port for all checks. Fixed port conflict for platforms with broken detection of autobind port --- src/microhttpd/test_upgrade_large.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/microhttpd/test_upgrade_large.c') diff --git a/src/microhttpd/test_upgrade_large.c b/src/microhttpd/test_upgrade_large.c index 7c1032cf..3ccb1985 100644 --- a/src/microhttpd/test_upgrade_large.c +++ b/src/microhttpd/test_upgrade_large.c @@ -338,6 +338,8 @@ fflush_allstd (void) static int verbose = 0; +static uint16_t global_port; + static struct MHD_itc_ kicker = MHD_ITC_STATIC_INIT_INVALID; enum tls_tool @@ -1453,9 +1455,7 @@ test_upgrade (int flags, if (! test_tls) d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE, - MHD_is_feature_supported ( - MHD_FEATURE_AUTODETECT_BIND_PORT) ? - 0 : 1090, + global_port, NULL, NULL, &ahc_upgrade, NULL, MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 512, @@ -1470,9 +1470,7 @@ test_upgrade (int flags, else d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE | MHD_USE_TLS, - MHD_is_feature_supported ( - MHD_FEATURE_AUTODETECT_BIND_PORT) ? - 0 : 1090, + global_port, NULL, NULL, &ahc_upgrade, NULL, MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 512, @@ -1497,6 +1495,7 @@ test_upgrade (int flags, if ( (NULL == dinfo) || (0 == dinfo->port) ) mhdErrorExitDesc ("MHD_get_daemon_info() failed"); + global_port = dinfo->port; /* Re-use the same port for the next checks */ if (! test_tls || (TLS_LIB_GNUTLS == use_tls_tool)) { sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); @@ -1634,6 +1633,9 @@ main (int argc, #endif /* ! HTTPS_SUPPORT */ } + global_port = MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT) ? + 0 : (test_tls ? 1093 : 1092); + /* run tests */ if (verbose) printf ("Starting HTTP \"Upgrade\" tests with %s connections.\n", -- cgit v1.2.3