CURLOPT_DOH_URL.3 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. .\" generated by cd2nroff 0.1 from CURLOPT_DOH_URL.md
  2. .TH CURLOPT_DOH_URL 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_DOH_URL \- provide the DNS\-over\-HTTPS URL
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_URL, char *URL);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass in a pointer to a \fIURL\fP for the DoH server to use for name resolving. The
  12. parameter should be a char pointer to a null\-terminated string which must be a
  13. valid and correct HTTPS URL.
  14. libcurl does not validate the syntax or use this variable until the transfer
  15. is issued. Even if you set a crazy value here, \fIcurl_easy_setopt(3)\fP still
  16. returns \fICURLE_OK\fP.
  17. curl sends POST requests to the given DNS\-over\-HTTPS URL.
  18. To find the DoH server itself, which might be specified using a name, libcurl
  19. uses the default name lookup function. You can bootstrap that by providing the
  20. address for the DoH server with \fICURLOPT_RESOLVE(3)\fP.
  21. Disable DoH use again by setting this option to NULL.
  22. .SH INHERIT OPTIONS
  23. DoH lookups use SSL and some SSL settings from your transfer are inherited,
  24. like \fICURLOPT_SSL_CTX_FUNCTION(3)\fP.
  25. The hostname and peer certificate verification settings are not inherited but
  26. can be controlled separately via \fICURLOPT_DOH_SSL_VERIFYHOST(3)\fP and
  27. \fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP.
  28. A set \fICURLOPT_OPENSOCKETFUNCTION(3)\fP callback is not inherited.
  29. .SH KNOWN BUGS
  30. Even when DoH is set to be used with this option, there are still some name
  31. resolves that are performed without it, using the default name resolver
  32. mechanism. This includes name resolves done for \fICURLOPT_INTERFACE(3)\fP,
  33. \fICURLOPT_FTPPORT(3)\fP, a proxy type set to \fBCURLPROXY_SOCKS4\fP or
  34. \fBCURLPROXY_SOCKS5\fP and probably some more.
  35. .SH DEFAULT
  36. NULL
  37. .SH PROTOCOLS
  38. This functionality affects all supported protocols
  39. .SH EXAMPLE
  40. .nf
  41. int main(void)
  42. {
  43. CURL *curl = curl_easy_init();
  44. if(curl) {
  45. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  46. curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://dns.example.com");
  47. curl_easy_perform(curl);
  48. }
  49. }
  50. .fi
  51. .SH AVAILABILITY
  52. Added in curl 7.62.0
  53. .SH RETURN VALUE
  54. Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insufficient
  55. heap space.
  56. Note that \fIcurl_easy_setopt(3)\fP does immediately parse the given string so
  57. when given a bad DoH URL, libcurl might not detect the problem until it later
  58. tries to resolve a name with it.
  59. .SH SEE ALSO
  60. .BR CURLOPT_DNS_CACHE_TIMEOUT (3),
  61. .BR CURLOPT_RESOLVE (3),
  62. .BR CURLOPT_VERBOSE (3)