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 op‐
22       tion.
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       HTTP, HTTPS, FTP and FTPS (Since 7.65.2).
63
64       Older versions defaulted to all protocols except FILE,  SCP  and  since
65       7.40.0 SMB and SMBS.
66

PROTOCOLS

68       All
69

EXAMPLE

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

AVAILABILITY

85       Added in 7.19.4, before then it would follow all protocols.
86

RETURN VALUE

88       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
89       if not.
90

SEE ALSO

92       CURLOPT_PROTOCOLS(3),
93
94
95
96libcurl 7.76.1                 November 04, 2020    CURLOPT_REDIR_PROTOCOLS(3)
Impressum