X- style headers are optional and don't us comments like other headers. So
authorindiri69 <indiri69@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 16 Aug 2002 16:17:21 +0000 (16:17 +0000)
committerindiri69 <indiri69@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 16 Aug 2002 16:17:21 +0000 (16:17 +0000)
we shouldn't parse them. (RFC 2822 Section 3.6.8)

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3333 7612ce4b-ef26-0410-bec9-ea0150e637f0

class/mime.class.php

index 363f540..98b9e60 100644 (file)
@@ -43,31 +43,33 @@ class rfc822_header
     function parseHeader($hdr)
     {
         if (is_array($hdr))
-       {
-          $hdr = implode('',$hdr);
-       }
+        {
+            $hdr = implode('',$hdr);
+        }
         /* first we unfold the header */
-       $hdr = trim(str_replace(array("\r\n\t","\r\n "),array('',''),$hdr));
-       /* 
-        * now we can make a new header array with each element representing 
-        * a headerline
-        */
-       $hdr = explode("\r\n" , $hdr);  
-       foreach ($hdr as $line)
-       {
-          $pos = strpos($line,':');
-          if ($pos > 0)
-          {
-             $field = substr($line,0,$pos);
-             $value = trim(substr($line,$pos+1));
-             $value = $this->stripComments($value);
-             $this->parseField($field,$value);
-          }
-       }
-       if ($this->content_type == '')
-       {
-          $this->parseContentType('text/plain; charset=us-ascii');
-       }
+        $hdr = trim(str_replace(array("\r\n\t","\r\n "),array('',''),$hdr));
+        /* 
+         * now we can make a new header array with each element representing 
+         * a headerline
+         */
+        $hdr = explode("\r\n" , $hdr);  
+        foreach ($hdr as $line)
+        {
+            $pos = strpos($line,':');
+            if ($pos > 0)
+            {
+                $field = substr($line,0,$pos);
+                $value = trim(substr($line,$pos+1));
+                if(!preg_match('/^X.*/',$value)) {
+                    $value = $this->stripComments($value);
+                }
+                $this->parseField($field,$value);
+            }
+        }
+        if ($this->content_type == '')
+        {
+            $this->parseContentType('text/plain; charset=us-ascii');
+        }
     }
     
     function stripComments($value)
@@ -1698,4 +1700,4 @@ class content_type
     }
 }
 
-?>
\ No newline at end of file
+?>