No need to send Content-Transfer-Encoding header if it is 7bit
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Mar 2010 19:38:19 +0000 (12:38 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Mar 2010 19:39:11 +0000 (12:39 -0700)
framework/Mime/lib/Horde/Mime/Part.php
framework/Mime/package.xml

index ad31277..8e0ccfc 100644 (file)
@@ -931,8 +931,14 @@ class Horde_Mime_Part
             $headers->replaceHeader('Content-Disposition', $disposition, array('params' => (!empty($name) ? array('filename' => $name) : array())));
         }
 
-        /* Add transfer encoding information. */
-        $headers->replaceHeader('Content-Transfer-Encoding', $this->_getTransferEncoding(empty($options['encode']) ? null : $options['encode']));
+        /* Add transfer encoding information. RFC 2045 [6.1] indicates that
+         * default is 7bit. No need to send the header in this case. */
+        $encoding = $this->_getTransferEncoding(empty($options['encode']) ? null : $options['encode']);
+        if ($encoding == '7bit') {
+            $headers->removeHeader('Content-Transfer-Encoding');
+        } else {
+            $headers->replaceHeader('Content-Transfer-Encoding', $encoding);
+        }
 
         /* Add content ID information. */
         if (!is_null($this->_contentid)) {
index 261a579..a2c7c69 100644 (file)
@@ -31,7 +31,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
   <api>alpha</api>
  </stability>
  <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Default disposition should be empty by default, not inline (RFC 2183 [2]).
+ <notes>
+ * No need to generate Content-Transfer-Encoding header if part data is 7bit.
+ * Default disposition should be empty by default, not inline (RFC 2183 [2]).
  * Request #8556: Allow specifying a header charset for a part.
  * Add 'raw' render view to Horde_Mime_Viewer.
  * Horde_Mime_Part::parseMessage() correctly parses non-MIME parts.