Fac_verify ook laten controleren of static content caching aanstaat

svn path=/Website/trunk/; revision=30214
This commit is contained in:
Jos Groot Lipman
2016-08-04 13:06:51 +00:00
parent c4177bab74
commit 2cc966aec1

View File

@@ -217,6 +217,41 @@ function zipfile(pathname, filename)
}
}
xhr3.send(null);
// Check for caching headers
var xhr4 = new XMLHttpRequest();
xhr4.open('GET', '../localscripts/date.js');
xhr4.onreadystatechange = function()
{
var txt = "<no Cache-Control header>";
// Ready state 4 means the request is done
if (xhr4.readyState === 4)
{
if (xhr4.status == 200)
{
var cache = xhr4.getResponseHeader("Cache-Control");
//var cache = xhr4.getAllResponseHeaders().replace(/\r/g, "\nq\n");
if (cache != null)
{
txt = "Cache: " + cache;
if (cache.split("max-age=").length > 1)
{
var maxage = parseInt(cache.split("max-age=")[1], 10);
if (maxage > 0)
txt += " (= " + (maxage / 3600) + " hours)";
}
document.getElementById('resultCaching').innerHTML = 'Ok';
document.getElementById('resultCaching').style.color = 'green';
}
}
else
{
txt = xhr4.status + ": " + xhr4.statusText;
}
document.getElementById('checkCaching').appendChild( document.createTextNode(txt) );
}
}
xhr4.send(null);
}
function reload()
{
@@ -561,9 +596,7 @@ checker("500_error.asp",
function ()
{
txt = "Checking 500-error handler: <span id='check500'></span>";
res = resultcodes.unknown;
return { result: res, message: txt, id: "result500" };
}
)
@@ -572,9 +605,7 @@ checker("API2 REST HTTP Verbs",
function ()
{
txt = "Checking PUT: <span id='checkAPI2P'></span>";
res = resultcodes.warning;
return { result: res, message: txt, id: "resultAPI2P" };
}
)
@@ -583,13 +614,20 @@ checker("API2 REST HTTP Verbs",
function ()
{
txt = "Checking DELETE: <span id='checkAPI2D'></span>";
res = resultcodes.warning;
return { result: res, message: txt, id: "resultAPI2D" };
}
)
checker("Check static content caching",
function ()
{
txt = "<span id='checkCaching'></span>";
res = resultcodes.warning;
return { result: res, message: txt, id: "resultCaching" };
}
)
//------------------------------------------------------------------------------
__GROUP = "Classic ASP";
checker("Javascript",