/***************************************************************************1* _ _ ____ _2* Project ___| | | | _ \| |3* / __| | | | |_) | |4* | (__| |_| | _ <| |___5* \___|\___/|_| \_\_____|6*7* Copyright (C) Daniel Stenberg, <[email protected]>, et al.8*9* This software is licensed as described in the file COPYING, which10* you should have received as part of this distribution. The terms11* are also available at https://curl.se/docs/copyright.html.12*13* You may opt to use, copy, modify, merge, publish, distribute and/or sell14* copies of the Software, and permit persons to whom the Software is15* furnished to do so, under the terms of the COPYING file.16*17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY18* KIND, either express or implied.19*20* SPDX-License-Identifier: curl21*22***************************************************************************/23#include "test.h"2425#include "memdebug.h"2627CURLcode test(char *URL)28{29long unmet;30CURL *curl = NULL;31CURLcode res = CURLE_OK;3233global_init(CURL_GLOBAL_ALL);3435easy_init(curl);3637easy_setopt(curl, CURLOPT_URL, URL);38easy_setopt(curl, CURLOPT_HEADER, 1L);39easy_setopt(curl, CURLOPT_TIMECONDITION, (long)CURL_TIMECOND_IFMODSINCE);4041/* TIMEVALUE in the future */42easy_setopt(curl, CURLOPT_TIMEVALUE, 1566210680L);4344res = curl_easy_perform(curl);45if(res)46goto test_cleanup;4748curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);49if(unmet != 1L) {50res = TEST_ERR_FAILURE; /* not correct */51goto test_cleanup;52}5354/* TIMEVALUE in the past */55easy_setopt(curl, CURLOPT_TIMEVALUE, 1L);5657res = curl_easy_perform(curl);58if(res)59goto test_cleanup;6061curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);62if(unmet) {63res = TEST_ERR_FAILURE; /* not correct */64goto test_cleanup;65}6667res = TEST_ERR_SUCCESS; /* this is where we should be */6869test_cleanup:7071/* always cleanup */72curl_easy_cleanup(curl);73curl_global_cleanup();7475return res;76}777879