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
00023
00024 #include "test.h"
00025
00026 #include <fcntl.h>
00027
00028 #include "testutil.h"
00029 #include "warnless.h"
00030 #include "memdebug.h"
00031
00032 #define TEST_HANG_TIMEOUT 60 * 1000
00033
00034 int test(char *URL)
00035 {
00036 int res = 0;
00037 CURL *curl = NULL;
00038 int running;
00039 CURLM *m = NULL;
00040 int current=0;
00041
00042 start_test_timing();
00043
00044 global_init(CURL_GLOBAL_ALL);
00045
00046 easy_init(curl);
00047
00048 easy_setopt(curl, CURLOPT_URL, URL);
00049 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
00050 easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
00051
00052 multi_init(m);
00053
00054 multi_add_handle(m, curl);
00055
00056 fprintf(stderr, "Start at URL 0\n");
00057
00058 for(;;) {
00059 struct timeval interval;
00060 fd_set rd, wr, exc;
00061 int maxfd = -99;
00062
00063 interval.tv_sec = 1;
00064 interval.tv_usec = 0;
00065
00066 multi_perform(m, &running);
00067
00068 abort_on_test_timeout();
00069
00070 if(!running) {
00071 if(!current++) {
00072 fprintf(stderr, "Advancing to URL 1\n");
00073
00074 curl_multi_remove_handle(m, curl);
00075
00076
00077
00078 curl_easy_reset(curl);
00079 easy_setopt(curl, CURLOPT_URL, libtest_arg2);
00080 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
00081 easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
00082
00083
00084 multi_add_handle(m, curl);
00085 }
00086 else
00087 break;
00088 }
00089
00090 FD_ZERO(&rd);
00091 FD_ZERO(&wr);
00092 FD_ZERO(&exc);
00093
00094 multi_fdset(m, &rd, &wr, &exc, &maxfd);
00095
00096
00097
00098 select_test(maxfd+1, &rd, &wr, &exc, &interval);
00099
00100 abort_on_test_timeout();
00101 }
00102
00103 test_cleanup:
00104
00105
00106
00107 curl_easy_cleanup(curl);
00108 curl_multi_cleanup(m);
00109 curl_global_cleanup();
00110
00111 return res;
00112 }