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
12       *p);
13

DESCRIPTION

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

PROTOCOLS

21       HTTP
22

EXAMPLE

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

AVAILABILITY

37       Added in 7.50.0
38

RETURN VALUE

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

SEE ALSO

44       CURLINFO_RESPONSE_CODE(3), curl_easy_getinfo(3), curl_easy_setopt(3),
45
46
47
48libcurl 7.76.1                 November 04, 2020      CURLINFO_HTTP_VERSION(3)
Impressum