CURLINFO_RETRY_AFTER.3 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .\" generated by cd2nroff 0.1 from CURLINFO_RETRY_AFTER.md
  2. .TH CURLINFO_RETRY_AFTER 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_RETRY_AFTER \- returns the Retry\-After retry delay
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RETRY_AFTER,
  9. curl_off_t *retry);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a curl_off_t variable to receive the number of seconds the
  13. HTTP server suggests the client should wait until the next request is
  14. issued. The information from the "Retry\-After:" header.
  15. While the HTTP header might contain a fixed date string, the
  16. \fICURLINFO_RETRY_AFTER(3)\fP always returns the number of seconds to wait \-
  17. or zero if there was no header or the header could not be parsed.
  18. .SH DEFAULT
  19. Zero if there was no header.
  20. .SH PROTOCOLS
  21. This functionality affects all supported protocols
  22. .SH EXAMPLE
  23. .nf
  24. int main(void)
  25. {
  26. CURL *curl = curl_easy_init();
  27. if(curl) {
  28. CURLcode res;
  29. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  30. res = curl_easy_perform(curl);
  31. if(res == CURLE_OK) {
  32. curl_off_t wait = 0;
  33. curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &wait);
  34. if(wait)
  35. printf("Wait for %" CURL_FORMAT_CURL_OFF_T " seconds\\n", wait);
  36. }
  37. curl_easy_cleanup(curl);
  38. }
  39. }
  40. .fi
  41. .SH AVAILABILITY
  42. Added in curl 7.66.0
  43. .SH RETURN VALUE
  44. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  45. .SH SEE ALSO
  46. .BR CURLOPT_HEADERFUNCTION (3),
  47. .BR CURLOPT_STDERR (3),
  48. .BR curl_easy_header (3)