Correct cache location and guard against bad directories.
This commit is contained in:
parent
ddda347f7a
commit
ca91c0c403
|
@ -24,6 +24,7 @@ var util = require('util');
|
||||||
|
|
||||||
var ROOT_DIR = path.normalize(__dirname + "/../");
|
var ROOT_DIR = path.normalize(__dirname + "/../");
|
||||||
var CACHE_DIR = ROOT_DIR + '../var/';
|
var CACHE_DIR = ROOT_DIR + '../var/';
|
||||||
|
CACHE_DIR = path.existsSync(CACHE_DIR) || undefined;
|
||||||
|
|
||||||
var responseCache = {};
|
var responseCache = {};
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ function CachingMiddleware() {
|
||||||
}
|
}
|
||||||
CachingMiddleware.prototype = new function () {
|
CachingMiddleware.prototype = new function () {
|
||||||
function handle(req, res, next) {
|
function handle(req, res, next) {
|
||||||
if (!(req.method == "GET" || req.method == "HEAD")) {
|
if (!(req.method == "GET" || req.method == "HEAD" || !CACHE_DIR)) {
|
||||||
return next(undefined, req, res);
|
return next(undefined, req, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue