aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/test_get_close_keep_alive.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/test_get_close_keep_alive.c')
-rw-r--r--src/testcurl/test_get_close_keep_alive.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/testcurl/test_get_close_keep_alive.c b/src/testcurl/test_get_close_keep_alive.c
index 169a2098..3754325c 100644
--- a/src/testcurl/test_get_close_keep_alive.c
+++ b/src/testcurl/test_get_close_keep_alive.c
@@ -167,9 +167,9 @@ _libcurlErrorExit_func (const char *errDesc, const char *funcName, int lineNum)
167 HDR_CONN_KEEP_ALIVE_VALUE 167 HDR_CONN_KEEP_ALIVE_VALUE
168 168
169/* Global parameters */ 169/* Global parameters */
170static int oneone; /**< Use HTTP/1.1 instead of HTTP/1.0 for requests*/ 170static int oneone; /**< Use HTTP/1.1 instead of HTTP/1.0 for requests*/
171static int conn_close; /**< Don't use Keep-Alive */ 171static int conn_close; /**< Don't use Keep-Alive */
172static int global_port; /**< MHD daemons listen port number */ 172static uint16_t global_port; /**< MHD daemons listen port number */
173static int slow_reply = 0; /**< Slowdown MHD replies */ 173static int slow_reply = 0; /**< Slowdown MHD replies */
174static int ignore_response_errors = 0; /**< Do not fail test if CURL 174static int ignore_response_errors = 0; /**< Do not fail test if CURL
175 returns error */ 175 returns error */
@@ -384,15 +384,15 @@ struct curlQueryParams
384 const char *queryPath; 384 const char *queryPath;
385 385
386 /* Destination port for CURL query */ 386 /* Destination port for CURL query */
387 int queryPort; 387 uint16_t queryPort;
388 388
389 /* CURL query result error flag */ 389 /* CURL query result error flag */
390 volatile int queryError; 390 volatile unsigned int queryError;
391}; 391};
392 392
393 393
394static CURL * 394static CURL *
395curlEasyInitForTest (const char *queryPath, int port, struct CBC *pcbc, 395curlEasyInitForTest (const char *queryPath, uint16_t port, struct CBC *pcbc,
396 struct headers_check_result *hdr_chk_result, 396 struct headers_check_result *hdr_chk_result,
397 int add_hdr_close, int add_hdr_k_alive) 397 int add_hdr_close, int add_hdr_k_alive)
398{ 398{
@@ -625,7 +625,7 @@ getMhdActiveConnections (struct MHD_Daemon *d)
625} 625}
626 626
627 627
628static int 628static unsigned int
629doCurlQueryInThread (struct MHD_Daemon *d, 629doCurlQueryInThread (struct MHD_Daemon *d,
630 struct curlQueryParams *p, 630 struct curlQueryParams *p,
631 int add_hdr_close, 631 int add_hdr_close,
@@ -853,11 +853,11 @@ doCurlQueryInThread (struct MHD_Daemon *d,
853 853
854 854
855/* Perform test queries and shut down MHD daemon */ 855/* Perform test queries and shut down MHD daemon */
856static int 856static unsigned int
857performTestQueries (struct MHD_Daemon *d, int d_port) 857performTestQueries (struct MHD_Daemon *d, uint16_t d_port)
858{ 858{
859 struct curlQueryParams qParam; 859 struct curlQueryParams qParam;
860 int ret = 0; /* Return value */ 860 unsigned int ret = 0; /* Return value */
861 int i = 0; 861 int i = 0;
862 /* masks */ 862 /* masks */
863 const int m_mhd_close = 1 << (i++); 863 const int m_mhd_close = 1 << (i++);
@@ -932,7 +932,7 @@ enum testMhdPollType
932static unsigned int 932static unsigned int
933testNumThreadsForPool (enum testMhdPollType pollType) 933testNumThreadsForPool (enum testMhdPollType pollType)
934{ 934{
935 int numThreads = MHD_CPU_COUNT; 935 unsigned int numThreads = MHD_CPU_COUNT;
936 (void) pollType; /* Don't care about pollType for this test */ 936 (void) pollType; /* Don't care about pollType for this test */
937 return numThreads; /* No practical limit for non-cleanup test */ 937 return numThreads; /* No practical limit for non-cleanup test */
938} 938}
@@ -940,7 +940,7 @@ testNumThreadsForPool (enum testMhdPollType pollType)
940 940
941static struct MHD_Daemon * 941static struct MHD_Daemon *
942startTestMhdDaemon (enum testMhdThreadsType thrType, 942startTestMhdDaemon (enum testMhdThreadsType thrType,
943 enum testMhdPollType pollType, int *pport) 943 enum testMhdPollType pollType, uint16_t *pport)
944{ 944{
945 struct MHD_Daemon *d; 945 struct MHD_Daemon *d;
946 const union MHD_DaemonInfo *dinfo; 946 const union MHD_DaemonInfo *dinfo;
@@ -956,14 +956,15 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
956 } 956 }
957 957
958 if (testMhdThreadInternalPool != thrType) 958 if (testMhdThreadInternalPool != thrType)
959 d = MHD_start_daemon (((int) thrType) | ((int) pollType) 959 d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
960 | MHD_USE_ERROR_LOG, 960 | MHD_USE_ERROR_LOG,
961 *pport, NULL, NULL, 961 *pport, NULL, NULL,
962 &ahc_echo, NULL, 962 &ahc_echo, NULL,
963 MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, 963 MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
964 MHD_OPTION_END); 964 MHD_OPTION_END);
965 else 965 else
966 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | ((int) pollType) 966 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD
967 | ((unsigned int) pollType)
967 | MHD_USE_ERROR_LOG, 968 | MHD_USE_ERROR_LOG,
968 *pport, NULL, NULL, 969 *pport, NULL, NULL,
969 &ahc_echo, NULL, 970 &ahc_echo, NULL,
@@ -986,7 +987,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
986 fprintf (stderr, "MHD_get_daemon_info() failed.\n"); 987 fprintf (stderr, "MHD_get_daemon_info() failed.\n");
987 abort (); 988 abort ();
988 } 989 }
989 *pport = (int) dinfo->port; 990 *pport = dinfo->port;
990 if (0 == global_port) 991 if (0 == global_port)
991 global_port = *pport; /* Reuse the same port for all tests */ 992 global_port = *pport; /* Reuse the same port for all tests */
992 } 993 }
@@ -998,11 +999,11 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
998/* Test runners */ 999/* Test runners */
999 1000
1000 1001
1001static int 1002static unsigned int
1002testExternalGet (void) 1003testExternalGet (void)
1003{ 1004{
1004 struct MHD_Daemon *d; 1005 struct MHD_Daemon *d;
1005 int d_port = global_port; /* Daemon's port */ 1006 uint16_t d_port = global_port; /* Daemon's port */
1006 1007
1007 d = startTestMhdDaemon (testMhdThreadExternal, testMhdPollBySelect, &d_port); 1008 d = startTestMhdDaemon (testMhdThreadExternal, testMhdPollBySelect, &d_port);
1008 1009
@@ -1010,11 +1011,11 @@ testExternalGet (void)
1010} 1011}
1011 1012
1012 1013
1013static int 1014static unsigned int
1014testInternalGet (enum testMhdPollType pollType) 1015testInternalGet (enum testMhdPollType pollType)
1015{ 1016{
1016 struct MHD_Daemon *d; 1017 struct MHD_Daemon *d;
1017 int d_port = global_port; /* Daemon's port */ 1018 uint16_t d_port = global_port; /* Daemon's port */
1018 1019
1019 d = startTestMhdDaemon (testMhdThreadInternal, pollType, 1020 d = startTestMhdDaemon (testMhdThreadInternal, pollType,
1020 &d_port); 1021 &d_port);
@@ -1023,11 +1024,11 @@ testInternalGet (enum testMhdPollType pollType)
1023} 1024}
1024 1025
1025 1026
1026static int 1027static unsigned int
1027testMultithreadedGet (enum testMhdPollType pollType) 1028testMultithreadedGet (enum testMhdPollType pollType)
1028{ 1029{
1029 struct MHD_Daemon *d; 1030 struct MHD_Daemon *d;
1030 int d_port = global_port; /* Daemon's port */ 1031 uint16_t d_port = global_port; /* Daemon's port */
1031 1032
1032 d = startTestMhdDaemon (testMhdThreadInternalPerConnection, pollType, 1033 d = startTestMhdDaemon (testMhdThreadInternalPerConnection, pollType,
1033 &d_port); 1034 &d_port);
@@ -1035,11 +1036,11 @@ testMultithreadedGet (enum testMhdPollType pollType)
1035} 1036}
1036 1037
1037 1038
1038static int 1039static unsigned int
1039testMultithreadedPoolGet (enum testMhdPollType pollType) 1040testMultithreadedPoolGet (enum testMhdPollType pollType)
1040{ 1041{
1041 struct MHD_Daemon *d; 1042 struct MHD_Daemon *d;
1042 int d_port = global_port; /* Daemon's port */ 1043 uint16_t d_port = global_port; /* Daemon's port */
1043 1044
1044 d = startTestMhdDaemon (testMhdThreadInternalPool, pollType, 1045 d = startTestMhdDaemon (testMhdThreadInternalPool, pollType,
1045 &d_port); 1046 &d_port);