GNURLOPT_MAXREDIRS(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

Okay bestie, welcome to the GNURLOPT_MAXREDIRS(3) manual page β€” we're doing redirect limits today and it's lowkey important. No cap.

πŸŽ€ NAME πŸŽ€

CURLOPT_MAXREDIRS β€” maximum number of redirects allowed

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXREDIRS, long amount);

πŸ’… DESCRIPTION πŸ’…

Pass a long, bestie. The set number will be the redirection limit amount. If that many redirections have been followed, the next redirect will cause an error (CURLE_TOO_MANY_REDIRECTS). This option only makes sense if the CURLOPT_FOLLOWLOCATION(3) is used at the same time.

Setting the limit to 0 will make libcurl refuse any redirect. Periodt.

Set it to -1 for an infinite number of redirects. Iconic, but maybe chaotic πŸ’€.

πŸŽ€ DEFAULT πŸŽ€

-1, unlimited. The default really said "no limits, we're free" and honestly? Vibe.

🌈 PROTOCOLS 🌈

HTTP(S) β€” that's the whole menu.

πŸ“ EXAMPLE πŸ“

Here's the example, bestie β€” copy it exactly:

       curl = curl_easy_init();
       if(curl) {
         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/");

         /* enable redirect following */
         curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

         /* allow three redirects */
         curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L);

         /* Perform the request */
         curl_easy_perform(curl);
       }

πŸ¦‹ AVAILABILITY πŸ¦‹

Along with HTTP. That's it, that's the availability.

⭐ RETURN VALUE ⭐

Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. So check your HTTP support, bestie 🫢.

πŸ’– SEE ALSO πŸ’–


Source/version and date sign-off: this page is serving libcurl 7.37.0, dated 17 Jun 2014, with manual name GNURLOPT_MAXREDIRS(3). Mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from