CURLINFO_PROTOCOL.md (1842B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLINFO_PROTOCOL 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLINFO_RESPONSE_CODE (3) 9 - curl_easy_getinfo (3) 10 - curl_easy_setopt (3) 11 Protocol: 12 - All 13 Added-in: 7.52.0 14 --- 15 16 # NAME 17 18 CURLINFO_PROTOCOL - get the protocol used in the connection 19 20 # SYNOPSIS 21 22 ~~~c 23 #include <curl/curl.h> 24 25 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p); 26 ~~~ 27 28 # DESCRIPTION 29 30 This option is deprecated. We strongly recommend using 31 CURLINFO_SCHEME(3) instead, because this option cannot return all 32 possible protocols. 33 34 Pass a pointer to a long to receive the version used in the last http 35 connection. The returned value is set to one of these values: 36 37 ~~~c 38 CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS, 39 CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP, 40 CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3, 41 CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS, 42 CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP, 43 CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP, 44 CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT 45 ~~~ 46 47 # %PROTOCOLS% 48 49 # EXAMPLE 50 51 ~~~c 52 int main(void) 53 { 54 CURL *curl = curl_easy_init(); 55 if(curl) { 56 CURLcode res; 57 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 58 res = curl_easy_perform(curl); 59 if(res == CURLE_OK) { 60 long protocol; 61 curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol); 62 } 63 curl_easy_cleanup(curl); 64 } 65 } 66 ~~~ 67 68 # DEPRECATED 69 70 Deprecated since 7.85.0. 71 72 # %AVAILABILITY% 73 74 # RETURN VALUE 75 76 curl_easy_getinfo(3) returns a CURLcode indicating success or error. 77 78 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 79 libcurl-errors(3).