1CURLOPT_REDIR_PROTOCOLS_STR(c3u)rl_easy_setopt optioCnUsRLOPT_REDIR_PROTOCOLS_STR(3)
2
3
4

NAME

6       CURLOPT_REDIR_PROTOCOLS_STR - protocols allowed to redirect to
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REDIR_PROTOCOLS_STR,
12                                 char *spec);
13

DESCRIPTION

15       Pass  a  pointer  to a string that holds a comma-separated list of case
16       insensitive protocol names (URL schemes). That list limits what  proto‐
17       cols  libcurl  may  use  in a transfer that it follows to in a redirect
18       when CURLOPT_FOLLOWLOCATION(3) is enabled. This option allows  applica‐
19       tions to limit specific transfers to only be allowed to use a subset of
20       protocols in redirections.
21
22       Protocols denied by CURLOPT_PROTOCOLS_STR(3) are not overridden by this
23       option.
24
25       By  default  libcurl  will allow HTTP, HTTPS, FTP and FTPS on redirects
26       (since 7.65.2).  Older versions of libcurl allowed all protocols on re‐
27       direct  except several disabled for security reasons: Since 7.19.4 FILE
28       and SCP are disabled, and since 7.40.0 SMB and SMBS are also disabled.
29
30       These are the available protocols:
31
32       DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP,
33       LDAPS,  POP3,  POP3S,  RTMP, RTMPE, RTMPS, RTMPT, RTMPTE, RTMPTS, RTSP,
34       SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP
35
36       You can set "ALL" as a short-cut to enable all protocols. Note that  by
37       setting  all,  you may enable protocols that were not supported the day
38       you write this but are introduced in a future libcurl version.
39
40       If trying to set a non-existing protocol or if no matching protocol  at
41       all is set, it returns error.
42

DEFAULT

44       HTTP, HTTPS, FTP and FTPS (Added in 7.65.2).
45
46       Older  versions  defaulted  to all protocols except FILE, SCP and since
47       7.40.0 SMB and SMBS.
48

PROTOCOLS

50       All
51

EXAMPLE

53       curl = curl_easy_init();
54       if(curl) {
55         /* pass in the URL from an external source */
56         curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
57
58         /* only allow redirects to HTTP and HTTPS URLs */
59         curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
60
61         /* Perform the request */
62         curl_easy_perform(curl);
63       }
64

AVAILABILITY

66       Added in 7.85.0.
67

RETURN VALUE

69       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
70       if not.
71

SEE ALSO

73       CURLOPT_PROTOCOLS_STR(3),
74
75
76
77libcurl 7.85.0                   June 13, 2022  CURLOPT_REDIR_PROTOCOLS_STR(3)
Impressum