1CURLOPT_PROTOCOLS_STR(3) curl_easy_setopt options CURLOPT_PROTOCOLS_STR(3)
2
3
4
6 CURLOPT_PROTOCOLS_STR - allowed protocols
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS_STR, char *spec);
12
14 Pass a pointer to a string that holds a comma-separated list of case
15 insensitive protocol names (URL schemes) to allow in the transfer. This
16 option allows applications to use libcurl built to support a wide range
17 of protocols but still limit specific transfers to only be allowed to
18 use a subset of them. By default, libcurl accepts all protocols it was
19 built with support for. See also CURLOPT_REDIR_PROTOCOLS_STR(3).
20
21 If trying to set a non-existing protocol or if no matching protocol at
22 all is set, it returns error.
23
24 These are the available protocols:
25
26 DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP,
27 LDAPS, POP3, POP3S, RTMP, RTMPE, RTMPS, RTMPT, RTMPTE, RTMPTS, RTSP,
28 SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP
29
30 You can set "ALL" as a short-cut to enable all protocols. Note that by
31 setting all, you may enable protocols that were not supported the day
32 you write this but are introduced in a future libcurl version.
33
34 curl_version_info(3) can be used to get a list of all supported proto‐
35 cols in the current libcurl. CURLINFO_SCHEME(3) is the recommended way
36 to figure out the protocol used in a previous transfer.
37
39 All protocols built-in
40
42 All
43
45 curl = curl_easy_init();
46 if(curl) {
47 /* pass in the URL from an external source */
48 curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
49
50 /* only allow HTTP, TFTP and SFTP */
51 curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "http,tftp,sftp");
52
53 /* Perform the request */
54 curl_easy_perform(curl);
55 }
56
58 Added in 7.85.0
59
61 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
62 if not.
63
65 CURLOPT_REDIR_PROTOCOLS_STR(3), CURLOPT_URL(3), curl_version_info(3),
66 CURLINFO_SCHEME(3),
67
68
69
70libcurl 7.85.0 June 13, 2022 CURLOPT_PROTOCOLS_STR(3)