From 1d9392e4ffb2761e11299fc26706bc896fb655c1 Mon Sep 17 00:00:00 2001 From: indiri69 Date: Fri, 16 Aug 2002 16:17:21 +0000 Subject: [PATCH] X- style headers are optional and don't us comments like other headers. So 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 | 52 +++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/class/mime.class.php b/class/mime.class.php index 363f5400..98b9e602 100644 --- a/class/mime.class.php +++ b/class/mime.class.php @@ -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 +?> -- 2.25.1