From: eldy <> Date: Fri, 21 Nov 2003 23:05:12 +0000 (+0000) Subject: Fix not working feature for Expires parameter. X-Git-Tag: AWSTATS_6_0_BETA~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00af4cf499a9d0f85f0c6c0b2dab08d0afecf4ee;p=thirdparty%2FAWStats.git Fix not working feature for Expires parameter. --- diff --git a/docs/awstats_config.html b/docs/awstats_config.html index 58a7a23f..6efc32aa 100644 --- a/docs/awstats_config.html +++ b/docs/awstats_config.html @@ -1221,8 +1221,8 @@ AWStats 4.1+ supports both keywords AND keyphrases by default with no need of an Expires
Version : 3.1+
-
# You can add in the HTML report page a delay to force browsers to not use cache -
# if page is loaded a second time after this delay (in seconds). +
# You can add, in the HTML report page, a cache lifetime (in seconds) that +
# will be returned to browser in HTTP header answer by server.
# This parameter is not used when report are built with -staticlinks option.
# Example: 3600
# Default: 0 diff --git a/wwwroot/cgi-bin/awstats.model.conf b/wwwroot/cgi-bin/awstats.model.conf index 44064763..bfad82e2 100644 --- a/wwwroot/cgi-bin/awstats.model.conf +++ b/wwwroot/cgi-bin/awstats.model.conf @@ -809,8 +809,8 @@ UseFramesWhenCGI=1 DetailedReportsOnNewWindows=1 -# You can add in the HTML report page a delay to force browsers to not use cache -# if page is loaded a second time after this delay (in seconds). +# You can add, in the HTML report page, a cache lifetime (in seconds) that +# will be returned to browser in HTTP header answer by server. # This parameter is not used when report are built with -staticlinks option. # Example: 3600 # Default: 0 diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index b1028cf8..251305a1 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -517,7 +517,7 @@ sub html_head { if ($BuildReportFormat eq 'xml') { print ($ENV{'HTTP_USER_AGENT'}=~/MSIE|Googlebot/i?"\n":"\n"); } else { print "\n"; } - if ($Expires) { print "\n"; } + if ($Expires) { print "\n"; } print "\n"; if ($AllowIndex && $FrameName ne 'mainleft') { print "\n"; } print "$Message[7] $SiteDomain\n"; @@ -4929,7 +4929,7 @@ sub ShowEmailReceiversChart { #------------------------------------------------------------------------------ ($DIR=$0) =~ s/([^\/\\]*)$//; ($PROG=$1) =~ s/\.([^\.]*)$//; $Extension=$1; -$starttime=time; +$starttime=time(); # Get current time (time when AWStats was started) ($nowsec,$nowmin,$nowhour,$nowday,$nowmonth,$nowyear,$nowwday,$nowyday) = localtime($starttime); @@ -4978,11 +4978,14 @@ $QueryString=''; if ($ENV{'AWSTATS_DEL_GATEWAY_INTERFACE'}) { $ENV{'GATEWAY_INTERFACE'}=''; } if ($ENV{'GATEWAY_INTERFACE'}) { # Run from a browser as CGI if ($BuildReportFormat eq 'xml') { print ($ENV{'HTTP_USER_AGENT'}=~/MSIE|Googlebot/i?"Content-type: text/html\n":"Content-type: text/xml\n"); } - else { print "content-type: text/html\n"; } - + else { print "Content-type: text/html\n"; } + # Expires must be GMT ANSI asctime and must be after Content-type to avoid pb with some servers (SAMBAR) - #my $ExpireDelayInHTTPHeader=0; - #print "Expires: ".(gmtime($starttime()+$ExpireDelayInHTTPHeader))."\n"; + if ($Expires) { + print "Cache-Control: public\n"; + print "Last-Modified: ".gmtime($starttime)."\n"; + print "Expires: ".(gmtime($starttime+$Expires))."\n"; + } print "\n"; # Prepare QueryString