/***************************************************************************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***************************************************************************/23#include "first.h"2425#include "memdebug.h"2627static CURLcode test_lib1552(const char *URL)28{29CURL *curl = NULL;30CURLM *multi = NULL;31int still_running;32CURLcode i = CURLE_OK;33CURLcode res = CURLE_OK;34CURLMsg *msg;35int counter = 3;3637start_test_timing();3839global_init(CURL_GLOBAL_ALL);4041multi_init(multi);4243easy_init(curl);4445easy_setopt(curl, CURLOPT_URL, URL);46easy_setopt(curl, CURLOPT_HEADER, 1L);47easy_setopt(curl, CURLOPT_VERBOSE, 1L);48easy_setopt(curl, CURLOPT_USERPWD, "u:s");4950multi_add_handle(multi, curl);5152multi_perform(multi, &still_running);5354abort_on_test_timeout();5556while(still_running && counter--) {57CURLMcode mres;58int num;59mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);60if(mres != CURLM_OK) {61curl_mprintf("curl_multi_wait() returned %d\n", mres);62res = TEST_ERR_MAJOR_BAD;63goto test_cleanup;64}6566abort_on_test_timeout();6768multi_perform(multi, &still_running);6970abort_on_test_timeout();71}7273msg = curl_multi_info_read(multi, &still_running);74if(msg)75/* this should now contain a result code from the easy handle,76get it */77i = msg->data.result;7879test_cleanup:8081/* undocumented cleanup sequence - type UA */8283curl_multi_cleanup(multi);84curl_easy_cleanup(curl);85curl_global_cleanup();8687if(res)88i = res;8990return i; /* return the final return code */91}929394