From e4baf0ee0d63b4552db2964089bdf5e573afddfe Mon Sep 17 00:00:00 2001 From: tokul Date: Sun, 30 Apr 2006 05:46:14 +0000 Subject: [PATCH] Fixed session lockups on large attachment downloads. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11099 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + src/download.php | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ff9693b..7ac16f7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,6 +44,7 @@ Version 1.5.2 - CVS broke detection of unsubscribed special folders. - Undo extra sanitizing in decodeHeader() function (#1460638). - Added workaround for broken OpenBSD 3.8+ setlocale() function (#1427512). + - Fixed session lockups on large attachment downloads. Version 1.5.1 (branched on 2006-02-12) -------------------------------------- diff --git a/src/download.php b/src/download.php index e7c2dc36..a90e97be 100644 --- a/src/download.php +++ b/src/download.php @@ -133,6 +133,18 @@ if (strlen($filename) < 1) { $filename = $filename . '.' . $suffix; } +/** + * Update mailbox_cache and close session in order to prevent + * script locking on larger downloads. SendDownloadHeaders() and + * mime_print_body_lines() don't write information to session. + * mime_print_body_lines() call duration depends on size of + * attachment and script can cause interface lockups, if session + * is not closed. + */ +$mailbox_cache[$aMailbox['NAME']] = $aMailbox; +sqsession_register($mailbox_cache,'mailbox_cache'); +session_write_close(); + /* * Note: * The following sections display the attachment in different @@ -156,7 +168,5 @@ if (isset($absolute_dl) && $absolute_dl) { /* be aware that any warning caused by download.php will corrupt the * attachment in case of ERROR reporting = E_ALL and the output is the screen */ mime_print_body_lines ($imapConnection, $passed_id, $ent_id, $encoding); -$mailbox_cache[$aMailbox['NAME']] = $aMailbox; -sqsession_register($mailbox_cache,'mailbox_cache'); ?> \ No newline at end of file -- 2.25.1