quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_MAXREDIRS.md (1598B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_MAXREDIRS
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLINFO_REDIRECT_COUNT (3)
      9   - CURLINFO_REDIRECT_URL (3)
     10   - CURLOPT_FOLLOWLOCATION (3)
     11 Protocol:
     12   - HTTP
     13 Added-in: 7.5
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_MAXREDIRS - maximum number of redirects allowed
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXREDIRS, long amount);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a long. The set number is the redirection limit *amount*. If that
     31 many redirections have been followed, the next redirect triggers the error
     32 (*CURLE_TOO_MANY_REDIRECTS*). This option only makes sense if the
     33 CURLOPT_FOLLOWLOCATION(3) is used at the same time.
     34 
     35 Setting the limit to 0 makes libcurl refuse any redirect.
     36 
     37 Set it to -1 for an infinite number of redirects. This allows your application
     38 to get stuck in never-ending redirect loops.
     39 
     40 # DEFAULT
     41 
     42 30 (since 8.3.0), it was previously unlimited.
     43 
     44 # %PROTOCOLS%
     45 
     46 # EXAMPLE
     47 
     48 ~~~c
     49 int main(void)
     50 {
     51   CURL *curl = curl_easy_init();
     52   if(curl) {
     53     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
     54 
     55     /* enable redirect following */
     56     curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
     57 
     58     /* allow three redirects */
     59     curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L);
     60 
     61     /* Perform the request */
     62     curl_easy_perform(curl);
     63   }
     64 }
     65 ~~~
     66 
     67 # %AVAILABILITY%
     68 
     69 # RETURN VALUE
     70 
     71 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     72 
     73 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     74 libcurl-errors(3).