1CURLINFO_REDIRECT_TIME_T(3)curl_easy_getinfo optionsCURLINFO_REDIRECT_TIME_T(3)
2
3
4
6 CURLINFO_REDIRECT_TIME_T - get the time for all redirection steps
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME_T,
12 curl_off_t *timep);
13
15 Pass a pointer to a curl_off_t to receive the total time, in microsec‐
16 onds, it took for all redirection steps include name lookup, connect,
17 pretransfer and transfer before final transaction was started.
18 CURLINFO_REDIRECT_TIME_T contains the complete execution time for mul‐
19 tiple redirections.
20
21 See also the TIMES overview in the curl_easy_getinfo(3) man page.
22
24 All
25
27 curl = curl_easy_init();
28 if(curl) {
29 curl_off_t redirect;
30 curl_easy_setopt(curl, CURLOPT_URL, url);
31 res = curl_easy_perform(curl);
32 if(CURLE_OK == res) {
33 res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &redirect);
34 if(CURLE_OK == res) {
35 printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000,
36 (long)(redirect % 1000000));
37 }
38 }
39 /* always cleanup */
40 curl_easy_cleanup(curl);
41 }
42
44 Added in 7.61.0
45
47 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
48 if not.
49
51 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_REDIRECT_TIME(3)
52
53
54
55libcurl 7.79.1 November 04, 2020 CURLINFO_REDIRECT_TIME_T(3)