CURLINFO_HTTP_VERSION(3)
π CURLINFO_HTTP_VERSION(3) π
Okay bestie, welcome to the Library Functions Manual corner π
this is the whole vibe for CURLINFO_HTTP_VERSION β the HTTP version used in the transfer. No cap, it's giving βwhich HTTP flavor did we just speak?β energy β¨
πΈ NAME πΈ
CURLINFO_HTTP_VERSION β HTTP version used in the transfer π¦
π SYNOPSIS π
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_VERSION, long *p);
β¨ DESCRIPTION β¨
Pass a pointer to a long to receive the version used in the last http transfer done using this handle. The returned value is CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_2_0, CURL_HTTP_VERSION_3 or 0 if the version cannot be determined.
Like, you hand it a long *p and it fills your little long with the version info π β unless it literally cannot figure it out, in which case you get 0. That's the whole deal, periodt.
π¦ PROTOCOLS π¦
This functionality affects http only.
π₯ EXAMPLE π₯
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
result = curl_easy_perform(curl);
if(result == CURLE_OK) {
long http_version;
curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, &http_version);
}
curl_easy_cleanup(curl);
}
}
β AVAILABILITY β
Added in curl 7.50.0 π«Ά
π RETURN VALUE π
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3) π
π SEE ALSO π
That's the tea, bestie π this page is from libcurl, dated 2026-10-12, and it's literally CURLINFO_HTTP_VERSION(3) πβ¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms