- fix: Caching (last-modified bug) (misja / E-Wise)

This commit is contained in:
JT Smith 2007-03-28 18:45:59 +00:00
parent 9b3a18405a
commit c70bf5c256
2 changed files with 4 additions and 1 deletions

View file

@ -266,7 +266,6 @@ sub sendHeader {
$request->content_type($self->getMimeType || "text/html; charset=UTF-8");
my $cacheControl = $self->getCacheControl;
my $date = ($userId eq "1") ? $datetime->epochToHttp($self->getLastModified) : $datetime->epochToHttp;
$request->headers_out->set('Last-Modified' => $date);
# under these circumstances, don't allow caching
if ($userId ne "1" || $cacheControl eq "none" || $self->session->setting->get("preventProxyCache")) {
$request->headers_out->set("Cache-Control" => "private, max-age=1");
@ -274,6 +273,7 @@ sub sendHeader {
}
# in all other cases, set cache, but tell it to ask us every time so we don't mess with recently logged in users
else {
$request->headers_out->set('Last-Modified' => $date);
$request->headers_out->set('Cache-Control' => "must-revalidate, max-age=" . $cacheControl);
# do an extra incantation if the HTTP protocol is really old
if ($request->protocol =~ /(\d\.\d)/ && $1 < 1.1) {