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