Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "test.h"
00023
00024 #include <fcntl.h>
00025
00026 #include "testutil.h"
00027 #include "warnless.h"
00028 #include "memdebug.h"
00029
00030 #define TEST_HANG_TIMEOUT 60 * 1000
00031
00032
00033
00034
00035
00036
00037
00038 int test(char *URL)
00039 {
00040 CURL *handle = NULL;
00041 CURL *duphandle = NULL;
00042 CURLM *mhandle = NULL;
00043 int res = 0;
00044 int still_running = 0;
00045
00046 start_test_timing();
00047
00048 global_init(CURL_GLOBAL_ALL);
00049
00050 easy_init(handle);
00051
00052 easy_setopt(handle, CURLOPT_URL, URL);
00053 easy_setopt(handle, CURLOPT_WILDCARDMATCH, 1L);
00054 easy_setopt(handle, CURLOPT_VERBOSE, 1L);
00055
00056 res = curl_easy_perform(handle);
00057 if(res)
00058 goto test_cleanup;
00059
00060 res = curl_easy_perform(handle);
00061 if(res)
00062 goto test_cleanup;
00063
00064 duphandle = curl_easy_duphandle(handle);
00065 if(!duphandle)
00066 goto test_cleanup;
00067 curl_easy_cleanup(handle);
00068 handle = duphandle;
00069
00070 multi_init(mhandle);
00071
00072 multi_add_handle(mhandle, handle);
00073
00074 multi_perform(mhandle, &still_running);
00075
00076 abort_on_test_timeout();
00077
00078 while(still_running) {
00079 struct timeval timeout;
00080 fd_set fdread;
00081 fd_set fdwrite;
00082 fd_set fdexcep;
00083 int maxfd = -99;
00084
00085 timeout.tv_sec = 0;
00086 timeout.tv_usec = 100000L;
00087
00088 FD_ZERO(&fdread);
00089 FD_ZERO(&fdwrite);
00090 FD_ZERO(&fdexcep);
00091
00092 multi_fdset(mhandle, &fdread, &fdwrite, &fdexcep, &maxfd);
00093
00094
00095
00096 select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
00097
00098 abort_on_test_timeout();
00099
00100 multi_perform(mhandle, &still_running);
00101
00102 abort_on_test_timeout();
00103 }
00104
00105 test_cleanup:
00106
00107
00108
00109 curl_multi_cleanup(mhandle);
00110 curl_easy_cleanup(handle);
00111 curl_global_cleanup();
00112
00113 return res;
00114 }