1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_SCHEME 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_EFFECTIVE_URL (3) 9 - CURLINFO_PROTOCOL (3) 10 - CURLINFO_RESPONSE_CODE (3) 11 - curl_easy_getinfo (3) 12 - curl_easy_setopt (3) 13--- 14 15# NAME 16 17CURLINFO_SCHEME - get the URL scheme (sometimes called protocol) used in the connection 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SCHEME, char **scheme); 25~~~ 26 27# DESCRIPTION 28 29Pass a pointer to a char pointer to receive the pointer to a null-terminated 30string holding the URL scheme used for the most recent connection done with 31this CURL **handle**. 32 33The **scheme** pointer is NULL or points to private memory. You MUST NOT 34free - it gets freed when you call curl_easy_cleanup(3) on the 35corresponding CURL handle. 36 37# PROTOCOLS 38 39All 40 41# EXAMPLE 42 43~~~c 44int main(void) 45{ 46 CURL *curl = curl_easy_init(); 47 if(curl) { 48 CURLcode res; 49 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 50 res = curl_easy_perform(curl); 51 if(res == CURLE_OK) { 52 char *scheme = NULL; 53 curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme); 54 if(scheme) 55 printf("scheme: %s\n", scheme); /* scheme: HTTP */ 56 } 57 curl_easy_cleanup(curl); 58 } 59} 60~~~ 61 62# AVAILABILITY 63 64Added in 7.52.0 65 66# RETURN VALUE 67 68Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 69