d5d7871c9ce692f443b5a1f64194b4abe889f6b8 galt Mon Mar 7 22:21:10 2011 -0800 fixing processing of last-modified header in udc; also setting the original time on the finished file in paraFetch (net.c); new helper function in common.c handles conversion to UTC time diff --git src/lib/udc.c src/lib/udc.c index 3babab6..7e0ec7c 100644 --- src/lib/udc.c +++ src/lib/udc.c @@ -376,44 +376,41 @@ char *lastModString = hashFindValUpperCase(hash, "Last-Modified:"); if (lastModString == NULL) { // Date is a poor substitute! It will always appear that the cache is stale. // But at least we can read files from dropbox.com. lastModString = hashFindValUpperCase(hash, "Date:"); if (lastModString == NULL) { hashFree(&hash); errAbort("No Last-Modified: or Date: returned in header for %s, can't proceed, sorry", url); } } struct tm tm; time_t t; // Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT -// TODO: it's very likely that there are other date string patterns -// out there that might be encountered. +// This will always be GMT if (strptime(lastModString, "%a, %d %b %Y %H:%M:%S %Z", &tm) == NULL) { /* Handle error */; hashFree(&hash); errAbort("unable to parse last-modified string [%s]", lastModString); } -// Not set by strptime(); tells mktime() to determine whether daylight saving time is in effect: -tm.tm_isdst = -1; -t = mktime(&tm); +t = mktimeFromUtc(&tm); if (t == -1) { /* Handle error */; hashFree(&hash); - errAbort("mktime failed while parsing last-modified string [%s]", lastModString); + errAbort("mktimeFromUtc failed while converting last-modified string [%s] to UTC time", lastModString); } retInfo->updateTime = t; hashFree(&hash); return status; } /********* Section for ftp protocol **********/ // fetchData method: See udcDataViaHttpOrFtp above. boolean udcInfoViaFtp(char *url, struct udcRemoteFileInfo *retInfo) /* Gets size and last modified time of FTP URL */ {