aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/https/tls_thread_mode_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/https/tls_thread_mode_test.c')
-rw-r--r--src/testcurl/https/tls_thread_mode_test.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/testcurl/https/tls_thread_mode_test.c b/src/testcurl/https/tls_thread_mode_test.c
index a2f0de87..ed263e3f 100644
--- a/src/testcurl/https/tls_thread_mode_test.c
+++ b/src/testcurl/https/tls_thread_mode_test.c
@@ -179,6 +179,7 @@ test_https_transfer (FILE * test_fd, char *cipher_suite, int proto_version)
179 if (NULL == (mem_test_file_local = malloc (len))) 179 if (NULL == (mem_test_file_local = malloc (len)))
180 { 180 {
181 fclose (test_fd); 181 fclose (test_fd);
182 free (doc_path);
182 fprintf (stderr, MHD_E_MEM); 183 fprintf (stderr, MHD_E_MEM);
183 return -1; 184 return -1;
184 } 185 }
@@ -187,14 +188,17 @@ test_https_transfer (FILE * test_fd, char *cipher_suite, int proto_version)
187 if (fread (mem_test_file_local, sizeof (char), len, test_fd) != len) 188 if (fread (mem_test_file_local, sizeof (char), len, test_fd) != len)
188 { 189 {
189 fclose (test_fd); 190 fclose (test_fd);
191 free (doc_path);
190 fprintf (stderr, "Error: failed to read test file. %s\n", 192 fprintf (stderr, "Error: failed to read test file. %s\n",
191 strerror (errno)); 193 strerror (errno));
192 return -1; 194 return -1;
193 } 195 }
194 196
195 if (NULL == (cbc.buf = malloc (sizeof (char) * len))) 197 if (NULL == (cbc.buf = malloc (len)))
196 { 198 {
197 fclose (test_fd); 199 fclose (test_fd);
200 free (doc_path);
201 free (mem_test_file_local);
198 fprintf (stderr, MHD_E_MEM); 202 fprintf (stderr, MHD_E_MEM);
199 return -1; 203 return -1;
200 } 204 }
@@ -235,6 +239,9 @@ test_https_transfer (FILE * test_fd, char *cipher_suite, int proto_version)
235 fprintf (stderr, "curl_easy_perform failed: `%s'\n", 239 fprintf (stderr, "curl_easy_perform failed: `%s'\n",
236 curl_easy_strerror (errornum)); 240 curl_easy_strerror (errornum));
237 curl_easy_cleanup (c); 241 curl_easy_cleanup (c);
242 free (cbc.buf);
243 free (mem_test_file_local);
244 free (doc_path);
238 return errornum; 245 return errornum;
239 } 246 }
240 247
@@ -245,6 +252,7 @@ test_https_transfer (FILE * test_fd, char *cipher_suite, int proto_version)
245 fprintf (stderr, "Error: local file & received file differ.\n"); 252 fprintf (stderr, "Error: local file & received file differ.\n");
246 free (cbc.buf); 253 free (cbc.buf);
247 free (mem_test_file_local); 254 free (mem_test_file_local);
255 free (doc_path);
248 return -1; 256 return -1;
249 } 257 }
250 258
@@ -401,10 +409,11 @@ test_parallel_clients (FILE * test_fd, char *cipher_suite,
401 for (i = 0; i < client_count; ++i) 409 for (i = 0; i < client_count; ++i)
402 { 410 {
403 if (pthread_create (&client_arr[i], NULL, 411 if (pthread_create (&client_arr[i], NULL,
404 (void *) &https_transfer_thread_adapter, 412 &https_transfer_thread_adapter,
405 &client_args) != 0) 413 &client_args) != 0)
406 { 414 {
407 fprintf (stderr, "Error: failed to spawn test client threads.\n"); 415 fprintf (stderr, "Error: failed to spawn test client threads.\n");
416
408 return -1; 417 return -1;
409 } 418 }
410 } 419 }
@@ -447,27 +456,12 @@ main (int argc, char *const *argv)
447 } 456 }
448 457
449 errorCount += 458 errorCount +=
450 test_wrap ("multi threaded daemon, single client", &test_single_client,
451 test_fd, MHD_USE_SSL | MHD_USE_DEBUG, "AES256-SHA",
452 CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
453 MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
454 MHD_OPTION_END);
455
456 errorCount +=
457 test_wrap ("single threaded daemon, single client", &test_single_client, 459 test_wrap ("single threaded daemon, single client", &test_single_client,
458 test_fd, 460 test_fd,
459 MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG, 461 MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG,
460 "AES256-SHA", CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, 462 "AES256-SHA", CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
461 srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, 463 srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
462 srv_self_signed_cert_pem, MHD_OPTION_END); 464 srv_self_signed_cert_pem, MHD_OPTION_END);
463
464 errorCount +=
465 test_wrap ("multi threaded daemon, parallel client",
466 &test_parallel_clients, test_fd, MHD_USE_SSL | MHD_USE_DEBUG,
467 "AES256-SHA", CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
468 srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
469 srv_self_signed_cert_pem, MHD_OPTION_END);
470
471 errorCount += 465 errorCount +=
472 test_wrap ("single threaded daemon, parallel clients", 466 test_wrap ("single threaded daemon, parallel clients",
473 &test_parallel_clients, test_fd, 467 &test_parallel_clients, test_fd,