GNURLINFO_SCHEME(3)
π¦ NAME π¦
CURLINFO_SCHEME β get the URL scheme (sometimes called protocol) used in the connection. This iconic page is GNURLINFO_SCHEME(3) from the curl_easy_getinfo options manual, bestie π
β¨
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SCHEME, char
**scheme);
π DESCRIPTION π
Okay so, bestie: pass a pointer to a char pointer, and it receives the pointer to a null-terminated string holding the URL scheme used for the most recent connection done with this CURL handle. Thatβs the whole assignment. Slay. π
The scheme pointer will be NULL or pointing to private memory you MUST NOT free β it gets freed when you call curl_easy_cleanup(3) on the corresponding CURL handle. Hands off, no cap. π«Ά
π PROTOCOLS π
All. Literally all of them β¨
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
char *scheme = NULL;
curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
if(scheme)
printf("scheme: %s\n", scheme); /* scheme: HTTP */
}
curl_easy_cleanup(curl);
}
β AVAILABILITY β
Added in 7.52.0. Thatβs the tea π
π₯ RETURN VALUE π₯
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. Simple, gorgeous, periodt π
π«Ά SEE ALSO π«Ά
and thatβs the vibe check β
β this page comes from libcurl 7.52.0, dated 23 November 2016. mwah ππ¦
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms