diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-01-25 23:05:24 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-01-30 08:29:59 +0100 |
commit | 8f69a9f28abf98a10a50b3bae5ba319660de82ee (patch) | |
tree | 2b0eea6d076cd97763f0ce5dde7feed742cfe142 /docs/libcurl | |
parent | 9caa3e248da91dc8964328b5b50491ba05df7bd4 (diff) |
time: support > year 2038 time stamps for system with 32bit long
... with the introduction of CURLOPT_TIMEVALUE_LARGE and
CURLINFO_FILETIME_T.
Fixes #2238
Closes #2264
Diffstat (limited to 'docs/libcurl')
-rw-r--r-- | docs/libcurl/curl_easy_getinfo.3 | 7 | ||||
-rw-r--r-- | docs/libcurl/curl_easy_setopt.3 | 4 | ||||
-rw-r--r-- | docs/libcurl/opts/CURLINFO_FILETIME.3 | 11 | ||||
-rw-r--r-- | docs/libcurl/opts/CURLINFO_FILETIME_T.3 | 71 | ||||
-rw-r--r-- | docs/libcurl/opts/CURLOPT_TIMEVALUE.3 | 5 | ||||
-rw-r--r-- | docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 | 64 | ||||
-rw-r--r-- | docs/libcurl/opts/Makefile.inc | 2 | ||||
-rw-r--r-- | docs/libcurl/symbols-in-versions | 2 |
8 files changed, 157 insertions, 9 deletions
diff --git a/docs/libcurl/curl_easy_getinfo.3 b/docs/libcurl/curl_easy_getinfo.3 index 3edef83e2..c306937ae 100644 --- a/docs/libcurl/curl_easy_getinfo.3 +++ b/docs/libcurl/curl_easy_getinfo.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -54,8 +54,9 @@ See \fICURLINFO_HTTP_CONNECTCODE(3)\fP The http version used in the connection. See \fICURLINFO_HTTP_VERSION(3)\fP .IP CURLINFO_FILETIME -Remote time of the retrieved document. -See \fICURLINFO_FILETIME(3)\fP +Remote time of the retrieved document. See \fICURLINFO_FILETIME(3)\fP +.IP CURLINFO_FILETIME_T +Remote time of the retrieved document. See \fICURLINFO_FILETIME_T(3)\fP .IP CURLINFO_TOTAL_TIME Total time of previous transfer. See \fICURLINFO_TOTAL_TIME(3)\fP diff --git a/docs/libcurl/curl_easy_setopt.3 b/docs/libcurl/curl_easy_setopt.3 index 2982056f0..0249e6bbc 100644 --- a/docs/libcurl/curl_easy_setopt.3 +++ b/docs/libcurl/curl_easy_setopt.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -421,6 +421,8 @@ Maximum file size to get. See \fICURLOPT_MAXFILESIZE_LARGE(3)\fP Make a time conditional request. See \fICURLOPT_TIMECONDITION(3)\fP .IP CURLOPT_TIMEVALUE Time value for the time conditional request. See \fICURLOPT_TIMEVALUE(3)\fP +.IP CURLOPT_TIMEVALUE_LARGE +Time value for the time conditional request. See \fICURLOPT_TIMEVALUE_LARGE(3)\fP .SH CONNECTION OPTIONS .IP CURLOPT_TIMEOUT Timeout for the entire request. See \fICURLOPT_TIMEOUT(3)\fP diff --git a/docs/libcurl/opts/CURLINFO_FILETIME.3 b/docs/libcurl/opts/CURLINFO_FILETIME.3 index 8e1bb981f..3b13bd7e3 100644 --- a/docs/libcurl/opts/CURLINFO_FILETIME.3 +++ b/docs/libcurl/opts/CURLINFO_FILETIME.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -34,9 +34,12 @@ Pass a pointer to a long to receive the remote time of the retrieved document hide it or the server doesn't support the command that tells document time etc) and the time of the document is unknown. -Note that you must tell the server to collect this information before the -transfer is made, by using the \fICURLOPT_FILETIME(3)\fP option to -\fIcurl_easy_setopt(3)\fP or you will unconditionally get a -1 back. +You must tell libcurl to collect this information before the transfer is made, +by using the \fICURLOPT_FILETIME(3)\fP option to \fIcurl_easy_setopt(3)\fP or +you will unconditionally get a -1 back. + +Consider using \fICURLINFO_FILETIME_T(3)\fP to be able to extract dates beyond +the year 2038 on systems using 32 bit longs. .SH PROTOCOLS HTTP(S), FTP(S), SFTP .SH EXAMPLE diff --git a/docs/libcurl/opts/CURLINFO_FILETIME_T.3 b/docs/libcurl/opts/CURLINFO_FILETIME_T.3 new file mode 100644 index 000000000..d8853ccd2 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_FILETIME_T.3 @@ -0,0 +1,71 @@ +.\" ************************************************************************** +.\" * _ _ ____ _ +.\" * Project ___| | | | _ \| | +.\" * / __| | | | |_) | | +.\" * | (__| |_| | _ <| |___ +.\" * \___|\___/|_| \_\_____| +.\" * +.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * +.\" * This software is licensed as described in the file COPYING, which +.\" * you should have received as part of this distribution. The terms +.\" * are also available at https://curl.haxx.se/docs/copyright.html. +.\" * +.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell +.\" * copies of the Software, and permit persons to whom the Software is +.\" * furnished to do so, under the terms of the COPYING file. +.\" * +.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +.\" * KIND, either express or implied. +.\" * +.\" ************************************************************************** +.\" +.TH CURLINFO_FILETIME 3 "25 Jan 2018" "libcurl 7.59.0" "curl_easy_getinfo options" +.SH NAME +CURLINFO_FILETIME_T \- get the remote time of the retrieved document +.SH SYNOPSIS +#include <curl/curl.h> + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME_T, curl_off_t *timep); +.SH DESCRIPTION +Pass a pointer to a curl_off_t to receive the remote time of the retrieved +document (in number of seconds since 1 jan 1970 in the GMT/UTC time zone). If +you get -1, it can be because of many reasons (it might be unknown, the server +might hide it or the server doesn't support the command that tells document +time etc) and the time of the document is unknown. + +You must ask libcurl to collect this information before the transfer is made, +by using the \fICURLOPT_FILETIME(3)\fP option to \fIcurl_easy_setopt(3)\fP or +you will unconditionally get a -1 back. + +This option is an alternative to \fICURLINFO_FILETIME(3)\fP to allow systems +with 32 bit long variables to extract dates outside of the 32bit timestamp +range. +.SH PROTOCOLS +HTTP(S), FTP(S), SFTP +.SH EXAMPLE +.nf +curl = curl_easy_init(); +if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, url); + /* Ask for filetime */ + curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + curl_off_t filetime; + res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime); + if((CURLE_OK == res) && (filetime >= 0)) { + time_t file_time = (time_t)filetime; + printf("filetime %s: %s", filename, ctime(&file_time)); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); +} +.fi +.SH AVAILABILITY +Added in 7.59.0 +.SH RETURN VALUE +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. +.SH "SEE ALSO" +.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " diff --git a/docs/libcurl/opts/CURLOPT_TIMEVALUE.3 b/docs/libcurl/opts/CURLOPT_TIMEVALUE.3 index cd745ffa7..66c582d07 100644 --- a/docs/libcurl/opts/CURLOPT_TIMEVALUE.3 +++ b/docs/libcurl/opts/CURLOPT_TIMEVALUE.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -31,6 +31,9 @@ CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE, long val); Pass a long \fIval\fP as parameter. This should be the time counted as seconds since 1 Jan 1970, and the time will be used in a condition as specified with \fICURLOPT_TIMECONDITION(3)\fP. + +On systems with 32 bit 'long' variables, this option cannot set dates beyond +the year 2038. Consider \fICURLOPT_TIMEVALUE_LARGE(3)\fP instead. .SH DEFAULT 0 .SH PROTOCOLS diff --git a/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 b/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 new file mode 100644 index 000000000..884b51236 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 @@ -0,0 +1,64 @@ +.\" ************************************************************************** +.\" * _ _ ____ _ +.\" * Project ___| | | | _ \| | +.\" * / __| | | | |_) | | +.\" * | (__| |_| | _ <| |___ +.\" * \___|\___/|_| \_\_____| +.\" * +.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * +.\" * This software is licensed as described in the file COPYING, which +.\" * you should have received as part of this distribution. The terms +.\" * are also available at https://curl.haxx.se/docs/copyright.html. +.\" * +.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell +.\" * copies of the Software, and permit persons to whom the Software is +.\" * furnished to do so, under the terms of the COPYING file. +.\" * +.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +.\" * KIND, either express or implied. +.\" * +.\" ************************************************************************** +.\" +.TH CURLOPT_TIMEVALUE_LARGE 3 "25 Jan 2018" "libcurl 7.59.0" "curl_easy_setopt options" +.SH NAME +CURLOPT_TIMEVALUE_LARGE \- set time value for conditional +.SH SYNOPSIS +#include <curl/curl.h> + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE_LARGE, curl_off_t val); +.SH DESCRIPTION +Pass a curl_off_t \fIval\fP as parameter. This should be the time counted as +seconds since 1 Jan 1970, and the time will be used in a condition as +specified with \fICURLOPT_TIMECONDITION(3)\fP. + +The difference between this option and \fICURLOPT_TIMEVALUE(3)\fP is the type +of the argument. On systems where 'long' is only 32 bit wide, this option has +to be used to set dates beyond the year 2038. +.SH DEFAULT +0 +.SH PROTOCOLS +HTTP, FTP, RTSP, and FILE +.SH EXAMPLE +.nf +CURL *curl = curl_easy_init(); +if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + + /* January 1, 2020 is 1577833200 */ + curl_easy_setopt(curl, CURLOPT_TIMEVALUE_LARGE, (curl_off_t)1577833200); + + /* If-Modified-Since the above time stamp */ + curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); + + /* Perform the request */ + curl_easy_perform(curl); +} +.fi +.SH AVAILABILITY +Added in 7.59.0. +.SH RETURN VALUE +Returns CURLE_OK +.SH "SEE ALSO" +.BR CURLOPT_TIMECONDITION "(3), " +.BR CURLOPT_TIMEVALUE_LARGE "(3), " diff --git a/docs/libcurl/opts/Makefile.inc b/docs/libcurl/opts/Makefile.inc index f710b5eb3..22a54c399 100644 --- a/docs/libcurl/opts/Makefile.inc +++ b/docs/libcurl/opts/Makefile.inc @@ -14,6 +14,7 @@ man_MANS = \ CURLINFO_COOKIELIST.3 \ CURLINFO_EFFECTIVE_URL.3 \ CURLINFO_FILETIME.3 \ + CURLINFO_FILETIME_T.3 \ CURLINFO_FTP_ENTRY_PATH.3 \ CURLINFO_HEADER_SIZE.3 \ CURLINFO_HTTPAUTH_AVAIL.3 \ @@ -301,6 +302,7 @@ man_MANS = \ CURLOPT_TIMEOUT.3 \ CURLOPT_TIMEOUT_MS.3 \ CURLOPT_TIMEVALUE.3 \ + CURLOPT_TIMEVALUE_LARGE.3 \ CURLOPT_TLSAUTH_PASSWORD.3 \ CURLOPT_TLSAUTH_TYPE.3 \ CURLOPT_TLSAUTH_USERNAME.3 \ diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions index ab899b9b0..306b7a845 100644 --- a/docs/libcurl/symbols-in-versions +++ b/docs/libcurl/symbols-in-versions @@ -220,6 +220,7 @@ CURLINFO_DOUBLE 7.4.1 CURLINFO_EFFECTIVE_URL 7.4 CURLINFO_END 7.9.6 CURLINFO_FILETIME 7.5 +CURLINFO_FILETIME_T 7.59.0 CURLINFO_FTP_ENTRY_PATH 7.15.4 CURLINFO_HEADER_IN 7.9.6 CURLINFO_HEADER_OUT 7.9.6 @@ -587,6 +588,7 @@ CURLOPT_TIMECONDITION 7.1 CURLOPT_TIMEOUT 7.1 CURLOPT_TIMEOUT_MS 7.16.2 CURLOPT_TIMEVALUE 7.1 +CURLOPT_TIMEVALUE_LARGE 7.59.0 CURLOPT_TLSAUTH_PASSWORD 7.21.4 CURLOPT_TLSAUTH_TYPE 7.21.4 CURLOPT_TLSAUTH_USERNAME 7.21.4 |