CURLINFO_PROTOCOL(3)
π CURLINFO_PROTOCOL(3)
ok so real talk bestie, this one's a page out of the Library Functions Manual and it's about peeking at which URL scheme (a.k.a. protocol) your last transfer used. it's cute, it's short, it's also kinda deprecated π β more on that in a sec.
β¨ NAME β¨
CURLINFO_PROTOCOL β the URL scheme used in a transfer π
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p);
πΈ DESCRIPTION πΈ
okay so first things first, bestie: this option is deprecated, like genuinely. we strongly recommend you use CURLINFO_SCHEME(3) instead, because this one literally can't return all possible schemes β it's giving limited edition in a bad way π. also fyi, the scheme is sometimes also called the "protocol", which is why the name is Like That π.
the vibe: you pass a pointer to a long, and it receives the scheme used in the last transfer. the returned value gets set to one of these:
CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS,
CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP,
CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3,
CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS,
CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP,
CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP,
CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT
slay, that's the whole list, no cap π₯
π PROTOCOLS π
this functionality affects all supported protocols β every single one, periodt π
π EXAMPLE π
here's the moment you've been waiting for, a whole little main:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
result = curl_easy_perform(curl);
if(result == CURLE_OK) {
long scheme;
curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &scheme);
}
curl_easy_cleanup(curl);
}
}
look at her go πβ¨
π DEPRECATED π
deprecated since 7.85.0. yeah. she's retired. still iconic, but retired π«Ά
π§ AVAILABILITY π§
added in curl 7.52.0 β so if you're on something ancient, this is not gonna be your moment, ngl.
β RETURN VALUE β
curl_easy_getinfo(3) returns a CURLcode that tells you success or error.
CURLE_OK (0) means everything was OK π, and non-zero means an error occurred β go check libcurl-errors(3) for the details, iykyk.
π SEE ALSO π
ngl bestie, if you take one thing from this page: it's CURLINFO_SCHEME(3) o'clock. this one's deprecated, remember? π
ok bye love you, this page came from libcurl and it's dated 2026-10-12 β go forth and read your schemes responsibly πΈπ¦π
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms