quickjs-tart

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

CURLOPT_DNS_SHUFFLE_ADDRESSES.md (1781B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_DNS_SHUFFLE_ADDRESSES
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_DNS_CACHE_TIMEOUT (3)
      9   - CURLOPT_IPRESOLVE (3)
     10 Protocol:
     11   - All
     12 Added-in: 7.60.0
     13 ---
     14 
     15 # NAME
     16 
     17 CURLOPT_DNS_SHUFFLE_ADDRESSES - shuffle IP addresses for hostname
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SHUFFLE_ADDRESSES, long onoff);
     25 ~~~
     26 
     27 # DESCRIPTION
     28 
     29 Pass a long set to 1 to enable this option.
     30 
     31 When a name is resolved and more than one IP address is returned, this
     32 function shuffles the order of all returned addresses so that they are used in
     33 a random order. This is similar to the ordering behavior of the legacy
     34 gethostbyname function which is no longer used on most platforms.
     35 
     36 Addresses are not reshuffled if name resolution is completed using the DNS
     37 cache. CURLOPT_DNS_CACHE_TIMEOUT(3) can be used together with this
     38 option to reduce DNS cache timeout or disable caching entirely if frequent
     39 reshuffling is needed.
     40 
     41 Since the addresses returned are randomly reordered, the order is not in
     42 accordance with RFC 3484 or any other deterministic order that may be
     43 generated by the system's name resolution implementation. This may have
     44 performance impacts and may cause IPv4 to be used before IPv6 or vice versa.
     45 
     46 # DEFAULT
     47 
     48 0 (disabled)
     49 
     50 # %PROTOCOLS%
     51 
     52 # EXAMPLE
     53 
     54 ~~~c
     55 int main(void)
     56 {
     57   CURL *curl = curl_easy_init();
     58   if(curl) {
     59     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     60     curl_easy_setopt(curl, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
     61 
     62     curl_easy_perform(curl);
     63 
     64     /* always cleanup */
     65     curl_easy_cleanup(curl);
     66   }
     67 }
     68 ~~~
     69 
     70 # %AVAILABILITY%
     71 
     72 # RETURN VALUE
     73 
     74 CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.