1 /***************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 2013, 2017, Linus Nielsen Feltzing <linus@haxx.se>
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 https://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
39 struct curl_slist *slist = NULL, *slist2;
40 char *port = libtest_arg3;
41 char *address = libtest_arg2;
45 /* Create fake DNS entries for serverX.example.com for all handles */
46 for(i = 0; i < NUM_URLS; i++) {
47 snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
49 printf("%s\n", dnsentry);
50 slist2 = curl_slist_append(slist, dnsentry);
52 fprintf(stderr, "curl_slist_append() failed\n");
60 global_init(CURL_GLOBAL_ALL);
62 /* get an easy handle */
66 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
68 easy_setopt(curl, CURLOPT_HEADER, 1L);
70 easy_setopt(curl, CURLOPT_RESOLVE, slist);
72 easy_setopt(curl, CURLOPT_MAXCONNECTS, 3L);
74 /* get NUM_HANDLES easy handles */
75 for(i = 0; i < NUM_URLS; i++) {
77 snprintf(target_url, sizeof(target_url),
78 "http://server%d.example.com:%s/path/1510%04i",
80 target_url[sizeof(target_url) - 1] = '\0';
81 easy_setopt(curl, CURLOPT_URL, target_url);
83 res = curl_easy_perform(curl);
85 abort_on_test_timeout();
90 /* proper cleanup sequence - type PB */
92 curl_easy_cleanup(curl);
94 curl_slist_free_all(slist);
96 curl_global_cleanup();