[Rt-commit] rt branch, 4.0/helpers-http-cache-headers, updated. rt-4.0.8-308-g8207035
Todd Wade
todd at bestpractical.com
Tue Apr 2 09:17:12 EDT 2013
The branch, 4.0/helpers-http-cache-headers has been updated
via 8207035eae9e30697508662cde9f6d88452c9267 (commit)
from 9aa9b13390eacfc8f58544797217bcda92b8b405 (commit)
Summary of changes:
lib/RT/Interface/Web.pm | 14 +++++++++++---
share/html/Helpers/Autocomplete/autohandler | 2 +-
2 files changed, 12 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 8207035eae9e30697508662cde9f6d88452c9267
Author: Todd Wade <todd at bestpractical.com>
Date: Tue Apr 2 09:10:19 2013 -0400
Autocomplete should send cache control headers
http://issues.bestpractical.com/Ticket/Display.html?id=21042
lib/RT/Interface/Web.pm
- implement ruz's suggestion for a 'cache-forever'
- https://tickets.bestpractical.com/Ticket/Display.html?id=91289#txn-1527031
share/html/Helpers/Autocomplete/autohandler
- change argument to Time per ruz's suggestion
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index d26b2a4..4d64c95 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -880,15 +880,23 @@ set both Cache-Control and Expires http headers
sub CacheControlExpiresHeaders {
my %args = @_;
- my $CacheControl = $args{Seconds}
- ? sprintf "max-age=%d, private", $args{Seconds}
+ if ( ! defined $args{Time} ) {
+ $args{Time} = 0;
+ } elsif ( $args{Time} eq 'no-cache' ) {
+ $args{Time} = 0;
+ } elsif ( $args{Time} eq 'forever' ) {
+ $args{Time} = 30 * 24 * 60 * 60;
+ }
+
+ my $CacheControl = $args{Time}
+ ? sprintf "max-age=%d, private", $args{Time}
: 'no-cache'
;
$HTML::Mason::Commands::r->headers_out->{'Cache-Control'} = $CacheControl;
my $expires = RT::Date->new(RT->SystemUser);
$expires->SetToNow;
- $expires->AddSeconds( $args{Seconds} ) if $args{Seconds};
+ $expires->AddSeconds( $args{Time} ) if $args{Time};
$HTML::Mason::Commands::r->headers_out->{'Expires'} = $expires->RFC2616;
}
diff --git a/share/html/Helpers/Autocomplete/autohandler b/share/html/Helpers/Autocomplete/autohandler
index f1ea709..73d9966 100644
--- a/share/html/Helpers/Autocomplete/autohandler
+++ b/share/html/Helpers/Autocomplete/autohandler
@@ -46,7 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<%init>
- RT::Interface::Web::CacheControlExpiresHeaders( Seconds => 2 * 60 );
+ RT::Interface::Web::CacheControlExpiresHeaders( Time => 2 * 60 );
$m->call_next;
</%init>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list