1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_TLS_SESSION 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_TLS_SSL_PTR (3) 9 - curl_easy_getinfo (3) 10 - curl_easy_setopt (3) 11Protocol: 12 - TLS 13TLS-backend: 14 - OpenSSL 15 - GnuTLS 16Added-in: 7.34.0 17--- 18 19# NAME 20 21CURLINFO_TLS_SESSION - get TLS session info 22 23# SYNOPSIS 24 25~~~c 26#include <curl/curl.h> 27 28CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SESSION, 29 struct curl_tlssessioninfo **session); 30~~~ 31 32# DESCRIPTION 33 34**This option has been superseded** by CURLINFO_TLS_SSL_PTR(3) which 35was added in 7.48.0. The only reason you would use this option instead is if 36you could be using a version of libcurl earlier than 7.48.0. 37 38This option is exactly the same as CURLINFO_TLS_SSL_PTR(3) except in the 39case of OpenSSL. If the session *backend* is CURLSSLBACKEND_OPENSSL the 40session *internals* pointer varies depending on the option: 41 42CURLINFO_TLS_SESSION(3) OpenSSL session *internals* is **SSL_CTX ***. 43 44CURLINFO_TLS_SSL_PTR(3) OpenSSL session *internals* is **SSL ***. 45 46You can obtain an **SSL_CTX** pointer from an SSL pointer using OpenSSL 47function *SSL_get_SSL_CTX(3)*. Therefore unless you need compatibility 48with older versions of libcurl use CURLINFO_TLS_SSL_PTR(3). Refer to 49that document for more information. 50 51# %PROTOCOLS% 52 53# EXAMPLE 54 55~~~c 56int main(void) 57{ 58 CURL *curl = curl_easy_init(); 59 if(curl) { 60 CURLcode res; 61 struct curl_tlssessioninfo *tls; 62 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 63 res = curl_easy_perform(curl); 64 if(res) 65 printf("error: %s\n", curl_easy_strerror(res)); 66 curl_easy_getinfo(curl, CURLINFO_TLS_SESSION, &tls); 67 curl_easy_cleanup(curl); 68 } 69} 70~~~ 71 72# DEPRECATED 73 74Deprecated since 7.48.0 75 76# %AVAILABILITY% 77 78# RETURN VALUE 79 80Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 81