GNURLINFO_TLS_SESSION(3)
β¨ GNURLINFO_TLS_SESSION β¨
okay so bestie, we need to talk about this lil manual page from the gnurl world π
it's giving legacy energy but we still gotta know it, y'know?
π NAME π
CURLINFO_TLS_SESSION β get TLS session info, bestie! it's literally right there in the name π¦
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SESSION,
struct curl_tlssessioninfo **session);
π DESCRIPTION π
okay so first thing you need to know: this option has been totally superseded by CURLINFO_TLS_SSL_PTR(3) which showed up in 7.48.0. like, it's the newer cooler version β¨ the only reason you'd ever reach for this one instead is if you're stuck with a version of libcurl earlier than 7.48.0. and we respect the retro vibes but alsoβ¦ upgrade if u can π
this option is exactly the same as CURLINFO_TLS_SSL_PTR(3) except in the case of OpenSSL. and here's where it gets spicy π₯ β if the session backend is CURLSSLBACKEND_OPENSSL, the session internals pointer varies depending on which option you use:
CURLINFO_TLS_SESSIONβ OpenSSL session internals isSSL_CTX *.CURLINFO_TLS_SSL_PTRβ OpenSSL session internals isSSL *.
so here's the tea β β you can obtain an SSL_CTX pointer from an SSL pointer using the OpenSSL function SSL_get_SSL_CTX. therefore, unless you need compatibility with older versions of libcurl, use CURLINFO_TLS_SSL_PTR(3). that's the main character energy option π refer to that document for more info, bestie π
π¦ PROTOCOLS π¦
All TLS-based β that's it, that's the whole vibe π
β EXAMPLE β
here's how you actually use it, no cap:
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
struct curl_tlssessioninfo *tls;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_TLS_SESSION, &tls);
curl_easy_cleanup(curl);
}
π§ AVAILABILITY π§
Added in 7.34.0, and supported OpenSSL, GnuTLS, NSS and gskit only up until 7.48.0 was released. so yeah, it had its moment π
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. simple as that π«Ά
π SEE ALSO π
and that's the whole page, bestie! β¨ this lil manual page you've been reading is from libcurl 7.44.0 and it's dated 12 Sep 2015 β absolute vintage icon behavior honestly π go forth and use CURLINFO_TLS_SSL_PTR(3) like I told you π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms