sub get_headers {
my $msg = shift;
my %headers;
- my $current; # current header, used for unfolding lines
+ my $current; # current header, used for unfolding lines
+ my $fieldname; # unmolested header name
open(MSG, $msg);
while (<MSG>) {
$headers{$current} .= $_;
} else {
- ($current) = split(/:/);
+ ($fieldname) = split(/:/);
+ $current = lc($fieldname);
# XXX: Is it correct simply to eat all whitespace between
# the colon and the first text for the header?
# Furthermore, is any space at all required? Or is
# '^Subject:hey$' a perfectly valid header?
- (undef, $headers{$current}) = split(/^$current:\s*/);
+ (undef, $headers{$current}) = split(/^$fieldname:\s*/);
}
}
close(MSG);