1 /***************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at http://curl.haxx.se/docs/copyright.html.
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ***************************************************************************/
30 #define TEST_HANG_TIMEOUT 60 * 1000
35 * 3. with multi interface
41 CURL *duphandle = NULL;
42 CURLM *mhandle = NULL;
44 int still_running = 0;
48 global_init(CURL_GLOBAL_ALL);
52 easy_setopt(handle, CURLOPT_URL, URL);
53 easy_setopt(handle, CURLOPT_WILDCARDMATCH, 1L);
54 easy_setopt(handle, CURLOPT_VERBOSE, 1L);
56 res = curl_easy_perform(handle);
60 res = curl_easy_perform(handle);
64 duphandle = curl_easy_duphandle(handle);
67 curl_easy_cleanup(handle);
72 multi_add_handle(mhandle, handle);
74 multi_perform(mhandle, &still_running);
76 abort_on_test_timeout();
78 while(still_running) {
79 struct timeval timeout;
86 timeout.tv_usec = 100000L; /* 100 ms */
92 multi_fdset(mhandle, &fdread, &fdwrite, &fdexcep, &maxfd);
94 /* At this point, maxfd is guaranteed to be greater or equal than -1. */
96 select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
98 abort_on_test_timeout();
100 multi_perform(mhandle, &still_running);
102 abort_on_test_timeout();
107 /* undocumented cleanup sequence - type UA */
109 curl_multi_cleanup(mhandle);
110 curl_easy_cleanup(handle);
111 curl_global_cleanup();