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