1CURLOPT_PROTOCOLS(3) curl_easy_setopt options CURLOPT_PROTOCOLS(3)
2
3
4
6 CURLOPT_PROTOCOLS - allowed protocols
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS, long bitmask);
12
14 This option is deprecated. We strongly recommend using CURLOPT_PROTO‐
15 COLS_STR(3) instead because this option cannot control all available
16 protocols!
17
18 Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this
19 bitmask limits what protocols libcurl may use in the transfer. This al‐
20 lows you to have a libcurl built to support a wide range of protocols
21 but still limit specific transfers to only be allowed to use a subset
22 of them. By default libcurl will accept all protocols it supports
23 (CURLPROTO_ALL). See also CURLOPT_REDIR_PROTOCOLS(3).
24
25 These are the available protocol defines:
26 CURLPROTO_DICT
27 CURLPROTO_FILE
28 CURLPROTO_FTP
29 CURLPROTO_FTPS
30 CURLPROTO_GOPHER
31 CURLPROTO_HTTP
32 CURLPROTO_HTTPS
33 CURLPROTO_IMAP
34 CURLPROTO_IMAPS
35 CURLPROTO_LDAP
36 CURLPROTO_LDAPS
37 CURLPROTO_POP3
38 CURLPROTO_POP3S
39 CURLPROTO_RTMP
40 CURLPROTO_RTMPE
41 CURLPROTO_RTMPS
42 CURLPROTO_RTMPT
43 CURLPROTO_RTMPTE
44 CURLPROTO_RTMPTS
45 CURLPROTO_RTSP
46 CURLPROTO_SCP
47 CURLPROTO_SFTP
48 CURLPROTO_SMB
49 CURLPROTO_SMBS
50 CURLPROTO_SMTP
51 CURLPROTO_SMTPS
52 CURLPROTO_TELNET
53 CURLPROTO_TFTP
54
56 All protocols built-in.
57
59 All
60
62 curl = curl_easy_init();
63 if(curl) {
64 /* pass in the URL from an external source */
65 curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
66
67 /* only allow HTTP, TFTP and SFTP */
68 curl_easy_setopt(curl, CURLOPT_PROTOCOLS,
69 CURLPROTO_HTTP | CURLPROTO_TFTP | CURLPROTO_SFTP);
70
71 /* Perform the request */
72 curl_easy_perform(curl);
73 }
74
76 Added in 7.19.4
77
79 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
80 if not.
81
83 CURLOPT_REDIR_PROTOCOLS(3), CURLOPT_URL(3),
84
85
86
87libcurl 7.85.0 June 13, 2022 CURLOPT_PROTOCOLS(3)