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

DESCRIPTION

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

PROTOCOLS

24       All
25

EXAMPLE

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

AVAILABILITY

42       Added in 7.52.0
43

RETURN VALUE

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

SEE ALSO

49       CURLINFO_RESPONSE_CODE(3), curl_easy_getinfo(3), curl_easy_setopt(3),
50
51
52
53libcurl 7.82.0                 November 26, 2021            CURLINFO_SCHEME(3)
Impressum