Gilles Detillieux (email@example.com)
Wed, 3 Feb 1999 11:20:44 -0600 (CST)
According to denis filipetti:
> Header line: Last-Modified: 27 Jan 1999 01:12:44 GMT
> [main] C:\OPT\WWW\HTDIG\BIN\HTDIG.EXE 1427 (0) handle_exceptions: Exception:
As Geoff mentioned, this Last-Modified header is non-compliant with the
standard. However, since 3.1.0b4, we've already made an exception for
servers that spit out bad weekdays, so why not allow missing weekdays too?
As promised, here's my getdate() patch for the 3.1.0b4 source code.
I've tested it on my server, with htdig from the latest snapshot.
I back-ported the whole getdate function to the old b4 source, but haven't
tried it out there. I'd appreciate some feedback, especially from users
of systems that have had problems with mystrptime/strftime in the past.
I've posted a patch for 3.1.0dev-013199 separately. Please grab the
one that is applicable to your source.
By the way, Denis, the second of your three attempts was legible.
However, your mail client doesn't seem to generate proper MIME headers,
or your SMTP server (or maybe htdig.org's list server) is messing them up.
When I try to unpack your multi-part MIME messages in metamail, it chokes
on them. All I can do is look at the raw message, which is readable when
it's just plain text.
--- htdig/Document.cc.datebugb4 Tue Dec 22 19:53:12 1998
+++ htdig/Document.cc Wed Feb 3 10:39:27 1999
@@ -290,9 +290,9 @@
- String d = datestring;
struct tm tm;
+ char *s;
// Two possible time designations:
@@ -300,21 +300,31 @@
// Thu, 01 May 1997 00:40:42 GMT
- if (d.indexOf(',') > 3)
- mystrptime(d.get(), "%a, %d-%b-%y %T", &tm);
+ // We strip off the weekday before sending to strptime
+ // because some servers send invalid weekdays!
+ // (Some don't even send a weekday, but we'll be flexible...)
+ s = strchr(datestring, ',');
+ if (s)
- mystrptime(d.get(), "%a, %d %b %Y %T", &tm);
- if (&tm != NULL) // We hope it isn't NULL!
+ s = datestring;
+ while (isspace(*s))
+ if (strchr(s, '-') && mystrptime(s, "%d-%b-%y %T", &tm) ||
+ mystrptime(s, "%d %b %Y %T", &tm))
+ // correct for mystrptime, if %Y format saw only a 2 digit year
if (tm.tm_year < 0)
tm.tm_year += 1900;
if (debug > 2)
- cout << "Translated " << d << " to ";
+ cout << "Translated " << datestring << " to ";
- strftime(buffer, sizeof(buffer), "%a, %d %b %Y %T", &tm);
+ // Leave out %a for weekday, because we don't set it anymore...
+ //strftime(buffer, sizeof(buffer), "%a, %d %b %Y %T", &tm);
+ strftime(buffer, sizeof(buffer), "%d %b %Y %T", &tm);
cout << buffer << " (" << tm.tm_year << ")" << endl;
@@ -325,6 +335,11 @@
+ if (debug > 2)
+ cout << "Cannot translate " << datestring <<
+ ", using current time" << endl;
ret = time(0); // This isn't the best, but it works. *fix*
if (debug > 2)
-- Gilles R. Detillieux E-mail: <firstname.lastname@example.org> Spinal Cord Research Centre WWW: http://www.scrc.umanitoba.ca/~grdetil Dept. Physiology, U. of Manitoba Phone: (204)789-3766 Winnipeg, MB R3E 3J7 (Canada) Fax: (204)789-3930 ------------------------------------ To unsubscribe from the htdig mailing list, send a message to email@example.com containing the single word "unsubscribe" in the SUBJECT of the message.
This archive was generated by hypermail 2.0b3 on Wed Feb 10 1999 - 17:09:05 PST