/***************************************************************************1* _ _ ____ _2* Project ___| | | | _ \| |3* / __| | | | |_) | |4* | (__| |_| | _ <| |___5* \___|\___/|_| \_\_____|6*7* Copyright (C) Linus Nielsen Feltzing <[email protected]>8*9* This software is licensed as described in the file COPYING, which10* you should have received as part of this distribution. The terms11* are also available at https://curl.se/docs/copyright.html.12*13* You may opt to use, copy, modify, merge, publish, distribute and/or sell14* copies of the Software, and permit persons to whom the Software is15* furnished to do so, under the terms of the COPYING file.16*17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY18* KIND, either express or implied.19*20* SPDX-License-Identifier: curl21*22***************************************************************************/23#include "first.h"2425#include "memdebug.h"2627static CURLcode test_lib1510(const char *URL)28{29static const int NUM_URLS = 4;3031CURLcode res = CURLE_OK;32CURL *curl = NULL;33int i;34char target_url[256];35char dnsentry[256];36struct curl_slist *slist = NULL, *slist2;37const char *port = libtest_arg3;38const char *address = libtest_arg2;3940(void)URL;4142/* Create fake DNS entries for serverX.example.com for all handles */43for(i = 0; i < NUM_URLS; i++) {44curl_msnprintf(dnsentry, sizeof(dnsentry),45"server%d.example.com:%s:%s", i + 1, port, address);46curl_mprintf("%s\n", dnsentry);47slist2 = curl_slist_append(slist, dnsentry);48if(!slist2) {49curl_mfprintf(stderr, "curl_slist_append() failed\n");50goto test_cleanup;51}52slist = slist2;53}5455start_test_timing();5657global_init(CURL_GLOBAL_ALL);5859/* get an easy handle */60easy_init(curl);6162/* go verbose */63easy_setopt(curl, CURLOPT_VERBOSE, 1L);64/* include headers */65easy_setopt(curl, CURLOPT_HEADER, 1L);6667easy_setopt(curl, CURLOPT_RESOLVE, slist);6869easy_setopt(curl, CURLOPT_MAXCONNECTS, 3L);7071/* get NUM_URLS easy handles */72for(i = 0; i < NUM_URLS; i++) {73/* specify target */74curl_msnprintf(target_url, sizeof(target_url),75"http://server%d.example.com:%s/path/1510%04i",76i + 1, port, i + 1);77target_url[sizeof(target_url) - 1] = '\0';78easy_setopt(curl, CURLOPT_URL, target_url);7980res = curl_easy_perform(curl);81if(res)82goto test_cleanup;8384abort_on_test_timeout();85}8687test_cleanup:8889/* proper cleanup sequence - type PB */9091curl_easy_cleanup(curl);9293curl_slist_free_all(slist);9495curl_global_cleanup();9697return res;98}99100101