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