1CURLINFO_HTTP_VERSION(3)   curl_easy_getinfo options  CURLINFO_HTTP_VERSION(3)
2
3
4

NAME

6       CURLINFO_HTTP_VERSION - get the http version used in the connection
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_VERSION, long *p);
12

DESCRIPTION

14       Pass  a  pointer to a long to receive the version used in the last http
15       connection.   The  returned  value   will   be   CURL_HTTP_VERSION_1_0,
16       CURL_HTTP_VERSION_1_1,  CURL_HTTP_VERSION_2_0, CURL_HTTP_VERSION_3 or 0
17       if the version cannot be determined.
18

PROTOCOLS

20       HTTP
21

EXAMPLE

23       CURL *curl = curl_easy_init();
24       if(curl) {
25         CURLcode res;
26         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
27         res = curl_easy_perform(curl);
28         if(res == CURLE_OK) {
29           long http_version;
30           curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, &http_version);
31         }
32         curl_easy_cleanup(curl);
33       }
34

AVAILABILITY

36       Added in 7.50.0
37

RETURN VALUE

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

SEE ALSO

43       CURLINFO_RESPONSE_CODE(3), curl_easy_getinfo(3), curl_easy_setopt(3),
44
45
46
47libcurl 7.85.0                   May 17, 2022         CURLINFO_HTTP_VERSION(3)
Impressum