GNURLINFO_RETRY_AFTER(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… GNURLINFO_RETRY_AFTER(3) β€” the curl_easy_getinfo options era πŸ’…

okay so bestie, this page is from the curl_easy_getinfo options manual, and it's literally about one very specific little getinfo vibe: CURLINFO_RETRY_AFTER πŸŽ€ no cap, it's giving "how long should I wait before trying again?"


✨ NAME ✨

CURLINFO_RETRY_AFTER β€” returns the Retry-After retry delay πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

       #include <gnurl/curl.h>

       CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RETRY_AFTER,
       curl_off_t *retry);

🌸 DESCRIPTION 🌸

You pass a pointer to a curl_off_t variable, and it receives the number of seconds the HTTP server suggesets (their spelling, not mine 😭) the client should wait until the next request is issued. It's the info from the Retry-After: header, periodt.

And here's the lowkey iconic part: even though the HTTP header might contain a fixed date string, CURLINFO_RETRY_AFTER(3) will always return the number of seconds to wait β€” or zero if there was no header or the header couldn't be parsed. Zero. Zilch. The void. πŸ’€

πŸŽ€ DEFAULT πŸŽ€

Returns zero delay if there was no header. That's it, that's the default vibe ✨

🌈 PROTOCOLS 🌈

HTTP(S) β€” that's the whole menu, bestie πŸ’…

πŸ”₯ EXAMPLE πŸ”₯

       CURL *curl = curl_easy_init();
       if(curl) {
         CURLcode res;
         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
         res = curl_easy_perform(curl);
         if(res == CURLE_OK) {
           curl_off_t wait = 0;
           curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &wait);
           if(wait)
             printf("Wait for %" CURL_FORMAT_CURL_OFF_T " seconds\n", wait);
         }
         curl_easy_cleanup(curl);
       }

⭐ AVAILABILITY ⭐

Added in curl 7.66.0 β€” a whole era πŸ‘‘

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. Translation: supported = slay, unsupported = unknown option energy πŸ™ˆ

🫢 SEE ALSO 🫢

Go read those too, they're part of the lore 🧚


okay that's the whole page, bestie πŸ«ΆπŸ’– β€” source/version is libcurl 7.66.0, dated 6 Aug 2019, and the page title is GNURLINFO_RETRY_AFTER(3) ✨

πŸ“¦ where this page comes from