/***************************************************************************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_lib1500(const char *URL)28{29CURL *curl = NULL;30CURLM *multi = NULL;31int still_running;32CURLcode i = TEST_ERR_FAILURE;33CURLcode res = CURLE_OK;34CURLMsg *msg;3536start_test_timing();3738global_init(CURL_GLOBAL_ALL);3940multi_init(multi);4142easy_init(curl);4344easy_setopt(curl, CURLOPT_URL, URL);45easy_setopt(curl, CURLOPT_HEADER, 1L);4647multi_add_handle(multi, curl);4849multi_perform(multi, &still_running);5051abort_on_test_timeout();5253while(still_running) {54CURLMcode mres;55int num;56mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);57if(mres != CURLM_OK) {58curl_mprintf("curl_multi_wait() returned %d\n", mres);59res = TEST_ERR_MAJOR_BAD;60goto test_cleanup;61}6263abort_on_test_timeout();6465multi_perform(multi, &still_running);6667abort_on_test_timeout();68}6970msg = curl_multi_info_read(multi, &still_running);71if(msg)72/* this should now contain a result code from the easy handle,73get it */74i = msg->data.result;7576test_cleanup:7778/* undocumented cleanup sequence - type UA */7980curl_multi_cleanup(multi);81curl_easy_cleanup(curl);82curl_global_cleanup();8384if(res)85i = res;8687return i; /* return the final return code */88}899091