diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c index 83f208b3..1a466dd7 100644 --- a/src/testcurl/https/test_empty_response.c +++ b/src/testcurl/https/test_empty_response.c @@ -189,24 +189,37 @@ testInternalSelectGet () else (void) sleep (1); curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } } if (multi != NULL) diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c index ce89ee42..5c04aaab 100644 --- a/src/testcurl/https/test_https_get_select.c +++ b/src/testcurl/https/test_https_get_select.c @@ -213,24 +213,37 @@ testExternalGet (int flags) else (void) sleep (1); curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c index 0627bf53..90aa6d25 100644 --- a/src/testcurl/perf_get.c +++ b/src/testcurl/perf_get.c @@ -225,7 +225,7 @@ testInternalGet (int port, int poll_flag) "http://127.0.0.1:%d/hello_world", port); start_timer (); - for (i = 0; imsg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_easy_cleanup (c); - c = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + break; } /* two possibilities here; as select sets are tiny, this makes virtually no difference diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c index 5fdfa4b3..d2894c06 100644 --- a/src/testcurl/test_callback.c +++ b/src/testcurl/test_callback.c @@ -220,7 +220,7 @@ main (int argc, char **argv) abort (); #else if ((WSAEINVAL != WSAGetLastError ()) || - (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) ) + (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count)) abort (); Sleep (1000); #endif @@ -228,24 +228,26 @@ main (int argc, char **argv) if (NULL != multi) { curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { int pending; int curl_fine = 0; while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->msg != CURLMSG_DONE) + if (msg->msg == CURLMSG_DONE) { - if (msg->data.result != CURLE_OK) + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { fprintf (stderr, "%s failed at %s:%d: `%s'\n", "curl_multi_perform", __FILE__, __LINE__, curl_easy_strerror (msg->data.result)); - abort (); + abort (); + } } - else - curl_fine = 1; } if (! curl_fine) { diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c index 400aa499..bfb0ea47 100644 --- a/src/testcurl/test_delete.c +++ b/src/testcurl/test_delete.c @@ -482,24 +482,37 @@ testExternalDelete () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c index bf9d78ea..971bfc82 100644 --- a/src/testcurl/test_get.c +++ b/src/testcurl/test_get.c @@ -519,24 +519,37 @@ testExternalGet () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c index eeb4228c..b4644e5b 100644 --- a/src/testcurl/test_get_chunked.c +++ b/src/testcurl/test_get_chunked.c @@ -686,26 +686,39 @@ testExternalGet () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - curl_slist_free_all (h_list); - h_list = NULL; - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + curl_slist_free_all (h_list); + h_list = NULL; + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_get_empty.c b/src/testcurl/test_get_empty.c index 6d6c3166..53e45f71 100644 --- a/src/testcurl/test_get_empty.c +++ b/src/testcurl/test_get_empty.c @@ -481,24 +481,37 @@ testExternalGet () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_get_iovec.c b/src/testcurl/test_get_iovec.c index 45658c96..90d4c123 100644 --- a/src/testcurl/test_get_iovec.c +++ b/src/testcurl/test_get_iovec.c @@ -603,24 +603,37 @@ testExternalGet () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c index 1a444607..9f1f82ae 100644 --- a/src/testcurl/test_get_sendfile.c +++ b/src/testcurl/test_get_sendfile.c @@ -460,24 +460,37 @@ testExternalGet () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c index 8a2df37b..1aa8a457 100644 --- a/src/testcurl/test_large_put.c +++ b/src/testcurl/test_large_put.c @@ -576,24 +576,37 @@ testPutExternal (void) #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_parse_cookies.c b/src/testcurl/test_parse_cookies.c index 8a786cc2..4356bf8c 100644 --- a/src/testcurl/test_parse_cookies.c +++ b/src/testcurl/test_parse_cookies.c @@ -239,24 +239,37 @@ testExternalGet () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_patch.c b/src/testcurl/test_patch.c index d87b9263..eb1fc707 100644 --- a/src/testcurl/test_patch.c +++ b/src/testcurl/test_patch.c @@ -450,24 +450,37 @@ testExternalPut () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c index ab8f4cb2..2e34c38f 100644 --- a/src/testcurl/test_post.c +++ b/src/testcurl/test_post.c @@ -526,24 +526,37 @@ testExternalPost () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c index 73441c54..0c8bf202 100644 --- a/src/testcurl/test_post_loop.c +++ b/src/testcurl/test_post_loop.c @@ -519,7 +519,7 @@ testExternalPost () if ((CURLM_OK == curl_multi_timeout (multi, &ctimeout)) && (ctimeout < (long long) timeout) && (ctimeout >= 0)) timeout = ctimeout; - if ( (c == NULL) || (running == 0) ) + if ( (c == NULL) || (0 == running) ) timeout = 0; /* terminate quickly... */ tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; @@ -535,22 +535,36 @@ testExternalPost () while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform (multi, &running)) ; - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_easy_cleanup (c); - c = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + break; } MHD_run (d); } diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c index 3ed43687..57d6b4bf 100644 --- a/src/testcurl/test_postform.c +++ b/src/testcurl/test_postform.c @@ -551,25 +551,37 @@ testExternalPost () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, - curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_process_arguments.c b/src/testcurl/test_process_arguments.c index f7e03531..96a46e1d 100644 --- a/src/testcurl/test_process_arguments.c +++ b/src/testcurl/test_process_arguments.c @@ -238,24 +238,37 @@ testExternalGet () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_process_headers.c b/src/testcurl/test_process_headers.c index 8756858b..b0826b3d 100644 --- a/src/testcurl/test_process_headers.c +++ b/src/testcurl/test_process_headers.c @@ -494,24 +494,37 @@ testExternalGet () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c index b8adbb70..2012b7fd 100644 --- a/src/testcurl/test_put.c +++ b/src/testcurl/test_put.c @@ -494,24 +494,37 @@ testExternalPut () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c index 090e6ebc..2c24130e 100644 --- a/src/testcurl/test_put_chunked.c +++ b/src/testcurl/test_put_chunked.c @@ -489,25 +489,37 @@ testExternalPut () #endif } curl_multi_perform (multi, &running); - if (running == 0) + if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if (msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, - curl_easy_strerror (msg->data.result)); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + abort (); + } + } } + if (! curl_fine) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; } MHD_run (d); } diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c index 85f6f756..4482cde4 100644 --- a/src/testcurl/test_quiesce.c +++ b/src/testcurl/test_quiesce.c @@ -469,29 +469,40 @@ testExternalGet () curl_multi_perform (multi, &running); if (0 == running) { - msg = curl_multi_info_read (multi, &running); - if (NULL == msg) - break; - if (msg->msg == CURLMSG_DONE) + int pending; + int curl_fine = 0; + while (NULL != (msg = curl_multi_info_read (multi, &pending))) { - if ((i == 0) && (msg->data.result != CURLE_OK) ) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, - curl_easy_strerror (msg->data.result)); - else if ( (i == 1) && - (msg->data.result == CURLE_OK) ) - printf ("%s should have failed at %s:%d\n", - "curl_multi_perform", - __FILE__, - __LINE__); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result == CURLE_OK) + curl_fine = 1; + else if (i == 0) + { + fprintf (stderr, + "%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + } + } } + if ((i == 0) && (! curl_fine)) + { + fprintf (stderr, "libcurl haven't returned OK code\n"); + abort (); + } + else if ((i == 1) && (curl_fine)) + { + fprintf (stderr, "libcurl returned OK code, while it shouldn't\n"); + abort (); + } + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + break; } MHD_run (d); }