procmail
[Top] [All Lists]

Re: Check for RFC822 Date

1999-11-07 16:41:55
++ 07/11/99 23:47 +0100 - Rejo Zenger:
I have tried to create a recipe that looks for a non RFC822 compliant
Date field in the header of a message.

Just an immediate followup to my own posting as i noted two small things
when the post was about to be distributed to the subscribers...

 day        = "(Mon|Tue|Wed|Thu|Fri|Sat|Sun)"
 digit      = "[0-9]"
 month      = "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"
 date       = "$digit?$digit $month $digit$digit"
 hour       = "$digit$digit:$digit$digit(:$digit$digit)?"
 zone       = "(UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|([A-I]|[K-Z])) (+|-) 
$digit$digit$digit$digit"
 time       = "$hour $zone"
[...]
 *$ ! ^Date: ($day, )$date $time$

I have noted two differences with the message that are in my inbox and i
guess they're a result of misinterpretation of the RFC.

1) $zone

This is what the RFC says:

    zone        =  "UT"  / "GMT"                ; Universal Time
                                                ; North American : UT
                /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
                /  "CST" / "CDT"                ;  Central:  - 6/ - 5
                /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
                /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
                /  1ALPHA                       ; Military: Z = UT;
                                                ;  A:-1; (J not used)
                                                ;  M:-12; N:+1; Y:+12
                / ( ("+" / "-") 4DIGIT )        ; Local differential
                                                ;  hours+min. (HHMM)


I guess the zone should have or the two or three lettered zone tag /or/
the four digit hour diff? Which would make the zone var like this:

  zone       = 
"((UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|([A-I]|[K-Z]))|(+|-)$digit$digit$digit$digit)"

Is this correct?


2) $date

This is what the RFC says:

    date        =  1*2DIGIT month 2DIGIT        ; day month year
                                                ;  e.g. 20 Jun 82

So, it says clearly the year should exist as two digit (82) instead of
four digits (1982). However, all the emails i receive have a four digit
indication for the year. If the RFC has changed at this point, i would
be better of with this var for date?

  date       = "$digit?$digit $month (19|20)?$digit$digit"


Thanks in advance, -Rejo.


-- 
= Rejo Zenger  [Sister Ray Crisiscentrum]               
rejo(_at_)sisterray(_dot_)xs4all(_dot_)nl
= http://mediaport.org/~sister                                  PGP: see headers
--------------------------------------------------------------------------------

<Prev in Thread] Current Thread [Next in Thread>