1CURLINFO_RETRY_AFTER(3)    curl_easy_getinfo options   CURLINFO_RETRY_AFTER(3)
2
3
4

NAME

6       CURLINFO_RETRY_AFTER - returns the Retry-After retry delay
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode    curl_easy_getinfo(CURL    *handle,    CURLINFO_RETRY_AFTER,
12       curl_off_t *retry);
13

DESCRIPTION

15       Pass a pointer to a curl_off_t variable to receive the number  of  sec‐
16       onds the HTTP server suggests the client should wait until the next re‐
17       quest is issued. The information from the "Retry-After:" header.
18
19       While  the  HTTP  header  might  contain  a  fixed  date  string,   the
20       CURLINFO_RETRY_AFTER(3)  will always return number of seconds to wait -
21       or zero if there was no header or the header couldn't be parsed.
22

DEFAULT

24       Returns zero delay if there was no header.
25

PROTOCOLS

27       HTTP(S)
28

EXAMPLE

30       CURL *curl = curl_easy_init();
31       if(curl) {
32         CURLcode res;
33         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
34         res = curl_easy_perform(curl);
35         if(res == CURLE_OK) {
36           curl_off_t wait = 0;
37           curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &wait);
38           if(wait)
39             printf("Wait for %" CURL_FORMAT_CURL_OFF_T " seconds\n", wait);
40         }
41         curl_easy_cleanup(curl);
42       }
43

AVAILABILITY

45       Added in curl 7.66.0
46

RETURN VALUE

48       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
49       if not.
50

SEE ALSO

52       CURLOPT_STDERR(3), CURLOPT_HEADERFUNCTION(3),
53
54
55
56libcurl 7.76.1                 November 04, 2020       CURLINFO_RETRY_AFTER(3)
Impressum