diff options
| author | Garrett Wollman <wollman@FreeBSD.org> | 1999-01-15 16:56:22 +0000 |
|---|---|---|
| committer | Garrett Wollman <wollman@FreeBSD.org> | 1999-01-15 16:56:22 +0000 |
| commit | c1468430965eeec2be29418d5205a40253de3acf (patch) | |
| tree | 142635cf3b6cc32f85614a63a8262565a21edf0e /usr.bin | |
| parent | 82bbdcdaedd927c7d3f00c17a44c295b70f82d58 (diff) | |
Notes
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/fetch/fetch.1 | 34 | ||||
| -rw-r--r-- | usr.bin/fetch/http.c | 18 |
2 files changed, 48 insertions, 4 deletions
diff --git a/usr.bin/fetch/fetch.1 b/usr.bin/fetch/fetch.1 index ccbc80c780f0..f3be659841fa 100644 --- a/usr.bin/fetch/fetch.1 +++ b/usr.bin/fetch/fetch.1 @@ -1,7 +1,7 @@ -.\" $Id: fetch.1,v 1.25 1998/11/08 23:18:47 des Exp $ -.Dd July 2, 1996 +.\" $Id: fetch.1,v 1.26 1998/12/08 13:00:48 cracauer Exp $ +.Dd January 15, 1999 .Dt FETCH 1 -.Os FreeBSD 2.2 +.Os FreeBSD 3.1 .Sh NAME .Nm fetch .Nd retrieve a file by Uniform Resource Locator @@ -316,6 +316,16 @@ connection. .Sh SEE ALSO .Xr ftp 1 , .Xr tftp 1 +.Rs +.%A R. Fielding +.%A J. Gettys +.%A J. Mogul +.%A H. Frystyk +.%A T. Berners-Lee +.%T "Hypertext Transfer Protocol \-\- HTTP/1.1" +.%O RFC 2068 +.%D January 1997 +.Re .Sh HISTORY The .Nm fetch @@ -371,3 +381,21 @@ and .Fl b involves a minimum of two round trips (for small replies), one less than other implementations. +.Pp +The +.Tn HTTP +standard requires interpretation of the +.Tn RFC 850 +date format, which does not provide a century indication. Versions of +.Nm fetch +prior to +.Fx 3.1 +would interpret all such dates as being in the 1900s. This version of +.Nm fetch +interprets such dates according to the rule given in +.Tn RFC 2068 : +.Bd -literal -offset indent + o HTTP/1.1 clients and caches should assume that an RFC-850 date + which appears to be more than 50 years in the future is in fact + in the past (this helps solve the "year 2000" problem). +.Ed diff --git a/usr.bin/fetch/http.c b/usr.bin/fetch/http.c index ff8d25f8035c..6d3fe267c198 100644 --- a/usr.bin/fetch/http.c +++ b/usr.bin/fetch/http.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: http.c,v 1.21 1998/10/26 02:39:21 fenner Exp $ + * $Id: http.c,v 1.22 1998/12/08 13:00:49 cracauer Exp $ */ #include <sys/types.h> @@ -1394,6 +1394,14 @@ parse_http_date(char *string) tm.tm_year = i - 1900; } else { /* Monday, 27-Jan-97 14:31:09 stuffwedon'tcareabout */ + /* Quoth RFC 2068: + o HTTP/1.1 clients and caches should assume that an RFC-850 date + which appears to be more than 50 years in the future is in fact + in the past (this helps solve the "year 2000" problem). + */ + time_t now; + struct tm *tmnow; + int this2dyear; char *comma = strchr(string, ','); char mname[4]; @@ -1415,6 +1423,14 @@ parse_http_date(char *string) if (i >= 12) return -1; tm.tm_mon = i; + /* + * RFC 2068 year interpretation. + */ + time(&now); + tmnow = gmtime(&now); + this2dyear = tmnow->tm_year % 100; + if (tm.tm_year - this2dyear >= 50) + tm.tm_year += 100; } #undef digit |
