1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_REDIRECT_TIME 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_REDIRECT_COUNT (3) 9 - CURLINFO_REDIRECT_TIME_T (3) 10 - CURLINFO_REDIRECT_URL (3) 11 - curl_easy_getinfo (3) 12 - curl_easy_setopt (3) 13Protocol: 14 - HTTP 15--- 16 17# NAME 18 19CURLINFO_REDIRECT_TIME - get the time for all redirection steps 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME, 27 double *timep); 28~~~ 29 30# DESCRIPTION 31 32Pass a pointer to a double to receive the total time, in seconds, it took for 33all redirection steps include name lookup, connect, pretransfer and transfer 34before final transaction was started. CURLINFO_REDIRECT_TIME(3) contains 35the complete execution time for multiple redirections. 36 37See also the TIMES overview in the curl_easy_getinfo(3) man page. 38 39# EXAMPLE 40 41~~~c 42int main(void) 43{ 44 CURL *curl = curl_easy_init(); 45 if(curl) { 46 CURLcode res; 47 double redirect; 48 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 49 res = curl_easy_perform(curl); 50 if(CURLE_OK == res) { 51 res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect); 52 if(CURLE_OK == res) { 53 printf("Time: %.1f", redirect); 54 } 55 } 56 /* always cleanup */ 57 curl_easy_cleanup(curl); 58 } 59} 60~~~ 61 62# AVAILABILITY 63 64Added in 7.9.7 65 66# RETURN VALUE 67 68Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 69