1 /***************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 1998 - 2012, 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 ***************************************************************************/
24 #include "testtrace.h"
29 #define TEST_HANG_TIMEOUT 60 * 1000
32 * Get a single URL without select().
41 double connect_time = 0.0;
47 } while ((double)(1.0 + (dbl_epsilon/2.0)) > (double)1.0);
51 global_init(CURL_GLOBAL_ALL);
55 easy_setopt(c, CURLOPT_HEADER, 1L);
56 easy_setopt(c, CURLOPT_URL, URL);
58 libtest_debug_config.nohex = 1;
59 libtest_debug_config.tracetime = 1;
60 easy_setopt(c, CURLOPT_DEBUGDATA, &libtest_debug_config);
61 easy_setopt(c, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
62 easy_setopt(c, CURLOPT_VERBOSE, 1L);
66 multi_add_handle(m, c);
69 struct timeval timeout;
70 fd_set fdread, fdwrite, fdexcep;
74 timeout.tv_usec = 100000L; /* 100 ms */
76 multi_perform(m, &running);
78 abort_on_test_timeout();
87 multi_fdset(m, &fdread, &fdwrite, &fdexcep, &maxfd);
89 /* At this point, maxfd is guaranteed to be greater or equal than -1. */
91 select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
93 abort_on_test_timeout();
96 curl_easy_getinfo(c, CURLINFO_CONNECT_TIME, &connect_time);
97 if (connect_time < dbl_epsilon) {
98 fprintf(stderr, "connect time is < epsilon\n");
99 res = TEST_ERR_MAJOR_BAD;
104 /* proper cleanup sequence - type PA */
106 curl_multi_remove_handle(m, c);
107 curl_multi_cleanup(m);
108 curl_easy_cleanup(c);
109 curl_global_cleanup();