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 HTTP, HTTPS, FTP and FTPS on redirect
25       (7.65.2).  Older versions of libcurl allowed all protocols on  redirect
26       except several disabled for security reasons: Since 7.19.4 FILE and SCP
27       are disabled, and since 7.40.0 SMB and SMBS are  also  disabled.  CURL‐
28       PROTO_ALL  enables  all protocols on redirect, including those disabled
29       for security.
30
31       These are the available protocol defines:
32       CURLPROTO_DICT
33       CURLPROTO_FILE
34       CURLPROTO_FTP
35       CURLPROTO_FTPS
36       CURLPROTO_GOPHER
37       CURLPROTO_HTTP
38       CURLPROTO_HTTPS
39       CURLPROTO_IMAP
40       CURLPROTO_IMAPS
41       CURLPROTO_LDAP
42       CURLPROTO_LDAPS
43       CURLPROTO_POP3
44       CURLPROTO_POP3S
45       CURLPROTO_RTMP
46       CURLPROTO_RTMPE
47       CURLPROTO_RTMPS
48       CURLPROTO_RTMPT
49       CURLPROTO_RTMPTE
50       CURLPROTO_RTMPTS
51       CURLPROTO_RTSP
52       CURLPROTO_SCP
53       CURLPROTO_SFTP
54       CURLPROTO_SMB
55       CURLPROTO_SMBS
56       CURLPROTO_SMTP
57       CURLPROTO_SMTPS
58       CURLPROTO_TELNET
59       CURLPROTO_TFTP
60

DEFAULT

62       All protocols except for FILE, SCP and since 7.40.0 SMB and SMBS.
63

PROTOCOLS

65       All
66

EXAMPLE

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

AVAILABILITY

82       Added in 7.19.4, before then it would follow all protocols.
83

RETURN VALUE

85       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
86       if not.
87

SEE ALSO

89       CURLOPT_PROTOCOLS(3),
90
91
92
93libcurl 7.66.0                   July 16, 2019      CURLOPT_REDIR_PROTOCOLS(3)
Impressum