From 7f92799f678efdf44f0f4d3322f49498749e4468 Mon Sep 17 00:00:00 2001 From: Murray Stokely Date: Mon, 15 Dec 2008 08:27:44 +0000 Subject: Add support for HTTP 1.1 If-Modified-Since behavior. fetch(1) accepts a new argument -i that if specified will cause the file to be downloaded only if it is more recent than the mtime of . libfetch(3) accepts the mtime in the url structure and a flag to indicate when this behavior is desired. PR: bin/87841 Submitted by: Jukka A. Ukkonen (partially) Reviewed by: des, ru MFC after: 3 weeks --- lib/libfetch/fetch.3 | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'lib/libfetch/fetch.3') diff --git a/lib/libfetch/fetch.3 b/lib/libfetch/fetch.3 index 81b716409059..9b312b0a1f1f 100644 --- a/lib/libfetch/fetch.3 +++ b/lib/libfetch/fetch.3 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 18, 2007 +.Dd December 14, 2008 .Dt FETCH 3 .Os .Sh NAME @@ -165,9 +165,16 @@ struct url { char *doc; off_t offset; size_t length; + time_t ims_time; }; .Ed .Pp +The +.Va ims_time +field stores the time value for +.Li If-Modified-Since +HTTP requests. +.Pp The pointer returned by .Fn fetchMakeURL or @@ -353,6 +360,22 @@ and .Fn fetchPutHTTP will use a direct connection even if a proxy server is defined. .Pp +If the +.Ql i +(if-modified-since) flag is specified, and +the +.Va ims_time +field is set in +.Vt "struct url" , +then +.Fn fetchXGetHTTP +and +.Fn fetchGetHTTP +will send a conditional +.Li If-Modified-Since +HTTP header to only fetch the content if it is newer than +.Va ims_time . +.Pp Since there seems to be no good way of implementing the HTTP PUT method in a manner consistent with the rest of the .Nm fetch -- cgit v1.2.3