GNURLINFO_REDIRECT_TIME(3)

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

πŸ’– GNURLINFO_REDIRECT_TIME πŸ’–

okay bestie, welcome to this little corner of the curl_easy_getinfo options manual β€” today’s main character is GNURLINFO_REDIRECT_TIME(3) ✨

🌸 NAME 🌸

CURLINFO_REDIRECT_TIME β€” get the time for all redirection steps πŸ•’πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnurl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME, double
*timep);

πŸŽ€ DESCRIPTION πŸŽ€

So the vibe is: you pass a pointer to a double, and it receives the total time, in seconds, that it took for all redirection steps β€” name lookup, connect, pretransfer, and transfer β€” before the final transaction was started. No cap, that’s the whole timeline tea β˜•βœ¨

CURLINFO_REDIRECT_TIME contains the complete execution time for multiple redirections β€” she’s tracking the whole redirect saga, not just one tiny moment πŸ‘‘

Also, there’s a TIMES overview in the curl_easy_getinfo(3) man page β€” go peek if you want the full context 🫢

🌈 PROTOCOLS 🌈

All 🌍✨

πŸ“ EXAMPLE πŸ“

here’s the code vibe, copy it exactly and let it slay:

curl = curl_easy_init();
if(curl) {
  double redirect;
  curl_easy_setopt(curl, CURLOPT_URL, url);
  res = curl_easy_perform(curl);
  if(CURLE_OK == res) {
    res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect);
    if(CURLE_OK == res) {
      printf("Time: %.1f", redirect);
    }
  }
  /* always cleanup */
  curl_easy_cleanup(curl);
}

⭐ AVAILABILITY ⭐

Added in 7.9.7 β€” yes, she’s got history πŸ‘‘πŸ’–

πŸ’œ RETURN VALUE πŸ’œ

  • Returns CURLE_OK if the option is supported βœ…
  • Returns CURLE_UNKNOWN_OPTION if not πŸ™ˆ

🧚 SEE ALSO 🧚


mwah πŸ’‹ this page is brought to you by libcurl 7.44.0, dated 28 Aug 2015, and filed under GNURLINFO_REDIRECT_TIME(3) πŸŽ€βœ¨

πŸ“¦ where this page comes from