/***************************************************************************1* _ _ ____ _2* Project ___| | | | _ \| |3* / __| | | | |_) | |4* | (__| |_| | _ <| |___5* \___|\___/|_| \_\_____|6*7* Copyright (C) Daniel Stenberg, <[email protected]>, et al.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***************************************************************************/2324#include "test.h"2526#include "memdebug.h"2728static curl_socket_t opensocket(void *clientp,29curlsocktype purpose,30struct curl_sockaddr *address)31{32(void)purpose;33(void)address;34(void)clientp;35curl_mfprintf(stderr, "opensocket() returns CURL_SOCKET_BAD\n");36return CURL_SOCKET_BAD;37}3839CURLcode test(char *URL)40{41CURL *curl = NULL;42CURLcode res = CURLE_FAILED_INIT;43(void)URL;4445if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {46curl_mfprintf(stderr, "curl_global_init() failed\n");47return TEST_ERR_MAJOR_BAD;48}4950curl = curl_easy_init();51if(!curl) {52curl_mfprintf(stderr, "curl_easy_init() failed\n");53curl_global_cleanup();54return TEST_ERR_MAJOR_BAD;55}5657test_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");58test_setopt(curl, CURLOPT_VERBOSE, 1L);59test_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket);6061res = curl_easy_perform(curl);6263test_cleanup:6465curl_easy_cleanup(curl);66curl_global_cleanup();6768return res;69}707172