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 ***************************************************************************/
25 #include "curl_warnless.h"
26 #include "curl_memdebug.h"
28 #define TEST_HANG_TIMEOUT 60 * 1000
35 CURL *curl[NUM_HANDLES];
41 for(i=0; i < NUM_HANDLES; i++)
46 global_init(CURL_GLOBAL_ALL);
50 /* get NUM_HANDLES easy handles */
51 for(i=0; i < NUM_HANDLES; i++) {
52 /* get an easy handle */
55 sprintf(target_url, "%s%04i", URL, i + 1);
56 target_url[sizeof(target_url) - 1] = '\0';
57 easy_setopt(curl[i], CURLOPT_URL, target_url);
59 easy_setopt(curl[i], CURLOPT_VERBOSE, 1L);
61 easy_setopt(curl[i], CURLOPT_HEADER, 1L);
62 /* add handle to multi */
63 multi_add_handle(m, curl[i]);
66 multi_setopt(m, CURLMOPT_PIPELINING, 1L);
68 fprintf(stderr, "Start at URL 0\n");
71 struct timeval interval;
78 multi_perform(m, &running);
80 abort_on_test_timeout();
89 multi_fdset(m, &rd, &wr, &exc, &maxfd);
91 /* At this point, maxfd is guaranteed to be greater or equal than -1. */
93 select_test(maxfd+1, &rd, &wr, &exc, &interval);
95 abort_on_test_timeout();
100 /* proper cleanup sequence - type PB */
102 for(i=0; i < NUM_HANDLES; i++) {
103 curl_multi_remove_handle(m, curl[i]);
104 curl_easy_cleanup(curl[i]);
107 curl_multi_cleanup(m);
108 curl_global_cleanup();