2
0

CURLINFO_RETRY_AFTER.3 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLINFO_RETRY_AFTER 3 "6 Aug 2019" libcurl libcurl
  26. .SH NAME
  27. CURLINFO_RETRY_AFTER \- returns the Retry-After retry delay
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RETRY_AFTER,
  32. curl_off_t *retry);
  33. .fi
  34. .SH DESCRIPTION
  35. Pass a pointer to a curl_off_t variable to receive the number of seconds the
  36. HTTP server suggests the client should wait until the next request is
  37. issued. The information from the "Retry-After:" header.
  38. While the HTTP header might contain a fixed date string, the
  39. \fICURLINFO_RETRY_AFTER(3)\fP will always return number of seconds to wait -
  40. or zero if there was no header or the header could not be parsed.
  41. .SH DEFAULT
  42. Returns zero delay if there was no header.
  43. .SH PROTOCOLS
  44. HTTP(S)
  45. .SH EXAMPLE
  46. .nf
  47. CURL *curl = curl_easy_init();
  48. if(curl) {
  49. CURLcode res;
  50. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  51. res = curl_easy_perform(curl);
  52. if(res == CURLE_OK) {
  53. curl_off_t wait = 0;
  54. curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &wait);
  55. if(wait)
  56. printf("Wait for %" CURL_FORMAT_CURL_OFF_T " seconds\\n", wait);
  57. }
  58. curl_easy_cleanup(curl);
  59. }
  60. .fi
  61. .SH AVAILABILITY
  62. Added in 7.66.0
  63. .SH RETURN VALUE
  64. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  65. .SH "SEE ALSO"
  66. .BR CURLOPT_STDERR "(3), " CURLOPT_HEADERFUNCTION "(3), "