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

NAME

6       CURLOPT_PROTOCOLS - allowed protocols
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS, long bitmask);
12

DESCRIPTION

14       Pass  a long that holds a bitmask of CURLPROTO_* defines. If used, this
15       bitmask limits what protocols libcurl may use in the transfer. This al‐
16       lows  you  to have a libcurl built to support a wide range of protocols
17       but still limit specific transfers to only be allowed to use  a  subset
18       of  them.  By  default  libcurl  will  accept all protocols it supports
19       (CURLPROTO_ALL). See also CURLOPT_REDIR_PROTOCOLS(3).
20
21       These are the available protocol defines:
22       CURLPROTO_DICT
23       CURLPROTO_FILE
24       CURLPROTO_FTP
25       CURLPROTO_FTPS
26       CURLPROTO_GOPHER
27       CURLPROTO_HTTP
28       CURLPROTO_HTTPS
29       CURLPROTO_IMAP
30       CURLPROTO_IMAPS
31       CURLPROTO_LDAP
32       CURLPROTO_LDAPS
33       CURLPROTO_POP3
34       CURLPROTO_POP3S
35       CURLPROTO_RTMP
36       CURLPROTO_RTMPE
37       CURLPROTO_RTMPS
38       CURLPROTO_RTMPT
39       CURLPROTO_RTMPTE
40       CURLPROTO_RTMPTS
41       CURLPROTO_RTSP
42       CURLPROTO_SCP
43       CURLPROTO_SFTP
44       CURLPROTO_SMB
45       CURLPROTO_SMBS
46       CURLPROTO_SMTP
47       CURLPROTO_SMTPS
48       CURLPROTO_TELNET
49       CURLPROTO_TFTP
50

DEFAULT

52       All protocols built-in
53

PROTOCOLS

55       All
56

EXAMPLE

58       curl = curl_easy_init();
59       if(curl) {
60         /* pass in the URL from an external source */
61         curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
62
63         /* only allow HTTP, TFTP and SFTP */
64         curl_easy_setopt(curl, CURLOPT_PROTOCOLS,
65                          CURLPROTO_HTTP | CURLPROTO_TFTP | CURLPROTO_SFTP);
66
67         /* Perform the request */
68         curl_easy_perform(curl);
69       }
70

AVAILABILITY

72       Added in 7.19.4
73

RETURN VALUE

75       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
76       if not.
77

SEE ALSO

79       CURLOPT_REDIR_PROTOCOLS(3), CURLOPT_URL(3),
80
81
82
83libcurl 7.82.0                 November 26, 2021          CURLOPT_PROTOCOLS(3)
Impressum