CURLINFO_REDIRECT_TIME_T(3)

πŸ’… CURLINFO_REDIRECT_TIME_T(3) β€” Library Functions Manual ✨

okay so bestie, this page is literally about CURLINFO_REDIRECT_TIME_T(3), and it's giving "how long did all the redirecting take?" energy. no cap, it's a curl thing. πŸ¦‹

🌸 NAME 🌸

CURLINFO_REDIRECT_TIME_T β€” time for all redirection steps πŸ’–

✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME_T,
                           curl_off_t *timep);

πŸŽ€ DESCRIPTION πŸŽ€

okay so you pass a pointer to a curl_off_t, and it receives the total time, in microseconds, that it took for all redirection steps β€” including name lookup, connect, pretransfer, and transfer β€” before the final transaction was started. like, all of it. ⏱️

CURLINFO_REDIRECT_TIME_T(3) holds the complete execution time for multiple redirections. multiple!! she's tracking the whole redirect saga, not just one hop. πŸ’…

also, pls go see the TIMES overview in the curl_easy_getinfo(3) man page. iykyk πŸ”₯

🌈 PROTOCOLS 🌈

This functionality affects http only. that's the whole vibe check: http, bestie. 🫢

πŸ“ EXAMPLE πŸ“

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_off_t 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_T, &redirect);
      if(CURLE_OK == result) {
        printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000,
               (long)(redirect % 1000000));
      }
    }
    /* always cleanup */
    curl_easy_cleanup(curl);
  }
}

πŸ’– AVAILABILITY πŸ’–

Added in curl 7.61.0. she's not new new, but she's here. ✨

πŸ‘‘ RETURN VALUE πŸ‘‘

curl_easy_getinfo(3) returns a CURLcode indicating success or error. πŸ’«

CURLE_OK (0) means everything was OK; non-zero means an error occurred, see libcurl-errors(3). no cap, check the error code. 🚨

πŸ¦‹ SEE ALSO πŸ¦‹


that's the whole page, bestie πŸ’‹ β€” brought to you by libcurl, dated 2026-10-12, and it's the CURLINFO_REDIRECT_TIME_T(3) manual page. slay. πŸŽ€

πŸ“¦ where this page comes from