[Mimedefang] Help with header checking

Joseph Brennan brennan at columbia.edu
Tue Dec 1 13:10:43 EST 2020


We used this to create an array of header information:

if (open(IN, '<', './HEADERS')) {
        while(<IN>) {
            chomp;
            if (/^(\S+):\s*(.*)/) {
                my $label = $1;
                my $data  = $2;
                $label = lc($label);
                $Header{$label} = $data;
                if ($label eq 'received') {
                    push(@Received,$data);
                }
        }
        close(IN);
    }


So following this, if for example we want to test the From: header, we
check $Header{'from'}
Received: was handled specially. It could end up an empty list. I
don't think we checked for that!

Hmm... If HEADERS was not there (??) it fails silently and
$Header{'anything'} is empty. The rest of filter still works,
but maybe we should have logged that case.



-- 
Joseph Brennan
Lead, Email and Systems Applications
Columbia University Information Technology



More information about the MIMEDefang mailing list