CURLOPT_SSL_VERIFYHOST.3 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2015, 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.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_SSL_VERIFYHOST 3 "February 02, 2017" "libcurl 7.61.1" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_SSL_VERIFYHOST \- verify the certificate's name against host
  26. .SH SYNOPSIS
  27. #include <curl/curl.h>
  28. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYHOST, long verify);
  29. .SH DESCRIPTION
  30. Pass a long as parameter specifying what to \fIverify\fP.
  31. This option determines whether libcurl verifies that the server cert is for
  32. the server it is known as.
  33. When negotiating TLS and SSL connections, the server sends a certificate
  34. indicating its identity.
  35. When \fICURLOPT_SSL_VERIFYHOST(3)\fP is 2, that certificate must indicate that
  36. the server is the server to which you meant to connect, or the connection
  37. fails. Simply put, it means it has to have the same name in the certificate as
  38. is in the URL you operate against.
  39. Curl considers the server the intended one when the Common Name field or a
  40. Subject Alternate Name field in the certificate matches the host name in the
  41. URL to which you told Curl to connect.
  42. When the \fIverify\fP value is 1, \fIcurl_easy_setopt\fP will return an error
  43. and the option value will not be changed. It was previously (in 7.28.0 and
  44. earlier) a debug option of some sorts, but it is no longer supported due to
  45. frequently leading to programmer mistakes. Future versions will stop returning
  46. an error for 1 and just treat 1 and 2 the same.
  47. When the \fIverify\fP value is 0, the connection succeeds regardless of the
  48. names in the certificate. Use that ability with caution!
  49. The default value for this option is 2.
  50. This option controls checking the server's certificate's claimed identity.
  51. The server could be lying. To control lying, see
  52. \fICURLOPT_SSL_VERIFYPEER(3)\fP.
  53. .SH LIMITATIONS
  54. DarwinSSL: If \fIverify\fP value is 0, then SNI is also disabled. SNI is a TLS
  55. extension that sends the hostname to the server. The server may use that
  56. information to do such things as sending back a specific certificate for the
  57. hostname, or forwarding the request to a specific origin server. Some hostnames
  58. may be inaccessible if SNI is not sent.
  59. NSS: If \fICURLOPT_SSL_VERIFYPEER(3)\fP is zero,
  60. \fICURLOPT_SSL_VERIFYHOST(3)\fP is also set to zero and cannot be overridden.
  61. .SH DEFAULT
  62. 2
  63. .SH PROTOCOLS
  64. All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  65. .SH EXAMPLE
  66. .nf
  67. CURL *curl = curl_easy_init();
  68. if(curl) {
  69. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  70. /* Set the default value: strict name check please */
  71. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
  72. curl_easy_perform(curl);
  73. }
  74. .fi
  75. .SH AVAILABILITY
  76. If built TLS enabled.
  77. .SH RETURN VALUE
  78. Returns CURLE_OK if TLS is supported, and CURLE_UNKNOWN_OPTION if not.
  79. If 1 is set as argument, \fICURLE_BAD_FUNCTION_ARGUMENT\fP is returned.
  80. .SH "SEE ALSO"
  81. .BR CURLOPT_SSL_VERIFYPEER "(3), " CURLOPT_CAINFO "(3), "