CURLOPT_DOH_URL.3 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, 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.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. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_DOH_URL 3 "January 02, 2023" "libcurl 7.88.1" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_DOH_URL \- provide the DNS-over-HTTPS URL
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_URL, char *URL);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass in a pointer to a \fIURL\fP for the DoH server to use for name
  35. resolving. The parameter should be a char * to a null-terminated string which
  36. must be URL-encoded in the following format: "https://host:port/path". It MUST
  37. specify an HTTPS URL.
  38. libcurl does not validate the syntax or use this variable until the transfer is
  39. issued. Even if you set a crazy value here, \fIcurl_easy_setopt(3)\fP will
  40. still return \fICURLE_OK\fP.
  41. curl sends POST requests to the given DNS-over-HTTPS URL.
  42. To find the DoH server itself, which might be specified using a name, libcurl
  43. will use the default name lookup function. You can bootstrap that by providing
  44. the address for the DoH server with \fICURLOPT_RESOLVE(3)\fP.
  45. Disable DoH use again by setting this option to NULL.
  46. .SH "INHERIT OPTIONS"
  47. DoH lookups use SSL and some SSL settings from your transfer are inherited,
  48. like \fICURLOPT_SSL_CTX_FUNCTION(3)\fP.
  49. The hostname and peer certificate verification settings are not inherited but
  50. can be controlled separately via \fICURLOPT_DOH_SSL_VERIFYHOST(3)\fP and
  51. \fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP.
  52. A set \fICURLOPT_OPENSOCKETFUNCTION(3)\fP callback is not inherited.
  53. .SH "KNOWN BUGS"
  54. Even when DoH is set to be used with this option, there are still some name
  55. resolves that are performed without it, using the default name resolver
  56. mechanism. This includes name resolves done for \fICURLOPT_INTERFACE(3)\fP,
  57. \fICURLOPT_FTPPORT(3)\fP, a proxy type set to \fBCURLPROXY_SOCKS4\fP or
  58. \fBCURLPROXY_SOCKS5\fP and probably some more.
  59. .SH DEFAULT
  60. NULL - there is no default DoH URL. If this option is not set, libcurl will use
  61. the default name resolver.
  62. .SH PROTOCOLS
  63. All
  64. .SH EXAMPLE
  65. .nf
  66. CURL *curl = curl_easy_init();
  67. if(curl) {
  68. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  69. curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://dns.example.com");
  70. curl_easy_perform(curl);
  71. }
  72. .fi
  73. .SH AVAILABILITY
  74. Added in 7.62.0
  75. .SH RETURN VALUE
  76. Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insufficient
  77. heap space.
  78. Note that \fIcurl_easy_setopt(3)\fP will not immediately parse the given
  79. string so when given a bad DoH URL, libcurl might not detect the problem until
  80. it later tries to resolve a name with it.
  81. .SH "SEE ALSO"
  82. .BR CURLOPT_VERBOSE "(3), " CURLOPT_RESOLVE "(3), "