"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?
