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 Pass a pointer to a long to receive the version used in the last http
15 connection. The returned value will be exactly one of the CURLPROTO_*
16 values:
17
18 CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS,
19 CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP,
20 CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3,
21 CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS,
22 CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP,
23 CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP,
24 CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP
25
27 All
28
30 CURL *curl = curl_easy_init();
31 if(curl) {
32 CURLcode res;
33 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
34 res = curl_easy_perform(curl);
35 if(res == CURLE_OK) {
36 long protocol;
37 curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
38 }
39 curl_easy_cleanup(curl);
40 }
41
43 Added in 7.52.0
44
46 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
47 if not.
48
50 CURLINFO_RESPONSE_CODE(3), curl_easy_getinfo(3), curl_easy_setopt(3),
51
52
53
54libcurl 7.61.1 April 27, 2018 CURLINFO_PROTOCOL(3)