CURLINFO_CONDITION_UNMET.3 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. .\" generated by cd2nroff 0.1 from CURLINFO_CONDITION_UNMET.md
  2. .TH CURLINFO_CONDITION_UNMET 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_CONDITION_UNMET \- get info on unmet time conditional or 304 HTTP response.
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONDITION_UNMET,
  9. long *unmet);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a long to receive the number 1 if the condition provided in
  13. the previous request did not match (see \fICURLOPT_TIMECONDITION(3)\fP). Alas,
  14. if this returns a 1 you know that the reason you did not get data in return is
  15. because it did not fulfill the condition. The long this argument points to
  16. gets a zero stored if the condition instead was met. This can also return 1 if
  17. the server responded with a 304 HTTP status code, for example after sending a
  18. custom "If\-Match\-*" header.
  19. .SH PROTOCOLS
  20. This functionality affects http only
  21. .SH EXAMPLE
  22. .nf
  23. int main(void)
  24. {
  25. CURL *curl = curl_easy_init();
  26. if(curl) {
  27. CURLcode res;
  28. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  29. /* January 1, 2020 is 1577833200 */
  30. curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
  31. /* If-Modified-Since the above time stamp */
  32. curl_easy_setopt(curl, CURLOPT_TIMECONDITION,
  33. (long)CURL_TIMECOND_IFMODSINCE);
  34. /* Perform the request */
  35. res = curl_easy_perform(curl);
  36. if(!res) {
  37. /* check the time condition */
  38. long unmet;
  39. res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
  40. if(!res) {
  41. printf("The time condition was %sfulfilled\\n", unmet?"NOT":"");
  42. }
  43. }
  44. }
  45. }
  46. .fi
  47. .SH AVAILABILITY
  48. Added in curl 7.19.4
  49. .SH RETURN VALUE
  50. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  51. .SH SEE ALSO
  52. .BR CURLOPT_TIMECONDITION (3),
  53. .BR CURLOPT_TIMEVALUE (3),
  54. .BR curl_easy_getinfo (3),
  55. .BR curl_easy_setopt (3)