CURLINFO_TLS_SESSION.3 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. .\" generated by cd2nroff 0.1 from CURLINFO_TLS_SESSION.md
  2. .TH CURLINFO_TLS_SESSION 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_TLS_SESSION \- get TLS session info
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SESSION,
  9. struct curl_tlssessioninfo **session);
  10. .fi
  11. .SH DESCRIPTION
  12. \fBThis option has been superseded\fP by \fICURLINFO_TLS_SSL_PTR(3)\fP which
  13. was added in 7.48.0. The only reason you would use this option instead is if
  14. you could be using a version of libcurl earlier than 7.48.0.
  15. This option is exactly the same as \fICURLINFO_TLS_SSL_PTR(3)\fP except in the
  16. case of OpenSSL. If the session \fIbackend\fP is CURLSSLBACKEND_OPENSSL the
  17. session \fIinternals\fP pointer varies depending on the option:
  18. \fICURLINFO_TLS_SESSION(3)\fP OpenSSL session \fIinternals\fP is \fBSSL_CTX \fP*.
  19. \fICURLINFO_TLS_SSL_PTR(3)\fP OpenSSL session \fIinternals\fP is \fBSSL \fP*.
  20. You can obtain an \fBSSL_CTX\fP pointer from an SSL pointer using OpenSSL
  21. function \fISSL_get_SSL_CTX(3)\fP. Therefore unless you need compatibility
  22. with older versions of libcurl use \fICURLINFO_TLS_SSL_PTR(3)\fP. Refer to
  23. that document for more information.
  24. .SH PROTOCOLS
  25. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  26. This option works only with the following TLS backends:
  27. GnuTLS and OpenSSL
  28. .SH EXAMPLE
  29. .nf
  30. int main(void)
  31. {
  32. CURL *curl = curl_easy_init();
  33. if(curl) {
  34. CURLcode res;
  35. struct curl_tlssessioninfo *tls;
  36. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  37. res = curl_easy_perform(curl);
  38. if(res)
  39. printf("error: %s\\n", curl_easy_strerror(res));
  40. curl_easy_getinfo(curl, CURLINFO_TLS_SESSION, &tls);
  41. curl_easy_cleanup(curl);
  42. }
  43. }
  44. .fi
  45. .SH DEPRECATED
  46. Deprecated since 7.48.0
  47. .SH AVAILABILITY
  48. Added in curl 7.34.0
  49. .SH RETURN VALUE
  50. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  51. .SH SEE ALSO
  52. .BR CURLINFO_TLS_SSL_PTR (3),
  53. .BR curl_easy_getinfo (3),
  54. .BR curl_easy_setopt (3)