1CURLOPT_PROTOCOLS_STR(3)   curl_easy_setopt options   CURLOPT_PROTOCOLS_STR(3)
2
3
4

NAME

6       CURLOPT_PROTOCOLS_STR - allowed protocols
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS_STR, char *spec);
12

DESCRIPTION

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, MQTT, POP3, POP3S, RTMP, RTMPE, RTMPS,  RTMPT,  RTMPTE,  RTMPTS,
28       RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS
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

DEFAULT

39       All protocols built-in
40

PROTOCOLS

42       All
43

EXAMPLE

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

AVAILABILITY

58       Added in 7.85.0
59

RETURN VALUE

61       Returns   CURLE_UNKNOWN_OPTION   if  the  option  is  not  implemented,
62       CURLE_UNSUPPORTED_PROTOCOL if a listed protocol  is  not  supported  or
63       disabled,  CURLE_BAD_FUNCTION_ARGUMENT  if  no  protocol is listed else
64       CURLE_OK.
65

SEE ALSO

67       CURLOPT_REDIR_PROTOCOLS_STR(3),  CURLOPT_URL(3),  curl_version_info(3),
68       CURLINFO_SCHEME(3),
69
70
71
72libcurl 8.0.1                  January 02, 2023       CURLOPT_PROTOCOLS_STR(3)
Impressum