1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROTOCOLS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_DEFAULT_PROTOCOL (3)
9  - CURLOPT_REDIR_PROTOCOLS (3)
10  - CURLOPT_URL (3)
11---
12
13# NAME
14
15CURLOPT_PROTOCOLS - allowed protocols
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS, long bitmask);
23~~~
24
25# DESCRIPTION
26
27This option is deprecated. We strongly recommend using
28CURLOPT_PROTOCOLS_STR(3) instead because this option cannot control all
29available protocols!
30
31Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask
32limits what protocols libcurl may use in the transfer. This allows you to have
33a libcurl built to support a wide range of protocols but still limit specific
34transfers to only be allowed to use a subset of them. By default libcurl
35accepts all protocols it supports (*CURLPROTO_ALL*). See also
36CURLOPT_REDIR_PROTOCOLS(3).
37
38These are the available protocol defines:
39~~~c
40CURLPROTO_DICT
41CURLPROTO_FILE
42CURLPROTO_FTP
43CURLPROTO_FTPS
44CURLPROTO_GOPHER
45CURLPROTO_HTTP
46CURLPROTO_HTTPS
47CURLPROTO_IMAP
48CURLPROTO_IMAPS
49CURLPROTO_LDAP
50CURLPROTO_LDAPS
51CURLPROTO_POP3
52CURLPROTO_POP3S
53CURLPROTO_RTMP
54CURLPROTO_RTMPE
55CURLPROTO_RTMPS
56CURLPROTO_RTMPT
57CURLPROTO_RTMPTE
58CURLPROTO_RTMPTS
59CURLPROTO_RTSP
60CURLPROTO_SCP
61CURLPROTO_SFTP
62CURLPROTO_SMB
63CURLPROTO_SMBS
64CURLPROTO_SMTP
65CURLPROTO_SMTPS
66CURLPROTO_TELNET
67CURLPROTO_TFTP
68~~~
69
70# DEFAULT
71
72All protocols built-in.
73
74# PROTOCOLS
75
76All
77
78# EXAMPLE
79
80~~~c
81int main(int argc, char **argv)
82{
83  CURL *curl = curl_easy_init();
84  if(curl) {
85    /* pass in the URL from an external source */
86    curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
87
88    /* only allow HTTP, TFTP and SFTP */
89    curl_easy_setopt(curl, CURLOPT_PROTOCOLS,
90                     CURLPROTO_HTTP | CURLPROTO_TFTP | CURLPROTO_SFTP);
91
92    /* Perform the request */
93    curl_easy_perform(curl);
94  }
95}
96~~~
97
98# AVAILABILITY
99
100Added in 7.19.4. Deprecated since 7.85.0.
101
102# RETURN VALUE
103
104Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
105