CURLOPT_IPRESOLVE.3 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .\" generated by cd2nroff 0.1 from CURLOPT_IPRESOLVE.md
  2. .TH CURLOPT_IPRESOLVE 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_IPRESOLVE \- IP protocol version to use
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IPRESOLVE, long resolve);
  9. .fi
  10. .SH DESCRIPTION
  11. Allows an application to select what kind of IP addresses to use when
  12. establishing a connection or choosing one from the connection pool. This is
  13. interesting when using hostnames that resolve to more than one IP family.
  14. If the URL provided for a transfer contains a numerical IP version as a host
  15. name, this option does not override or prohibit libcurl from using that IP
  16. version.
  17. Available values for this option are:
  18. .IP CURL_IPRESOLVE_WHATEVER
  19. Default, can use addresses of all IP versions that your system allows.
  20. .IP CURL_IPRESOLVE_V4
  21. Uses only IPv4 addresses.
  22. .IP CURL_IPRESOLVE_V6
  23. Uses only IPv6 addresses.
  24. .SH DEFAULT
  25. CURL_IPRESOLVE_WHATEVER
  26. .SH PROTOCOLS
  27. This functionality affects all supported protocols
  28. .SH EXAMPLE
  29. .nf
  30. int main(void)
  31. {
  32. CURL *curl = curl_easy_init();
  33. if(curl) {
  34. CURLcode res;
  35. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  36. /* of all addresses example.com resolves to, only IPv6 ones are used */
  37. curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
  38. res = curl_easy_perform(curl);
  39. curl_easy_cleanup(curl);
  40. }
  41. }
  42. .fi
  43. .SH AVAILABILITY
  44. Added in curl 7.10.8
  45. .SH RETURN VALUE
  46. Returns CURLE_OK
  47. .SH SEE ALSO
  48. .BR CURLOPT_HTTP_VERSION (3),
  49. .BR CURLOPT_RESOLVE (3),
  50. .BR CURLOPT_SSLVERSION (3)