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