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 * Source code in here hugely as reported in bug report 651464 by
32 * Christopher R. Palmer.
34 * Use multi interface to get document over proxy with bad port number.
35 * This caused the interface to "hang" in libcurl 7.10.2.
47 global_init(CURL_GLOBAL_ALL);
51 /* The point here is that there must not be anything running on the given
54 easy_setopt(c, CURLOPT_PROXY, libtest_arg2);
55 easy_setopt(c, CURLOPT_URL, URL);
56 easy_setopt(c, CURLOPT_VERBOSE, 1L);
60 multi_add_handle(m, c);
63 struct timeval interval;
69 fprintf(stderr, "curl_multi_perform()\n");
71 multi_perform(m, &running);
73 abort_on_test_timeout();
76 /* This is where this code is expected to reach */
78 CURLMsg *msg = curl_multi_info_read(m, &numleft);
79 fprintf(stderr, "Expected: not running\n");
81 res = TEST_ERR_SUCCESS; /* this is where we should be */
83 res = TEST_ERR_FAILURE; /* not correct */
86 fprintf(stderr, "running == %d\n", running);
92 fprintf(stderr, "curl_multi_fdset()\n");
94 multi_fdset(m, &rd, &wr, &exc, &maxfd);
96 /* At this point, maxfd is guaranteed to be greater or equal than -1. */
98 select_test(maxfd+1, &rd, &wr, &exc, &interval);
100 abort_on_test_timeout();
105 /* proper cleanup sequence - type PA */
107 curl_multi_remove_handle(m, c);
108 curl_multi_cleanup(m);
109 curl_easy_cleanup(c);
110 curl_global_cleanup();