From 4fd5b62194c37cf296d3f9c8babfb14f897c2d93 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 8 Jun 2012 11:49:12 +0200 Subject: Add Content-Length for attachments where possible (#1485478) --- CHANGELOG | 1 + program/steps/mail/get.inc | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index b1bd50e8c..b423f7cbc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Add Content-Length for attachments where possible (#1485478) - Fix attachment sizes in message print page and attachment preview page (#1488515) - Fix XSS vulnerability in message subject handling using Larry skin (#1488519) - Fix handling of links with various URI schemes e.g. "skype:" (#1488106) diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index 658538a20..bcd57dee0 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -199,13 +199,18 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) { $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); } } -- cgit v1.2.3