1*6236dae4SAndroid Build Coastguard Worker--- 2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 4*6236dae4SAndroid Build Coastguard WorkerTitle: CURLINFO_PROTOCOL 5*6236dae4SAndroid Build Coastguard WorkerSection: 3 6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl 7*6236dae4SAndroid Build Coastguard WorkerSee-also: 8*6236dae4SAndroid Build Coastguard Worker - CURLINFO_RESPONSE_CODE (3) 9*6236dae4SAndroid Build Coastguard Worker - curl_easy_getinfo (3) 10*6236dae4SAndroid Build Coastguard Worker - curl_easy_setopt (3) 11*6236dae4SAndroid Build Coastguard WorkerProtocol: 12*6236dae4SAndroid Build Coastguard Worker - All 13*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.52.0 14*6236dae4SAndroid Build Coastguard Worker--- 15*6236dae4SAndroid Build Coastguard Worker 16*6236dae4SAndroid Build Coastguard Worker# NAME 17*6236dae4SAndroid Build Coastguard Worker 18*6236dae4SAndroid Build Coastguard WorkerCURLINFO_PROTOCOL - get the protocol used in the connection 19*6236dae4SAndroid Build Coastguard Worker 20*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS 21*6236dae4SAndroid Build Coastguard Worker 22*6236dae4SAndroid Build Coastguard Worker~~~c 23*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h> 24*6236dae4SAndroid Build Coastguard Worker 25*6236dae4SAndroid Build Coastguard WorkerCURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p); 26*6236dae4SAndroid Build Coastguard Worker~~~ 27*6236dae4SAndroid Build Coastguard Worker 28*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION 29*6236dae4SAndroid Build Coastguard Worker 30*6236dae4SAndroid Build Coastguard WorkerThis option is deprecated. We strongly recommend using 31*6236dae4SAndroid Build Coastguard WorkerCURLINFO_SCHEME(3) instead, because this option cannot return all 32*6236dae4SAndroid Build Coastguard Workerpossible protocols. 33*6236dae4SAndroid Build Coastguard Worker 34*6236dae4SAndroid Build Coastguard WorkerPass a pointer to a long to receive the version used in the last http 35*6236dae4SAndroid Build Coastguard Workerconnection. The returned value is set to one of the CURLPROTO_* values: 36*6236dae4SAndroid Build Coastguard Worker 37*6236dae4SAndroid Build Coastguard Worker~~~c 38*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS, 39*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP, 40*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3, 41*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS, 42*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP, 43*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP, 44*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT 45*6236dae4SAndroid Build Coastguard Worker~~~ 46*6236dae4SAndroid Build Coastguard Worker 47*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS% 48*6236dae4SAndroid Build Coastguard Worker 49*6236dae4SAndroid Build Coastguard Worker# EXAMPLE 50*6236dae4SAndroid Build Coastguard Worker 51*6236dae4SAndroid Build Coastguard Worker~~~c 52*6236dae4SAndroid Build Coastguard Workerint main(void) 53*6236dae4SAndroid Build Coastguard Worker{ 54*6236dae4SAndroid Build Coastguard Worker CURL *curl = curl_easy_init(); 55*6236dae4SAndroid Build Coastguard Worker if(curl) { 56*6236dae4SAndroid Build Coastguard Worker CURLcode res; 57*6236dae4SAndroid Build Coastguard Worker curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 58*6236dae4SAndroid Build Coastguard Worker res = curl_easy_perform(curl); 59*6236dae4SAndroid Build Coastguard Worker if(res == CURLE_OK) { 60*6236dae4SAndroid Build Coastguard Worker long protocol; 61*6236dae4SAndroid Build Coastguard Worker curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol); 62*6236dae4SAndroid Build Coastguard Worker } 63*6236dae4SAndroid Build Coastguard Worker curl_easy_cleanup(curl); 64*6236dae4SAndroid Build Coastguard Worker } 65*6236dae4SAndroid Build Coastguard Worker} 66*6236dae4SAndroid Build Coastguard Worker~~~ 67*6236dae4SAndroid Build Coastguard Worker 68*6236dae4SAndroid Build Coastguard Worker# DEPRECATED 69*6236dae4SAndroid Build Coastguard Worker 70*6236dae4SAndroid Build Coastguard WorkerDeprecated since 7.85.0. 71*6236dae4SAndroid Build Coastguard Worker 72*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY% 73*6236dae4SAndroid Build Coastguard Worker 74*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE 75*6236dae4SAndroid Build Coastguard Worker 76*6236dae4SAndroid Build Coastguard WorkerReturns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 77