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

NAME

6       CURLINFO_SCHEME  -  get the URL scheme (sometimes called protocol) used
7       in the connection
8

SYNOPSIS

10       #include <curl/curl.h>
11
12       CURLcode   curl_easy_getinfo(CURL   *handle,   CURLINFO_SCHEME,    char
13       **scheme);
14

DESCRIPTION

16       Pass  a pointer to a char pointer to receive the pointer to a null-ter‐
17       minated string holding the URL scheme used for the most recent  connec‐
18       tion done with this CURL handle.
19
20       The  scheme pointer will be NULL or pointing to private memory you MUST
21       NOT free - it gets freed when you call curl_easy_cleanup(3) on the cor‐
22       responding CURL handle.
23

PROTOCOLS

25       All
26

EXAMPLE

28       CURL *curl = curl_easy_init();
29       if(curl) {
30         CURLcode res;
31         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
32         res = curl_easy_perform(curl);
33         if(res == CURLE_OK) {
34           char *scheme = NULL;
35           curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
36           if(scheme)
37             printf("scheme: %s\n", scheme); /* scheme: HTTP */
38         }
39         curl_easy_cleanup(curl);
40       }
41

AVAILABILITY

43       Added in 7.52.0
44

RETURN VALUE

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

SEE ALSO

50       CURLINFO_RESPONSE_CODE(3), curl_easy_getinfo(3), curl_easy_setopt(3),
51
52
53
54libcurl 7.76.1                 November 04, 2020            CURLINFO_SCHEME(3)
Impressum