From 2c5fda82fbd37cd8da9cefd415c44176682dcf19 Mon Sep 17 00:00:00 2001 From: Jose Luis Duran Date: Tue, 14 Apr 2015 19:18:28 -0300 Subject: Combine Cache-Control header in one line Sorted by RFC 2616: Section 14.9.1 `no-cache` Section 14.9.2 `no-store` Section 14.9.4 `must-revalidate` Combined into one line with IE's `pre-check` and `post-check`. However, when both set to `0`, both are entirely ignored: http://blogs.msdn.com/b/ieinternals/archive/2009/07/20/using-post_2d00_check-and-pre_2d00_check-cache-directives.aspx --- usr/local/captiveportal/index.php | 3 +-- usr/local/www/getstats.php | 3 +-- usr/local/www/graph.php | 17 ++++++++--------- usr/local/www/graph_cpu.php | 3 +-- usr/local/www/guiconfig.inc | 3 +-- usr/local/www/ifstats.php | 5 ++--- usr/local/www/status_queues.php | 23 +++++++++++------------ usr/local/www/status_rrd_graph_img.php | 22 ++++++++++------------ 8 files changed, 35 insertions(+), 44 deletions(-) (limited to 'usr/local') diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php index 90f0dbb..0e65a26 100644 --- a/usr/local/captiveportal/index.php +++ b/usr/local/captiveportal/index.php @@ -40,8 +40,7 @@ require_once("captiveportal.inc"); $errormsg = "Invalid credentials specified."; header("Expires: 0"); -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); +header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0"); header("Pragma: no-cache"); header("Connection: close"); diff --git a/usr/local/www/getstats.php b/usr/local/www/getstats.php index f9a5173..279aacb 100644 --- a/usr/local/www/getstats.php +++ b/usr/local/www/getstats.php @@ -39,8 +39,7 @@ header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" ); header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" ); -header("Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 -header("Cache-Control: post-check=0, pre-check=0", FALSE ); +header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0" ); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 require_once("guiconfig.inc"); diff --git a/usr/local/www/graph.php b/usr/local/www/graph.php index 478bae4..6bd8a2b 100755 --- a/usr/local/www/graph.php +++ b/usr/local/www/graph.php @@ -2,22 +2,22 @@ /* graph.php part of m0n0wall (http://m0n0.ch/wall) - + Copyright (C) 2013-2015 Electric Sheep Fencing, LP Copyright (C) 2004-2006 T. Lechat , Manuel Kasper and Jonathan Watt . All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -45,8 +45,7 @@ require("guiconfig.inc"); header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" ); header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" ); -header("Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 -header("Cache-Control: post-check=0, pre-check=0", FALSE ); +header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0" ); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 header("Content-type: image/svg+xml"); @@ -99,7 +98,7 @@ $fetch_link = "ifstats.php?if=" . htmlspecialchars($ifnum); if(file_exists("/usr/local/www/themes/{$g['theme']}/graph.php")) { $themetxt = file_get_contents("/usr/local/www/themes/{$g['theme']}/graph.php"); eval($themetxt); -} +} /********* Graph DATA **************/ print('' . "\n");?> @@ -315,7 +314,7 @@ function plot_data(obj) { rmax *= 1.25; else rmax *= 2; - + if (i == 8) rmax *= 1.024; } diff --git a/usr/local/www/graph_cpu.php b/usr/local/www/graph_cpu.php index ef3f22d..7fa0225 100644 --- a/usr/local/www/graph_cpu.php +++ b/usr/local/www/graph_cpu.php @@ -44,8 +44,7 @@ require_once("guiconfig.inc"); header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" ); header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" ); -header("Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 -header("Cache-Control: post-check=0, pre-check=0", FALSE ); +header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0" ); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 header("Content-type: image/svg+xml"); diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 62de607..b73ce77 100644 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -47,8 +47,7 @@ if(!$nocsrf) { if (!$omit_nocacheheaders) { header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: no-store, no-cache, must-revalidate"); - header("Cache-Control: post-check=0, pre-check=0", false); + header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0"); header("Pragma: no-cache"); } diff --git a/usr/local/www/ifstats.php b/usr/local/www/ifstats.php index fd7190f..5b3c1e8 100644 --- a/usr/local/www/ifstats.php +++ b/usr/local/www/ifstats.php @@ -54,11 +54,10 @@ $temp = gettimeofday(); $timing = (double)$temp["sec"] + (double)$temp["usec"] / 1000000.0; - + header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" ); header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" ); - header("Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 - header("Cache-Control: post-check=0, pre-check=0", FALSE ); + header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0" ); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 echo "$timing|" . $ifinfo['inbytes'] . "|" . $ifinfo['outbytes'] . "\n"; diff --git a/usr/local/www/status_queues.php b/usr/local/www/status_queues.php index 64e44c2..fd32348 100644 --- a/usr/local/www/status_queues.php +++ b/usr/local/www/status_queues.php @@ -30,7 +30,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/* pfSense_BUILDER_BINARIES: /sbin/pfctl pfSense_MODULE: shaper */ @@ -44,14 +44,13 @@ header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" ); header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" ); -header("Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 -header("Cache-Control: post-check=0, pre-check=0", FALSE ); +header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0" ); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 require("guiconfig.inc"); class QueueStats { public $queuename; - public $queuelength; + public $queuelength; public $pps; public $bandwidth; public $borrows; @@ -59,7 +58,7 @@ class QueueStats { public $drops; } if (!file_exists("{$g['varrun_path']}/qstats.pid") || !isvalidpid("{$g['varrun_path']}/qstats.pid")) { - /* Start in the background so we don't hang up the GUI */ + /* Start in the background so we don't hang up the GUI */ mwexec_bg("/usr/local/sbin/qstats -p {$g['varrun_path']}/qstats.pid"); /* Give it a moment to start up */ sleep(1); @@ -77,7 +76,7 @@ $fd = @fsockopen("unix://{$g['varrun_path']}/qstats"); if ($altqstats == -1) $error = "No queue statistics could be read."; } -if ($_REQUEST['getactivity']) { +if ($_REQUEST['getactivity']) { $statistics = array(); $bigger_stat = 0; $stat_type = $_REQUEST['stats']; @@ -99,7 +98,7 @@ if ($_REQUEST['getactivity']) { if ($bigger_stat < $q->bandwidth) $bigger_stat = $q->bandwidth; } - } + } $finscript = ""; foreach($statistics as $q) { if ($stat_type == "0") @@ -176,9 +175,9 @@ if(!is_array($config['shaper']['queue']) || count($config['shaper']['queue']) < - + - @@ -203,7 +202,7 @@ if(!is_array($config['shaper']['queue']) || count($config['shaper']['queue']) < -"; echo ""; echo ""; - echo ""; + echo ""; ?> queuename = $xml['name'] . $xml['interface']; - $current->queuelength = $xml['qlength']; + $current->queuelength = $xml['qlength']; $current->pps = $xml['measured']; $current->bandwidth = $xml['measuredspeedint']; $current->borrows = intval($xml['borrows']); diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index a5fac63..4a136ac 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -28,7 +28,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/* pfSense_BUILDER_BINARIES: /bin/rm /usr/local/bin/rrdtool pfSense_MODULE: system */ @@ -554,11 +554,11 @@ elseif(strstr($curdatabase, "-throughput.rrd")) { $g++; } $graphcmd .= "CDEF:\"tput-in_bits_pass={$graphtputbip}{$operand}\" "; - $graphcmd .= "CDEF:\"tput-out_bits_pass={$graphtputbop}{$operand}\" "; + $graphcmd .= "CDEF:\"tput-out_bits_pass={$graphtputbop}{$operand}\" "; $graphcmd .= "CDEF:\"tput-bits_io_pass={$graphtputbtp}{$operand}\" "; $graphcmd .= "CDEF:\"tput-in_bits_block={$graphtputbib}{$operand}\" "; - $graphcmd .= "CDEF:\"tput-out_bits_block={$graphtputbob}{$operand}\" "; + $graphcmd .= "CDEF:\"tput-out_bits_block={$graphtputbob}{$operand}\" "; $graphcmd .= "CDEF:\"tput-bits_io_block={$graphtputbtb}{$operand}\" "; $graphcmd .= "CDEF:\"tput-out_bits_pass_neg=tput-out_bits_pass,$multiplier,*\" "; @@ -996,7 +996,7 @@ elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdata $graphcmd .= "--height 200 --width 620 "; if ($altq) { $a_queues =& $altq->get_queue_list(); - $t = 0; + $t = 0; } else { $a_queues = array(); $i = 0; @@ -1155,7 +1155,7 @@ elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curda $graphcmd .= "AREA:\"$curif-totalusers_d#{$colorcaptiveportalusers[0]}:Total logged in users\" "; $graphcmd .= "GPRINT:\"$curif-totalusers_d:MAX:%8.0lf \\n\" "; $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" "; + $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" "; } elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { /* define graphcmd for online Captive Portal users stats */ @@ -1177,7 +1177,7 @@ elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$cur $graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%8.0lf \" "; $graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%8.0lf \" "; $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" "; + $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" "; } elseif((strstr($curdatabase, "ntpd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { /* define graphcmd for ntpd (was: mbuf) usage stats */ @@ -1226,7 +1226,7 @@ elseif((strstr($curdatabase, "ntpd.rrd")) && (file_exists("$rrddbpath$curdatabas else { $data = false; log_error(sprintf(gettext("Sorry we do not have data to graph for %s"),$curdatabase)); -} +} /* check modification time to see if we need to generate image */ if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) { @@ -1236,7 +1236,7 @@ if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) { $graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd; flush(); usleep(500); - } + } } else { if($data) $_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn); @@ -1263,8 +1263,7 @@ if(($graphcmdreturn <> 0) || (! $data)) { header("Content-type: image/png"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: no-store, no-cache, must-revalidate"); - header("Cache-Control: post-check=0, pre-check=0", false); + header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0"); header("Pragma: no-cache"); $file= "/usr/local/www/themes/{$g['theme']}/images/misc/rrd_error.png"; readfile($file); @@ -1274,8 +1273,7 @@ if(($graphcmdreturn <> 0) || (! $data)) { header("Content-type: image/png"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: no-store, no-cache, must-revalidate"); - header("Cache-Control: post-check=0, pre-check=0", false); + header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0"); header("Pragma: no-cache"); readfile($file); } -- cgit v1.1