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 ***************************************************************************/
28 #define TEST_HANG_TIMEOUT 60 * 1000
31 * Simply download a HTTPS file!
33 * This test was added after the HTTPS-using-multi-interface with OpenSSL
34 * regression of 7.19.1 to hopefully prevent this embarassing mistake from
35 * appearing again... Unfortunately the bug wasn't triggered by this test,
36 * which presumably is because the connect to a local server is too
37 * fast/different compared to the real/distant servers we saw the bug happen
42 CURL *http_handle = NULL;
43 CURLM *multi_handle = NULL;
46 int still_running; /* keep number of running handles */
51 ** curl_global_init called indirectly from curl_easy_init.
54 easy_init(http_handle);
57 easy_setopt(http_handle, CURLOPT_URL, URL);
58 easy_setopt(http_handle, CURLOPT_HEADER, 1L);
59 easy_setopt(http_handle, CURLOPT_SSL_VERIFYPEER, 0L);
60 easy_setopt(http_handle, CURLOPT_SSL_VERIFYHOST, 0L);
62 /* init a multi stack */
63 multi_init(multi_handle);
65 /* add the individual transfers */
66 multi_add_handle(multi_handle, http_handle);
68 /* we start some action by calling perform right away */
69 multi_perform(multi_handle, &still_running);
71 abort_on_test_timeout();
73 while(still_running) {
74 struct timeval timeout;
85 /* set a suitable timeout to play around with */
89 /* get file descriptors from the transfers */
90 multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
92 /* At this point, maxfd is guaranteed to be greater or equal than -1. */
94 select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
96 abort_on_test_timeout();
98 /* timeout or readable/writable sockets */
99 multi_perform(multi_handle, &still_running);
101 abort_on_test_timeout();
106 /* undocumented cleanup sequence - type UA */
108 curl_multi_cleanup(multi_handle);
109 curl_easy_cleanup(http_handle);
110 curl_global_cleanup();