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;

View File

@ -1682,16 +1682,23 @@ 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+
{
@ -1704,7 +1711,6 @@ class egw_session
}
}
}
}
/**
* Get a session list (of the current instance)