]> diplodocus.org Git - minc/commitdiff
(get_headers): Down-case the header name before using it as a key to
authorepg <>
Sun, 25 Aug 2002 20:02:13 +0000 (20:02 +0000)
committerepg <>
Sun, 25 Aug 2002 20:02:13 +0000 (20:02 +0000)
the hash.

minc

diff --git a/minc b/minc
index 8963d4e..4fc8582 100755 (executable)
--- a/minc
+++ b/minc
@@ -303,7 +303,8 @@ sub store_message {
 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>) {
@@ -322,13 +323,14 @@ sub get_headers {
 
             $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);