Hi.

I’m looking at:

# Return true if the count of $hdr headers are within the given range
sub check_header_count_range {
 my ($self, $pms, $hdr, $min, $max) = @_;
 my %uniq = ();
 my @hdrs = grep(!$uniq{$_}++, $pms->{msg}->get_header ($hdr));
 return (scalar @hdrs >= $min && scalar @hdrs <= $max);
}

in HeaderEval.pm and I’m not getting it.  It inserts (once and only once) each 
occurrence of a unique RHS for the header X.  So if I had:

X-yzzy: A
X-yzzy: A
X-yzzy: B
X-yzzy: C

Then $uniq{A} would be 2, $uniq${B} would be 1, and $uniq{C} would be 1, so the 
number of elements in @hdrs would be 3, once each for ‘A’, ‘B’, and ‘C’.

But if I have:

X-yzzy: A
X-yzzy: A
X-yzzy: A
X-yzzy: A

then $uniq{A} is 4, but the number of elements in @hdrs would be 1 (because of 
the ‘!’ which only passes the first).

This seems counter-intuitive.  What if I want to count the absolute number of 
headers of type ‘X-yzzy:’ regardless of their RHS?

I’ve been seeing a lot of Spam recently with duplicative Received-SPF: lines, 
but since they are all identical, it’s not nudging the number of @hdrs past one.

Thanks,

-Philip

Reply via email to