GNURLINFO_HTTP_VERSION(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… GNURLINFO_HTTP_VERSION(3) πŸ’…

🌸 NAME 🌸

CURLINFO_HTTP_VERSION β€” get the http version used in the connection.

okay so this page lives in the curl_easy_getinfo options manual, and it’s literally your little vibe check for which http version showed up. no cap.


✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_VERSION, long
*p);

πŸ¦‹ DESCRIPTION πŸ¦‹

You pass in a pointer to a long, bestie, and it receives the version used in the last http connection. The returned value will be CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_2_0, CURL_HTTP_VERSION_3 or 0 if the version can’t be determined.

like, that’s the whole tea. πŸ’–

🌈 PROTOCOLS 🌈

HTTP

πŸŽ€ EXAMPLE πŸŽ€

CURL *curl = curl_easy_init();
if(curl) {
  CURLcode res;
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  res = curl_easy_perform(curl);
  if(res == CURLE_OK) {
    long http_version;
    curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, &http_version);
  }
  curl_easy_cleanup(curl);
}

πŸ‘‘ AVAILABILITY πŸ‘‘

Added in 7.50.0.

πŸ”₯ RETURN VALUE πŸ”₯

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.

🫢 SEE ALSO 🫢


xoxo, bestie πŸ’– source/version: libcurl 7.50.0; date: 11 May 2016; page: GNURLINFO_HTTP_VERSION(3). slay and goodbye 🫢

πŸ“¦ where this page comes from