chiark / gitweb /
Import curl_7.56.1.orig.tar.gz
[curl.git] / docs / libcurl / opts / CURLOPT_PROTOCOLS.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" **************************************************************************
22 .\"
23 .TH CURLOPT_PROTOCOLS 3 "February 03, 2016" "libcurl 7.56.1" "curl_easy_setopt options"
24
25 .SH NAME
26 CURLOPT_PROTOCOLS \- set allowed protocols
27 .SH SYNOPSIS
28 #include <curl/curl.h>
29
30 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS, long bitmask);
31 .SH DESCRIPTION
32 Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask
33 limits what protocols libcurl may use in the transfer. This allows you to have
34 a libcurl built to support a wide range of protocols but still limit specific
35 transfers to only be allowed to use a subset of them. By default libcurl will
36 accept all protocols it supports (\fICURLPROTO_ALL\fP). See also
37 \fICURLOPT_REDIR_PROTOCOLS(3)\fP.
38
39 These are the available protocol defines:
40 .nf
41 CURLPROTO_DICT
42 CURLPROTO_FILE
43 CURLPROTO_FTP
44 CURLPROTO_FTPS
45 CURLPROTO_GOPHER
46 CURLPROTO_HTTP
47 CURLPROTO_HTTPS
48 CURLPROTO_IMAP
49 CURLPROTO_IMAPS
50 CURLPROTO_LDAP
51 CURLPROTO_LDAPS
52 CURLPROTO_POP3
53 CURLPROTO_POP3S
54 CURLPROTO_RTMP
55 CURLPROTO_RTMPE
56 CURLPROTO_RTMPS
57 CURLPROTO_RTMPT
58 CURLPROTO_RTMPTE
59 CURLPROTO_RTMPTS
60 CURLPROTO_RTSP
61 CURLPROTO_SCP
62 CURLPROTO_SFTP
63 CURLPROTO_SMB
64 CURLPROTO_SMBS
65 CURLPROTO_SMTP
66 CURLPROTO_SMTPS
67 CURLPROTO_TELNET
68 CURLPROTO_TFTP
69 .fi
70 .SH DEFAULT
71 All protocols built-in
72 .SH PROTOCOLS
73 All
74 .SH EXAMPLE
75 .nf
76 curl = curl_easy_init();
77 if(curl) {
78   /* pass in the URL from an external source */
79   curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
80
81   /* only allow HTTP, TFTP and SFTP */
82   curl_easy_setopt(curl, CURLOPT_PROTOCOLS,
83                    CURLPROTO_HTTP | CURLPROTO_TFTP | CURLPROTO_SFTP);
84
85   /* Perform the request */
86   curl_easy_perform(curl);
87 }
88 .fi
89 .SH AVAILABILITY
90 Added in 7.19.4
91 .SH RETURN VALUE
92 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
93 .SH "SEE ALSO"
94 .BR CURLOPT_REDIR_PROTOCOLS "(3), " CURLOPT_URL "(3), "