xref: /aosp_15_r20/external/curl/docs/libcurl/opts/CURLOPT_PROTOCOLS.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
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: CURLOPT_PROTOCOLS
5*6236dae4SAndroid Build Coastguard WorkerSection: 3
6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl
7*6236dae4SAndroid Build Coastguard WorkerSee-also:
8*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_DEFAULT_PROTOCOL (3)
9*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_REDIR_PROTOCOLS (3)
10*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_URL (3)
11*6236dae4SAndroid Build Coastguard WorkerProtocol:
12*6236dae4SAndroid Build Coastguard Worker  - All
13*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.19.4
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 WorkerCURLOPT_PROTOCOLS - allowed protocols
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_setopt(CURL *handle, CURLOPT_PROTOCOLS, long bitmask);
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 WorkerCURLOPT_PROTOCOLS_STR(3) instead because this option cannot control all
32*6236dae4SAndroid Build Coastguard Workeravailable protocols.
33*6236dae4SAndroid Build Coastguard Worker
34*6236dae4SAndroid Build Coastguard WorkerPass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask
35*6236dae4SAndroid Build Coastguard Workerlimits what protocols libcurl may use in the transfer. This allows you to have
36*6236dae4SAndroid Build Coastguard Workera libcurl built to support a wide range of protocols but still limit specific
37*6236dae4SAndroid Build Coastguard Workertransfers to only be allowed to use a subset of them. By default libcurl
38*6236dae4SAndroid Build Coastguard Workeraccepts all protocols it supports (*CURLPROTO_ALL*). See also
39*6236dae4SAndroid Build Coastguard WorkerCURLOPT_REDIR_PROTOCOLS(3).
40*6236dae4SAndroid Build Coastguard Worker
41*6236dae4SAndroid Build Coastguard WorkerThese are the available protocol defines:
42*6236dae4SAndroid Build Coastguard Worker~~~c
43*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_DICT
44*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_FILE
45*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_FTP
46*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_FTPS
47*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_GOPHER
48*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_HTTP
49*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_HTTPS
50*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_IMAP
51*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_IMAPS
52*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_LDAP
53*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_LDAPS
54*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_POP3
55*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_POP3S
56*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_RTMP
57*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_RTMPE
58*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_RTMPS
59*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_RTMPT
60*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_RTMPTE
61*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_RTMPTS
62*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_RTSP
63*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_SCP
64*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_SFTP
65*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_SMB
66*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_SMBS
67*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_SMTP
68*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_SMTPS
69*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_TELNET
70*6236dae4SAndroid Build Coastguard WorkerCURLPROTO_TFTP
71*6236dae4SAndroid Build Coastguard Worker~~~
72*6236dae4SAndroid Build Coastguard Worker
73*6236dae4SAndroid Build Coastguard Worker# DEFAULT
74*6236dae4SAndroid Build Coastguard Worker
75*6236dae4SAndroid Build Coastguard WorkerAll protocols built-in.
76*6236dae4SAndroid Build Coastguard Worker
77*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS%
78*6236dae4SAndroid Build Coastguard Worker
79*6236dae4SAndroid Build Coastguard Worker# EXAMPLE
80*6236dae4SAndroid Build Coastguard Worker
81*6236dae4SAndroid Build Coastguard Worker~~~c
82*6236dae4SAndroid Build Coastguard Workerint main(int argc, char **argv)
83*6236dae4SAndroid Build Coastguard Worker{
84*6236dae4SAndroid Build Coastguard Worker  CURL *curl = curl_easy_init();
85*6236dae4SAndroid Build Coastguard Worker  if(curl) {
86*6236dae4SAndroid Build Coastguard Worker    /* pass in the URL from an external source */
87*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
88*6236dae4SAndroid Build Coastguard Worker
89*6236dae4SAndroid Build Coastguard Worker    /* only allow HTTP, TFTP and SFTP */
90*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_PROTOCOLS,
91*6236dae4SAndroid Build Coastguard Worker                     CURLPROTO_HTTP | CURLPROTO_TFTP | CURLPROTO_SFTP);
92*6236dae4SAndroid Build Coastguard Worker
93*6236dae4SAndroid Build Coastguard Worker    /* Perform the request */
94*6236dae4SAndroid Build Coastguard Worker    curl_easy_perform(curl);
95*6236dae4SAndroid Build Coastguard Worker  }
96*6236dae4SAndroid Build Coastguard Worker}
97*6236dae4SAndroid Build Coastguard Worker~~~
98*6236dae4SAndroid Build Coastguard Worker
99*6236dae4SAndroid Build Coastguard Worker# DEPRECATED
100*6236dae4SAndroid Build Coastguard Worker
101*6236dae4SAndroid Build Coastguard WorkerDeprecated since 7.85.0.
102*6236dae4SAndroid Build Coastguard Worker
103*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY%
104*6236dae4SAndroid Build Coastguard Worker
105*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE
106*6236dae4SAndroid Build Coastguard Worker
107*6236dae4SAndroid Build Coastguard WorkerReturns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
108