quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

lib549.c (1956B)


      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 /* argv1 = URL
     25  * argv2 = proxy
     26  * argv3 = non-zero means ASCII transfer
     27  */
     28 
     29 #include "first.h"
     30 
     31 #include "memdebug.h"
     32 
     33 static CURLcode test_lib549(char *URL)
     34 {
     35   CURLcode res;
     36   CURL *curl;
     37 
     38   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     39     curl_mfprintf(stderr, "curl_global_init() failed\n");
     40     return TEST_ERR_MAJOR_BAD;
     41   }
     42 
     43   curl = curl_easy_init();
     44   if(!curl) {
     45     curl_mfprintf(stderr, "curl_easy_init() failed\n");
     46     curl_global_cleanup();
     47     return TEST_ERR_MAJOR_BAD;
     48   }
     49 
     50   test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
     51   test_setopt(curl, CURLOPT_URL, URL);
     52   test_setopt(curl, CURLOPT_PROXY_TRANSFER_MODE, 1L);
     53   test_setopt(curl, CURLOPT_VERBOSE, 1L);
     54   if(libtest_arg3) {
     55     /* enable ASCII/text mode */
     56     test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L);
     57   }
     58 
     59   res = curl_easy_perform(curl);
     60 
     61 test_cleanup:
     62 
     63   curl_easy_cleanup(curl);
     64   curl_global_cleanup();
     65 
     66   return res;
     67 }