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

NAME

6       CURLOPT_MAXREDIRS - maximum number of redirects allowed
7

SYNOPSIS

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

DESCRIPTION

15       Pass a long. The set number will be the redirection  limit  amount.  If
16       that many redirections have been followed, the next redirect will cause
17       an error (CURLE_TOO_MANY_REDIRECTS). This option only  makes  sense  if
18       the CURLOPT_FOLLOWLOCATION(3) is used at the same time.
19
20       Setting the limit to 0 will make libcurl refuse any redirect.
21
22       Set it to -1 for an infinite number of redirects.
23

DEFAULT

25       -1, unlimited
26

PROTOCOLS

28       HTTP(S)
29

EXAMPLE

31       curl = curl_easy_init();
32       if(curl) {
33         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
34
35         /* enable redirect following */
36         curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
37
38         /* allow three redirects */
39         curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L);
40
41         /* Perform the request */
42         curl_easy_perform(curl);
43       }
44

AVAILABILITY

46       Along with HTTP
47

RETURN VALUE

49       Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
50

SEE ALSO

52       CURLOPT_FOLLOWLOCATION(3),
53
54
55
56libcurl 7.76.1                 November 04, 2020          CURLOPT_MAXREDIRS(3)
Impressum