lib564.c (2249B)
1 /*************************************************************************** 2 * _ _ ____ _ 3 * Project ___| | | | _ \| | 4 * / __| | | | |_) | | 5 * | (__| |_| | _ <| |___ 6 * \___|\___/|_| \_\_____| 7 * 8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 9 * 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.se/docs/copyright.html. 13 * 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. 17 * 18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 * KIND, either express or implied. 20 * 21 * SPDX-License-Identifier: curl 22 * 23 ***************************************************************************/ 24 #include "first.h" 25 26 #include "memdebug.h" 27 28 static CURLcode test_lib564(char *URL) 29 { 30 CURLcode res = CURLE_OK; 31 CURL *curl = NULL; 32 int running; 33 CURLM *m = NULL; 34 35 start_test_timing(); 36 37 global_init(CURL_GLOBAL_ALL); 38 39 easy_init(curl); 40 41 easy_setopt(curl, CURLOPT_URL, URL); 42 easy_setopt(curl, CURLOPT_VERBOSE, 1L); 43 easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); 44 easy_setopt(curl, CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4); 45 46 multi_init(m); 47 48 multi_add_handle(m, curl); 49 50 curl_mfprintf(stderr, "Start at URL 0\n"); 51 52 for(;;) { 53 struct timeval interval; 54 fd_set rd, wr, exc; 55 int maxfd = -99; 56 57 interval.tv_sec = 1; 58 interval.tv_usec = 0; 59 60 multi_perform(m, &running); 61 62 abort_on_test_timeout(); 63 64 if(!running) 65 break; /* done */ 66 67 FD_ZERO(&rd); 68 FD_ZERO(&wr); 69 FD_ZERO(&exc); 70 71 multi_fdset(m, &rd, &wr, &exc, &maxfd); 72 73 /* At this point, maxfd is guaranteed to be greater or equal than -1. */ 74 75 select_test(maxfd + 1, &rd, &wr, &exc, &interval); 76 77 abort_on_test_timeout(); 78 } 79 80 test_cleanup: 81 82 /* undocumented cleanup sequence - type UB */ 83 84 curl_easy_cleanup(curl); 85 curl_multi_cleanup(m); 86 curl_global_cleanup(); 87 88 return res; 89 }