CURLINFO_SSL_VERIFYRESULT.3 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. .\" generated by cd2nroff 0.1 from CURLINFO_SSL_VERIFYRESULT.md
  2. .TH CURLINFO_SSL_VERIFYRESULT 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_SSL_VERIFYRESULT \- get the result of the certificate verification
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SSL_VERIFYRESULT,
  9. long *result);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a long to receive the result of the server SSL certificate
  13. verification that was requested (using the \fICURLOPT_SSL_VERIFYPEER(3)\fP
  14. option).
  15. 0 is a positive result. Non\-zero is an error.
  16. .SH PROTOCOLS
  17. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  18. This option works only with the following TLS backends:
  19. GnuTLS and OpenSSL
  20. .SH EXAMPLE
  21. .nf
  22. int main(void)
  23. {
  24. CURL *curl = curl_easy_init();
  25. if(curl) {
  26. CURLcode res;
  27. long verifyresult;
  28. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  29. res = curl_easy_perform(curl);
  30. if(res) {
  31. printf("error: %s\\n", curl_easy_strerror(res));
  32. curl_easy_cleanup(curl);
  33. return 1;
  34. }
  35. res = curl_easy_getinfo(curl, CURLINFO_SSL_VERIFYRESULT,
  36. &verifyresult);
  37. if(!res) {
  38. printf("The peer verification said %s\\n",
  39. (verifyresult ? "bad" : "fine"));
  40. }
  41. curl_easy_cleanup(curl);
  42. }
  43. }
  44. .fi
  45. .SH AVAILABILITY
  46. Added in curl 7.5
  47. .SH RETURN VALUE
  48. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  49. .SH SEE ALSO
  50. .BR CURLINFO_PROXY_SSL_VERIFYRESULT (3),
  51. .BR curl_easy_getinfo (3),
  52. .BR curl_easy_setopt (3)