quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_TIMECONDITION.md (1697B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_TIMECONDITION
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLINFO_FILETIME (3)
      9   - CURLOPT_TIMEVALUE (3)
     10 Protocol:
     11   - HTTP
     12 Added-in: 7.1
     13 ---
     14 
     15 # NAME
     16 
     17 CURLOPT_TIMECONDITION - select condition for a time request
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMECONDITION, long cond);
     25 ~~~
     26 
     27 # DESCRIPTION
     28 
     29 Pass a long as parameter. This defines how the CURLOPT_TIMEVALUE(3) time
     30 value is treated. You can set this parameter to *CURL_TIMECOND_IFMODSINCE*
     31 or *CURL_TIMECOND_IFUNMODSINCE*.
     32 
     33 The last modification time of a file is not always known and in such instances
     34 this feature has no effect even if the given time condition would not have
     35 been met. curl_easy_getinfo(3) with the *CURLINFO_CONDITION_UNMET*
     36 option can be used after a transfer to learn if a zero-byte successful
     37 "transfer" was due to this condition not matching.
     38 
     39 # DEFAULT
     40 
     41 CURL_TIMECOND_NONE (0)
     42 
     43 # %PROTOCOLS%
     44 
     45 # EXAMPLE
     46 
     47 ~~~c
     48 int main(void)
     49 {
     50   CURL *curl = curl_easy_init();
     51   if(curl) {
     52     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     53 
     54     /* January 1, 2020 is 1577833200 */
     55     curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
     56 
     57     /* If-Modified-Since the above time stamp */
     58     curl_easy_setopt(curl, CURLOPT_TIMECONDITION,
     59                      (long)CURL_TIMECOND_IFMODSINCE);
     60 
     61     /* Perform the request */
     62     curl_easy_perform(curl);
     63   }
     64 }
     65 ~~~
     66 
     67 # %AVAILABILITY%
     68 
     69 # RETURN VALUE
     70 
     71 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     72 
     73 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     74 libcurl-errors(3).