CURLOPT_DOH_SSL_VERIFYHOST.3 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. .\" generated by cd2nroff 0.1 from CURLOPT_DOH_SSL_VERIFYHOST.md
  2. .TH CURLOPT_DOH_SSL_VERIFYHOST 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_DOH_SSL_VERIFYHOST \- verify the hostname in the DoH SSL certificate
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYHOST,
  9. long verify);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a long set to 2L as asking curl to \fIverify\fP the DoH (DNS\-over\-HTTPS)
  13. server\(aqs certificate name fields against the hostname.
  14. This option is the DoH equivalent of \fICURLOPT_SSL_VERIFYHOST(3)\fP and
  15. only affects requests to the DoH server.
  16. When \fICURLOPT_DOH_SSL_VERIFYHOST(3)\fP is 2, the SSL certificate provided by
  17. the DoH server must indicate that the server name is the same as the server
  18. name to which you meant to connect to, or the connection fails.
  19. Curl considers the DoH server the intended one when the Common Name field or a
  20. Subject Alternate Name field in the certificate matches the hostname in the
  21. DoH URL to which you told Curl to connect.
  22. When the \fIverify\fP value is set to 1L it is treated the same as 2L. However
  23. for consistency with the other \fIVERIFYHOST\fP options we suggest use 2 and
  24. not 1.
  25. When the \fIverify\fP value is set to 0L, the connection succeeds regardless of
  26. the names used in the certificate. Use that ability with caution!
  27. See also \fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP to verify the digital signature
  28. of the DoH server certificate.
  29. .SH DEFAULT
  30. 2
  31. .SH PROTOCOLS
  32. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  33. All TLS backends support this option.
  34. .SH EXAMPLE
  35. .nf
  36. int main(void)
  37. {
  38. CURL *curl = curl_easy_init();
  39. if(curl) {
  40. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  41. curl_easy_setopt(curl, CURLOPT_DOH_URL,
  42. "https://cloudflare-dns.com/dns-query");
  43. /* Disable host name verification of the DoH server */
  44. curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYHOST, 0L);
  45. curl_easy_perform(curl);
  46. }
  47. }
  48. .fi
  49. .SH AVAILABILITY
  50. Added in curl 7.76.0
  51. .SH RETURN VALUE
  52. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  53. .SH SEE ALSO
  54. .BR CURLOPT_DOH_SSL_VERIFYPEER (3),
  55. .BR CURLOPT_PROXY_SSL_VERIFYHOST (3),
  56. .BR CURLOPT_PROXY_SSL_VERIFYPEER (3),
  57. .BR CURLOPT_SSL_VERIFYHOST (3),
  58. .BR CURLOPT_SSL_VERIFYPEER (3)