GNURLINFO_...RECT_COUNT(3)

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

πŸ’– GNURLINFO_...RECT_COUNT(3) πŸ’–

okay bestie, this is a page from the curl_easy_getinfo options manual, and it's all about counting redirects. slay. πŸŽ€


✨ NAME ✨

CURLINFO_REDIRECT_COUNT β€” get the number of redirects πŸŒ€


✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_COUNT, long *countp);

✨ DESCRIPTION ✨

You pass in a pointer to a long, and it receives the total number of redirections that were actually followed. no cap, that's the whole vibe check. πŸ’…


✨ PROTOCOLS ✨

HTTP(S) β€” that's it, that's the list. 🌈


✨ EXAMPLE ✨

here's the little demo, copied exactly so you can run it and feel iconic:

CURL *curl = curl_easy_init();
if(curl) {
  CURLcode res;
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  res = curl_easy_perform(curl);
  if(res == CURLE_OK) {
    long redirects;
    curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects);
  }
  curl_easy_cleanup(curl);
}

✨ AVAILABILITY ✨

Added in 7.9.7 β€” she's been around for a minute, fr fr. ⭐


✨ RETURN VALUE ✨

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. simple as that, bestie. πŸ’€


✨ SEE ALSO ✨


stay slay, bestie πŸ’– β€” this page comes from libcurl 7.44.0, dated 28 Aug 2015, and its header/footer home is GNURLINFO_...RECT_COUNT(3). πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from