-fix: Stale pages after user login

This commit is contained in:
JT Smith 2007-03-14 19:20:13 +00:00
parent 44a24e62b5
commit 06dbc84312
2 changed files with 16 additions and 18 deletions

View file

@ -1,4 +1,5 @@
7.3.13 7.3.13
- fix: Stale pages after user login
7.3.12 7.3.12
- Performance enhancement added to Page Layouts to make them do template - Performance enhancement added to Page Layouts to make them do template

View file

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