CURLINFO_REDIRECT_TIME(3)

πŸ’… CURLINFO_REDIRECT_TIME πŸ’…

ok so real talk bestie, you're reading the CURLINFO_REDIRECT_TIME(3) page from the Library Functions Manual and honestly? it's a good one. let's get into it πŸŽ€


✨ NAME ✨

CURLINFO_REDIRECT_TIME β€” literally the time for all the redirection steps, every single one of them πŸŒ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <curl/curl.h>

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

🌸 DESCRIPTION 🌸

okay so you pass a pointer to a double β€” like, an actual double * β€” and it gets filled in with the total time, in seconds, that it took for all the redirection steps 🫢

and when we say all the steps, we mean all of them no cap: name lookup, connect, pretransfer, and transfer β€” everything that happened before the final transaction was started. the whole lil journey before the main event, iykyk ✨

and bestie, CURLINFO_REDIRECT_TIME(3) contains the complete execution time for multiple redirections β€” so if you got bounced around like five times, this is the grand total of all that bouncing πŸŽ€

also!! peep the TIMES overview section in the curl_easy_getinfo(3) man page, it's giving bonus lore πŸ’œ


🌈 PROTOCOLS 🌈

this functionality affects http only πŸ’… periodt


πŸ”₯ EXAMPLE πŸ”₯

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    double redirect;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    result = curl_easy_perform(curl);
    if(CURLE_OK == result) {
      result = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect);
      if(CURLE_OK == result) {
        printf("Time: %.1f", redirect);
      }
    }
    /* always cleanup */
    curl_easy_cleanup(curl);
  }
}

main character energy fr fr πŸ‘‘ notice the /* always cleanup */ comment β€” that's not decoration bestie, that's a lifestyle 🧚


⭐ AVAILABILITY ⭐

added in curl 7.9.7 β€” she's been iconic for a minute πŸ’–


πŸ“ RETURN VALUE πŸ“

curl_easy_getinfo(3) returns a CURLcode indicating success or error, okurrr πŸ’€

  • CURLE_OK (0) β€” means everything was OK, slay πŸŽ‰
  • non-zero β€” means an error occurred 😭 see libcurl-errors(3) for the deets

πŸŽ€ SEE ALSO πŸŽ€


alright bestie that's the whole page, go measure some redirects πŸ’…βœ¨

libcurl Β· 2026-10-12 Β· CURLINFO_REDIRECT_TIME(3) β€” mwah, ily, go read the source πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from