aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-01-29 22:41:07 -0500
committerKamil Dudka <kdudka@redhat.com>2011-01-31 14:49:51 +0100
commitb89122a2bf1663f16d0977977c83320470c6d438 (patch)
tree71cfdb23bd21304f2d0cc7ecd3c1ff49dfe314e9
parent99dcb11ed8bd78d3af47c6ce3cc6b1fa4c51fdf8 (diff)
file: add support for CURLOPT_TIMECONDITION
-rw-r--r--docs/curl.16
-rw-r--r--docs/libcurl/curl_easy_setopt.34
-rw-r--r--lib/file.c7
3 files changed, 12 insertions, 5 deletions
diff --git a/docs/curl.1 b/docs/curl.1
index ba7f6108c..093fae597 100644
--- a/docs/curl.1
+++ b/docs/curl.1
@@ -1552,9 +1552,9 @@ not set.
If this option is used several times, the last one will be used.
.IP "-z/--time-cond <date expression>"
-(HTTP/FTP) Request a file that has been modified later than the given time and
-date, or one that has been modified before that time. The date expression can
-be all sorts of date strings or if it doesn't match any internal ones, it
+(HTTP/FTP/FILE) Request a file that has been modified later than the given time
+and date, or one that has been modified before that time. The date expression
+can be all sorts of date strings or if it doesn't match any internal ones, it
tries to get the time from a given file name instead! See the
\fIcurl_getdate(3)\fP man pages for date expression details.
diff --git a/docs/libcurl/curl_easy_setopt.3 b/docs/libcurl/curl_easy_setopt.3
index 95772d2e3..8c772c6e5 100644
--- a/docs/libcurl/curl_easy_setopt.3
+++ b/docs/libcurl/curl_easy_setopt.3
@@ -1648,8 +1648,8 @@ given limit. This concerns both FTP and HTTP transfers.
.IP CURLOPT_TIMECONDITION
Pass a long as parameter. This defines how the \fICURLOPT_TIMEVALUE\fP time
value is treated. You can set this parameter to \fICURL_TIMECOND_IFMODSINCE\fP
-or \fICURL_TIMECOND_IFUNMODSINCE\fP. This feature applies to HTTP, FTP, and
-RTSP.
+or \fICURL_TIMECOND_IFUNMODSINCE\fP. This feature applies to HTTP, FTP, RTSP,
+and FILE.
The last modification time of a file is not always known and in such instances
this feature will have no effect even if the given time condition would not
diff --git a/lib/file.c b/lib/file.c
index 8e4ee075f..aaeed7075 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -463,6 +463,13 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
fstated = TRUE;
}
+ if(fstated && !data->state.range && data->set.timecondition) {
+ if(!Curl_meets_timecondition(data, data->info.filetime)) {
+ *done = TRUE;
+ return CURLE_OK;
+ }
+ }
+
/* If we have selected NOBODY and HEADER, it means that we only want file
information. Which for FILE can't be much more than the file size and
date. */