| 1 |
.\" ************************************************************************** |
| 2 |
.\" * _ _ ____ _ |
| 3 |
.\" * Project ___| | | | _ \| | |
| 4 |
.\" * / __| | | | |_) | | |
| 5 |
.\" * | (__| |_| | _ <| |___ |
| 6 |
.\" * \___|\___/|_| \_\_____| |
| 7 |
.\" * |
| 8 |
.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <[email protected]>, 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.haxx.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 |
.\" ************************************************************************** |
| 22 |
.\" |
| 23 |
.TH CURLOPT_DNS_SHUFFLE_ADDRESSES 3 "3 March 2018" "libcurl 7.60.0" "curl_easy_setopt options" |
| 24 |
.SH NAME |
| 25 |
CURLOPT_DNS_SHUFFLE_ADDRESSES \- Shuffle addresses when a hostname returns more than one |
| 26 |
.SH SYNOPSIS |
| 27 |
.nf |
| 28 |
#include <curl/curl.h> |
| 29 |
|
| 30 |
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SHUFFLE_ADDRESSES, long onoff); |
| 31 |
.fi |
| 32 |
.SH DESCRIPTION |
| 33 |
When a name is resolved and more than one IP address is returned, shuffle the |
| 34 |
order of all returned addresses so that they will be used in a random order. |
| 35 |
This is similar to the ordering behavior of gethostbyname which is no longer |
| 36 |
used on most platforms. |
| 37 |
|
| 38 |
Addresses will not be reshuffled if a name resolution is completed using the |
| 39 |
DNS cache. \fICURLOPT_DNS_CACHE_TIMEOUT(3)\fP can be used together with this |
| 40 |
option to reduce DNS cache timeout or disable caching entirely if frequent |
| 41 |
reshuffling is needed. |
| 42 |
|
| 43 |
Since the addresses returned will be reordered randomly, their order will not |
| 44 |
be in accordance with RFC 3484 or any other deterministic order that may be |
| 45 |
generated by the system's name resolution implementation. This may have |
| 46 |
performance impacts and may cause IPv4 to be used before IPv6 or vice versa. |
| 47 |
.SH DEFAULT |
| 48 |
0 (disabled) |
| 49 |
.SH PROTOCOLS |
| 50 |
All |
| 51 |
.SH EXAMPLE |
| 52 |
.nf |
| 53 |
CURL *curl = curl_easy_init(); |
| 54 |
if(curl) { |
| 55 |
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); |
| 56 |
curl_easy_setopt(curl, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L); |
| 57 |
|
| 58 |
curl_easy_perform(curl); |
| 59 |
|
| 60 |
/* always cleanup */ |
| 61 |
curl_easy_cleanup(curl); |
| 62 |
} |
| 63 |
.fi |
| 64 |
.SH AVAILABILITY |
| 65 |
Added in 7.60.0 |
| 66 |
.SH RETURN VALUE |
| 67 |
CURLE_OK or an error such as CURLE_UNKNOWN_OPTION. |
| 68 |
.SH "SEE ALSO" |
| 69 |
.BR CURLOPT_DNS_CACHE_TIMEOUT "(3), " CURLOPT_IPRESOLVE "(3), " |