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 "testutil.h"
00025 #include "warnless.h"
00026 #include "memdebug.h"
00027
00028 #define TEST_HANG_TIMEOUT 60 * 1000
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 int test(char *URL)
00041 {
00042 CURL *http_handle = NULL;
00043 CURLM *multi_handle = NULL;
00044 int res = 0;
00045
00046 int still_running;
00047
00048 start_test_timing();
00049
00050
00051
00052
00053
00054 easy_init(http_handle);
00055
00056
00057 easy_setopt(http_handle, CURLOPT_URL, URL);
00058 easy_setopt(http_handle, CURLOPT_HEADER, 1L);
00059 easy_setopt(http_handle, CURLOPT_SSL_VERIFYPEER, 0L);
00060 easy_setopt(http_handle, CURLOPT_SSL_VERIFYHOST, 0L);
00061
00062
00063 multi_init(multi_handle);
00064
00065
00066 multi_add_handle(multi_handle, http_handle);
00067
00068
00069 multi_perform(multi_handle, &still_running);
00070
00071 abort_on_test_timeout();
00072
00073 while(still_running) {
00074 struct timeval timeout;
00075
00076 fd_set fdread;
00077 fd_set fdwrite;
00078 fd_set fdexcep;
00079 int maxfd = -99;
00080
00081 FD_ZERO(&fdread);
00082 FD_ZERO(&fdwrite);
00083 FD_ZERO(&fdexcep);
00084
00085
00086 timeout.tv_sec = 1;
00087 timeout.tv_usec = 0;
00088
00089
00090 multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
00091
00092
00093
00094 select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
00095
00096 abort_on_test_timeout();
00097
00098
00099 multi_perform(multi_handle, &still_running);
00100
00101 abort_on_test_timeout();
00102 }
00103
00104 test_cleanup:
00105
00106
00107
00108 curl_multi_cleanup(multi_handle);
00109 curl_easy_cleanup(http_handle);
00110 curl_global_cleanup();
00111
00112 return res;
00113 }