quickjs-tart

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

curl_easy_init.md (1977B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: curl_easy_init
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - curl_easy_cleanup (3)
      9   - curl_easy_duphandle (3)
     10   - curl_easy_perform (3)
     11   - curl_easy_reset (3)
     12   - curl_global_init (3)
     13   - curl_multi_init (3)
     14 Protocol:
     15   - All
     16 Added-in: 7.1
     17 ---
     18 
     19 # NAME
     20 
     21 curl_easy_init - create an easy handle
     22 
     23 # SYNOPSIS
     24 
     25 ~~~c
     26 #include <curl/curl.h>
     27 
     28 CURL *curl_easy_init();
     29 ~~~
     30 
     31 # DESCRIPTION
     32 
     33 This function allocates and returns an easy handle. Such a handle is used as
     34 input to other functions in the easy interface. This call must have a
     35 corresponding call to curl_easy_cleanup(3) when the operation is complete.
     36 
     37 The easy handle is used to hold and control a single network transfer. It is
     38 encouraged to reuse easy handles for repeated transfers.
     39 
     40 An alternative way to get a new easy handle is to duplicate an already
     41 existing one with curl_easy_duphandle(3), which has the upside that it gets
     42 all the options that were set in the source handle set in the new copy as
     43 well.
     44 
     45 If you did not already call curl_global_init(3) before calling this function,
     46 curl_easy_init(3) does it automatically. This can be lethal in multi-threaded
     47 cases for platforms where curl_global_init(3) is not thread-safe, and it may
     48 then result in resource problems because there is no corresponding cleanup.
     49 
     50 You are strongly advised to not allow this automatic behavior, by calling
     51 curl_global_init(3) yourself properly. See the description in libcurl(3) of
     52 global environment requirements for details of how to use this function.
     53 
     54 # %PROTOCOLS%
     55 
     56 # EXAMPLE
     57 
     58 ~~~c
     59 int main(void)
     60 {
     61   CURL *curl = curl_easy_init();
     62   if(curl) {
     63     CURLcode res;
     64     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     65     res = curl_easy_perform(curl);
     66     curl_easy_cleanup(curl);
     67   }
     68 }
     69 ~~~
     70 
     71 # %AVAILABILITY%
     72 
     73 # RETURN VALUE
     74 
     75 If this function returns NULL, something went wrong and you cannot use the
     76 other curl functions.