GNURLINFO_PROTOCOL(3)
π GNURLINFO_PROTOCOL(3) π
okay so this iconic page comes from the curl_easy_getinfo options manual, and it's here to explain CURLINFO_PROTOCOL to you, bestie. no cap, it's a tiny one. π¦
β¨ NAME β¨
CURLINFO_PROTOCOL β get the protocol used in the connection. that's the whole vibe. π
π SYNOPSIS π
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p);
πΈ DESCRIPTION πΈ
okay so literally pass a pointer to a long, and it receives the version used in the last http connection. The returned value will be exactly one of the CURLPROTO_* values β no mixing, no guessing, periodt:
CURLPROTO_DICTCURLPROTO_FILECURLPROTO_FTPCURLPROTO_FTPSCURLPROTO_GOPHERCURLPROTO_HTTPCURLPROTO_HTTPSCURLPROTO_IMAPCURLPROTO_IMAPSCURLPROTO_LDAPCURLPROTO_LDAPSCURLPROTO_POP3CURLPROTO_POP3SCURLPROTO_RTMPCURLPROTO_RTMPECURLPROTO_RTMPSCURLPROTO_RTMPTCURLPROTO_RTMPTECURLPROTO_RTMPTSCURLPROTO_RTSPCURLPROTO_SCPCURLPROTO_SFTPCURLPROTO_SMBCURLPROTO_SMBSCURLPROTO_SMTPCURLPROTO_SMTPSCURLPROTO_TELNETCURLPROTO_TFTPCURLPROTO_MQTT
π¦ PROTOCOLS π¦
All β like, every protocol, bestie. π
π₯ 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) {
long protocol;
curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
}
curl_easy_cleanup(curl);
}
β AVAILABILITY β
Added in 7.52.0. slay. π«Ά
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. that's it. π
π SEE ALSO π
π«Ά okay that's the whole page, bestie! it's fromlibcurl 7.52.0, dated23 November 2016. mwah π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2018, 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