1CURLINFO_PROTOCOL(3) curl_easy_getinfo options CURLINFO_PROTOCOL(3)
2
3
4
6 CURLINFO_PROTOCOL - get the protocol used in the connection
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p);
12
14 This option is deprecated. We strongly recommend using
15 CURLINFO_SCHEME(3) instead, because this option cannot return all pos‐
16 sible protocols!
17
18 Pass a pointer to a long to receive the version used in the last http
19 connection. The returned value will be exactly one of the CURLPROTO_*
20 values:
21
22 CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS,
23 CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP,
24 CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3,
25 CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS,
26 CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP,
27 CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP,
28 CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT
29
31 All
32
34 CURL *curl = curl_easy_init();
35 if(curl) {
36 CURLcode res;
37 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
38 res = curl_easy_perform(curl);
39 if(res == CURLE_OK) {
40 long protocol;
41 curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
42 }
43 curl_easy_cleanup(curl);
44 }
45
47 Added in 7.52.0
48
50 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
51 if not.
52
54 CURLINFO_RESPONSE_CODE(3), curl_easy_getinfo(3), curl_easy_setopt(3),
55
56
57
58libcurl 7.85.0 June 13, 2022 CURLINFO_PROTOCOL(3)