switch on private (browser only) caching for read mail bodys, plus fix to switch it on after session was started

This commit is contained in:
Ralf Becker 2014-01-18 14:52:47 +00:00
parent e8e8224341
commit 496c34614d
2 changed files with 18 additions and 11 deletions

View File

@ -3229,6 +3229,7 @@ blockquote[type=cite] {
$folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder
$messageID = $uidA['msgUID'];
$bodyResponse = $this->get_load_email_data($messageID,'',$folder);
egw_session::cache_control(true);
//error_log(array2string($bodyResponse));
echo $bodyResponse;
@ -3596,7 +3597,7 @@ blockquote[type=cite] {
// if we move the folder within the same parent-branch of the tree, there is no need no refresh the upper part
if (strlen($parentFolder)>strlen($oldParentFolder) && strpos($parentFolder,$oldParentFolder)!==false) unset($refreshData[$profileID.self::$delimiter.$parentFolder]);
if (count($refreshData)>1 && strlen($oldParentFolder)>strlen($parentFolder) && strpos($oldParentFolder,$parentFolder)!==false) unset($refreshData[$profileID.self::$delimiter.$oldParentFolder]);
// Send full info back in the response
foreach($refreshData as $folder => &$name)
{

View File

@ -1682,25 +1682,31 @@ class egw_session
// session already started
if (isset($_SESSION))
{
if (isset($expire) && (session_cache_limiter() !== 'public' || $expire !== session_cache_expire()))
if ($expire && (session_cache_limiter() !== ($expire===true?'private_no_expire':'public') ||
is_int($expire) && $expire/60 !== session_cache_expire()))
{
if (headers_sent($file, $line))
{
error_log(__METHOD__."($expire) called, but header already sent in $file: $line");
return;
}
if($expire === true)
{
header('Cache-Control: private, max-age='.(60*session_cache_expire()));
}
else
{
header('Cache-Control: public, max-age='.$expire);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expire) . ' GMT');
// remove Pragma header, might be set by old header
if (function_exists('header_remove')) // PHP 5.3+
{
header_remove('Pragma');
}
else
{
header('Pragma:');
}
}
// remove Pragma header, might be set by old header
if (function_exists('header_remove')) // PHP 5.3+
{
header_remove('Pragma');
}
else
{
header('Pragma:');
}
}
}