It's been awhile since I have been able to look into this, but here is a method I think I am going to tryout:


1. Send a Head-only request with a if-unmodified-since (local file date).

2.1 If we recieve the Header, check the file size and download if different.
2.2 if we recieve 412 (Precondition Failed), we send the Get request the recieve the file.




I think this is the most efficient way to perform timestamping as described in the documentation ( and still make use of the http headers made for this purpose). This way we make one request for most files, and two for files that need to be downloaded.

Also I saw an email requesting we create an option to set all downloaded files to the current time. I will also work on implementing this with my patch if youwould like..

Craig Sowadski

From: Hrvoje Niksic <[EMAIL PROTECTED]>
To: "Craig Sowadski" <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED],  [EMAIL PROTECTED]
Subject: Re: wget-cvs-ifmodsince.patch
Date: Sat, 28 Feb 2004 02:52:07 +0100

"Craig Sowadski" <[EMAIL PROTECTED]> writes:

> My only concern about only checking modification date is when there
> is an incomplete download, the local modification date is set to the
> current time. So when the mirror is next attempted, the file is
> marked newer than the server file and is not replaced.

Hmm, you're right -- if-modified-since utterly fails in that (not at
all uncommon) scenario.

> Is there some way to make the local modification date (time_t = 0 )
> until it is finished?? This way the incomplete file will always be
> older than the server file, and will be replaced.

I don't think there's a reliable way to do that.

So, I guess the only correct approach is in fact the one you used in
your patch:

>>1. Send a HEAD request and get the response.
>>
>>2.1. If the response contains the Last-Modified header and it
>>      indicates that the remote file is old, tell the user that there
>>      is no need to get the file.
>>
>>2.2. Otherwise, send a new GET request with `If-Modified-Since'.
>>
>>2.2.1. If the response is "304 Not Modified", tell the user that there
>>        is no need to get the file.
>>
>>2.2.2. If the response is something other than 304, start downloading
>>        the file immediately, without firing up a new request.

The remaining question is: does Wget need the added complexity only to
support servers that don't bother sending Last-Modified, but that do
support If-Modified-Since.  How frequent are such servers anyway?


_________________________________________________________________
All the action. All the drama. Get NCAA hoops coverage at MSN Sports by ESPN. http://msn.espn.go.com/index.html?partnersite=espn




Reply via email to