GNURLINFO...TION_UNMET(3)

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

okay so bestie, welcome to the GNURLINFO...TION_UNMET(3) page β€” it's filed under the curl_easy_getinfo options manual, and it's all about CURLINFO_CONDITION_UNMET. no cap, the manual name is literally that truncated-lookin' string. πŸ’…

πŸŽ€ NAME πŸŽ€

CURLINFO_CONDITION_UNMET β€” get info on unmet time conditional or 304 HTTP response. That's the whole vibe: it tells you when a conditional request didn't hand over the goods. πŸ¦‹

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONDITION_UNMET, long
*unmet);

πŸ’– DESCRIPTION πŸ’–

So here's the tea: you pass a pointer to a long to receive the number 1 if the condition provided in the previous request didn't match (see CURLOPT_TIMECONDITION(3)). Periodt. πŸ’…

Alas, if this returns a 1, you know that the reason you didn't get data in return is because it didn't fulfill the condition. The long this argument points to will get a zero stored if the condition instead was met. 😭

This can also return 1 if the server responded with a 304 HTTP status code β€” for example after sending a custom "If-Match-*" header. Highkey iconic. πŸ”₯

🌈 PROTOCOLS 🌈

HTTP and some. Yep, β€œsome” is literally what it says β€” I'm not making it up. πŸ™ˆ

🧚 EXAMPLE 🧚

Here's the example, exact and ready to copy-paste, bestie:

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");

  /* January 1, 2020 is 1577833200 */
  curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);

  /* If-Modified-Since the above time stamp */
  curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);

  /* Perform the request */
  res = curl_easy_perform(curl);

  if(!res) {
    /* check the time condition */
    long unmet;
    res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
    if(!res) {
      printf("The time condition was %sfulfilled\n", unmet?"NOT":"");
    }
  }
}

That's the example as the page lays it out. πŸ“

πŸ¦‹ AVAILABILITY πŸ¦‹

Added in 7.19.4. She's been around. πŸ‘‘

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. Simple as that. ✨

πŸŽ€ SEE ALSO πŸŽ€

The friends of this page:


From libcurl 7.44.0, dated 1 Sep 2015 β€” mwah, go forth and conditional-request, bestie. πŸ’–βœ¨

πŸ“¦ where this page comes from