Merge branch 'WebGUI8' into HEAD
This commit is contained in:
commit
373be0881d
871 changed files with 36107 additions and 28933 deletions
|
|
@ -203,19 +203,36 @@ sub getStreamedFile {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 ifModifiedSince ( epoch )
|
||||
=head2 ifModifiedSince ( epoch [, maxCacheTimeout] )
|
||||
|
||||
Returns 1 if the epoch is greater than the modified date check.
|
||||
|
||||
=head3 epoch
|
||||
|
||||
The date that the requested content was last modified in epoch format.
|
||||
|
||||
=head3 maxCacheTimeout
|
||||
|
||||
A modifier to the epoch, that allows us to set a maximum timeout where content will appear to
|
||||
have changed and a new page request will be allowed to be processed.
|
||||
|
||||
=cut
|
||||
|
||||
sub ifModifiedSince {
|
||||
my $self = shift;
|
||||
my $epoch = shift;
|
||||
my $self = shift;
|
||||
my $epoch = shift;
|
||||
my $maxCacheTimeout = shift;
|
||||
require APR::Date;
|
||||
my $modified = $self->session->request->header('If-Modified-Since');
|
||||
return 1 if ($modified eq "");
|
||||
$modified = APR::Date::parse_http($modified);
|
||||
##Implement a step function that increments the epoch time in integer multiples of
|
||||
##the maximum cache time. Used to handle the case where layouts containing macros
|
||||
##(like assetproxied Navigations) can be periodically updated.
|
||||
if ($maxCacheTimeout) {
|
||||
my $delta = time() - $epoch;
|
||||
$epoch += $delta - ($delta % $maxCacheTimeout);
|
||||
}
|
||||
return ($epoch > $modified);
|
||||
}
|
||||
|
||||
|
|
@ -288,9 +305,14 @@ sub sendHeader {
|
|||
# $response->no_cache(1); # TODO - re-enable this?
|
||||
}
|
||||
# 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 {
|
||||
$response->header( 'Last-Modified' => $date);
|
||||
$response->header( 'Cache-Control' => "must-revalidate, max-age=" . $cacheControl );
|
||||
else {
|
||||
if ( $cacheControl eq "none" ) {
|
||||
$response->header("Cache-Control" => "private, max-age=1");
|
||||
}
|
||||
else {
|
||||
$response->header('Last-Modified' => $date);
|
||||
$response->header('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) {
|
||||
my $date = $datetime->epochToHttp(time() + $cacheControl);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue