From 07c49f57decba87bc96e9ad2d36a835ff818bec9 Mon Sep 17 00:00:00 2001 From: braverock Date: Tue, 25 Nov 2003 19:58:35 +0000 Subject: [PATCH] added content-length header as an optional parameter to senddownloadheaders fn git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6198 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mime.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/functions/mime.php b/functions/mime.php index 1b48a431..0f810a82 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -23,7 +23,7 @@ require_once(SM_PATH . 'functions/attachment_common.php'); /** * Get the MIME structure - * + * * This function gets the structure of a message and stores it in the "message" class. * It will return this object for use with all relevant header information and * fully parsed into the standard "message" object format. @@ -1891,9 +1891,10 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX') { * @param string $type1 second half of mime type * @param string $filename filename to tell the browser for downloaded file * @param boolean $force whether to force the download dialog to pop + * @param integer $filesize optional, send the Content-Header and length to the browser * @return void */ - function SendDownloadHeaders($type0, $type1, $filename, $force) { + function SendDownloadHeaders($type0, $type1, $filename, $force, $filesize=0) { global $languages, $squirrelmail_language; $isIE = $isIE6 = 0; @@ -1954,6 +1955,12 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX') { header("Content-Type: application/octet-stream; name=\"$filename\""); } } - } + + //send the content-length header if the calling function provides it + if ($filesize > 0) { + header("Content-Length: $filesize"); + } + + } // end fn SendDownlaodHeaders ?> -- 2.25.1