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

NAME

6       CURLOPT_REDIR_PROTOCOLS - set protocols allowed to redirect to
7

SYNOPSIS

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

DESCRIPTION

15       Pass a long that holds a bitmask of CURLPROTO_* defines. If used,  this
16       bitmask  limits  what  protocols  libcurl may use in a transfer that it
17       follows to in a redirect  when  CURLOPT_FOLLOWLOCATION(3)  is  enabled.
18       This allows you to limit specific transfers to only be allowed to use a
19       subset of protocols in redirections.
20
21       Protocols denied by CURLOPT_PROTOCOLS(3) are  not  overridden  by  this
22       option.
23
24       By  default libcurl will allow all protocols on redirect except several
25       disabled for security reasons: Since 7.19.4 FILE and SCP are  disabled,
26       and  since 7.40.0 SMB and SMBS are also disabled. CURLPROTO_ALL enables
27       all protocols on redirect, including those disabled for security.
28
29       These are the available protocol defines:
30       CURLPROTO_DICT
31       CURLPROTO_FILE
32       CURLPROTO_FTP
33       CURLPROTO_FTPS
34       CURLPROTO_GOPHER
35       CURLPROTO_HTTP
36       CURLPROTO_HTTPS
37       CURLPROTO_IMAP
38       CURLPROTO_IMAPS
39       CURLPROTO_LDAP
40       CURLPROTO_LDAPS
41       CURLPROTO_POP3
42       CURLPROTO_POP3S
43       CURLPROTO_RTMP
44       CURLPROTO_RTMPE
45       CURLPROTO_RTMPS
46       CURLPROTO_RTMPT
47       CURLPROTO_RTMPTE
48       CURLPROTO_RTMPTS
49       CURLPROTO_RTSP
50       CURLPROTO_SCP
51       CURLPROTO_SFTP
52       CURLPROTO_SMB
53       CURLPROTO_SMBS
54       CURLPROTO_SMTP
55       CURLPROTO_SMTPS
56       CURLPROTO_TELNET
57       CURLPROTO_TFTP
58

DEFAULT

60       All protocols except for FILE, SCP and since 7.40.0 SMB and SMBS.
61

PROTOCOLS

63       All
64

EXAMPLE

66       curl = curl_easy_init();
67       if(curl) {
68         /* pass in the URL from an external source */
69         curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
70
71         /* only allow redirects to HTTP and HTTPS URLs */
72         curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS,
73                          CURLPROTO_HTTP | CURLPROTO_HTTPS);
74
75         /* Perform the request */
76         curl_easy_perform(curl);
77       }
78

AVAILABILITY

80       Added in 7.19.4, before then it would follow all protocols.
81

RETURN VALUE

83       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
84       if not.
85

SEE ALSO

87       CURLOPT_PROTOCOLS(3),
88
89
90
91libcurl 7.61.1                September 21, 2016    CURLOPT_REDIR_PROTOCOLS(3)
Impressum