From 4fd5b62194c37cf296d3f9c8babfb14f897c2d93 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 08 Jun 2012 05:49:12 -0400
Subject: [PATCH] Add Content-Length for attachments where possible (#1485478)

---
 program/steps/mail/get.inc |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index 658538a..bcd57de 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -199,13 +199,18 @@
           $sent = $RCMAIL->storage->get_message_part($MESSAGE->uid, $part->mime_id, $part, false, $stdout);
         }
       }
+      // send part as-it-is
       else {
-        // turn off output buffering and print part content
         if ($part->body) {
+          header("Content-Length: " . sizeof($part->body));
           echo $part->body;
           $sent = true;
         }
         else if ($part->size) {
+          if ($size = (int)$part->d_parameters['size']) {
+            header("Content-Length: $size");
+          }
+
           $sent = $RCMAIL->storage->get_message_part($MESSAGE->uid, $part->mime_id, $part, true);
         }
       }

--
Gitblit v1.9.1