diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-08-19 09:37:28 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-08-19 09:37:28 +0000 |
commit | d412724598dbff1e779534cf30a241ec38b0d280 (patch) | |
tree | 4a3635c430957a01b4de9b2d635aa499a294b04b /tests/libtest/lib507.c | |
parent | f95de76789b9db8754033b61159fbf7f0c502532 (diff) |
test507 for multi with bad host name
Diffstat (limited to 'tests/libtest/lib507.c')
-rw-r--r-- | tests/libtest/lib507.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/libtest/lib507.c b/tests/libtest/lib507.c new file mode 100644 index 000000000..14004f3d9 --- /dev/null +++ b/tests/libtest/lib507.c @@ -0,0 +1,50 @@ +#include "test.h" + +CURLcode test(char *URL) +{ + CURL* curls; + CURLM* multi; + int still_running; + int i; + CURLMsg *msg; + + multi = curl_multi_init(); + + curls=curl_easy_init(); + curl_easy_setopt(curls, CURLOPT_URL, URL); + curl_multi_add_handle(multi, curls); + + while ( CURLM_CALL_MULTI_PERFORM == curl_multi_perform(multi, &still_running) ); + while(still_running) { + struct timeval timeout; + int rc; + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd; + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + timeout.tv_sec = 1; + timeout.tv_usec = 0; + curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd); + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + switch(rc) { + case -1: + break; + case 0: + default: + while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(multi, &still_running)); + break; + } + } + msg = curl_multi_info_read(multi, &still_running); + /* this should now contain a result code from the easy handle, + get it */ + i = msg->data.result; + + curl_multi_cleanup(multi); + curl_easy_cleanup(curls); + + return i; /* return the final return code */ +} |