1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_CONDITION_UNMET 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_TIMECONDITION (3) 9 - CURLOPT_TIMEVALUE (3) 10 - curl_easy_getinfo (3) 11 - curl_easy_setopt (3) 12Protocol: 13 - HTTP 14--- 15 16# NAME 17 18CURLINFO_CONDITION_UNMET - get info on unmet time conditional or 304 HTTP response. 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONDITION_UNMET, 26 long *unmet); 27~~~ 28 29# DESCRIPTION 30 31Pass a pointer to a long to receive the number 1 if the condition provided in 32the previous request did not match (see CURLOPT_TIMECONDITION(3)). Alas, 33if this returns a 1 you know that the reason you did not get data in return is 34because it did not fulfill the condition. The long this argument points to 35gets a zero stored if the condition instead was met. This can also return 1 if 36the server responded with a 304 HTTP status code, for example after sending a 37custom "If-Match-*" header. 38 39# EXAMPLE 40 41~~~c 42int main(void) 43{ 44 CURL *curl = curl_easy_init(); 45 if(curl) { 46 CURLcode res; 47 48 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 49 50 /* January 1, 2020 is 1577833200 */ 51 curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L); 52 53 /* If-Modified-Since the above time stamp */ 54 curl_easy_setopt(curl, CURLOPT_TIMECONDITION, 55 (long)CURL_TIMECOND_IFMODSINCE); 56 57 /* Perform the request */ 58 res = curl_easy_perform(curl); 59 60 if(!res) { 61 /* check the time condition */ 62 long unmet; 63 res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet); 64 if(!res) { 65 printf("The time condition was %sfulfilled\n", unmet?"NOT":""); 66 } 67 } 68 } 69} 70~~~ 71 72# AVAILABILITY 73 74Added in 7.19.4 75 76# RETURN VALUE 77 78Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 79