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