[patch] make mail headers rfc822 conformant

Matthias Klose doko at CS.TU-BERLIN.DE
Sun Aug 31 17:37:41 IST 2003


Antony Stone writes:
> On Sunday 31 August 2003 4:32 pm, Matthias Klose wrote:
>
> > rfc822 doesn't allow mixed-case words
>
> Er, from http://www.faqs.org/rfcs/rfc822.html :
>
>  3.4.7.  CASE INDEPENDENCE
>
>         Except as noted, alphabetic strings may be represented in  any
>         combination of upper and lower case.  The only syntactic units
>         which requires preservation of case information are:
>
>                     -  text
>                     -  qtext
>                     -  dtext
>                     -  ctext
>                     -  quoted-pair
>                     -  local-part, except "Postmaster"
>
>         When matching any other syntactic unit, case is to be ignored.
>         For  example, the field-names "From", "FROM", "from", and even
>         "FroM" are semantically equal and should all be treated ident-
>         ically.
>
>         When generating these units, any mix of upper and  lower  case
>         alphabetic  characters  may  be  used.  The case shown in this
>         specification is suggested for message-creating processes.
>
>         Note:  The reserved local-part address unit, "Postmaster",  is
>                an  exception.   When  the  value "Postmaster" is being
>                interpreted, it must be  accepted  in  any  mixture  of
>                case, including "POSTMASTER", and "postmaster".
>
>
> My reading of this is that MixedCase is perfatcly acceptable, although mail
> programs are not required to pay any attention to the particular case chosen.
> "Mail Header = X-MailScanner:" should be treated just the same as
> "Mail Header = X-Mailscanner:", and both are equally valid.
>
> Please redirect me if I didn't find the correct bit of RFC822 which says that
> mixed case is disallowed.

Got this from MailTools (Header.pm):

# attempt to change the case of a tag to that required by RFC822. That
# being all characters are lowercase except the first of each word. Also
# if the word is an `acronym' then all characters are uppercase. We decide
# a word is an acronym if it does not contain a vowel.

sub _tag_case
{
 my $tag = shift;
 $tag =~ s/\:$//;

 join('-',
     map { /^[b-df-hj-np-tv-z]+$|^MIME$/i ? uc($_) : ucfirst(lc($_)) }
         split('-', $tag));
}


It's a small matter, but since I noticed it, I might as well report
it.  I noticed that the "disinfected" header field name used different
capitalization than the "clean" header.  The reason is that
mailscanner itself adds the "clean" header, while it calls
MIME::Entity to add the "disinfected" header.  That Perl package
normalizes the capitalization.

Although this was reported for mailscanner 3.24.



More information about the MailScanner mailing list