Correct cache location and guard against bad directories.

This commit is contained in:
Chad Weider 2012-03-10 15:22:30 -08:00
parent ddda347f7a
commit ca91c0c403
1 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ var util = require('util');
var ROOT_DIR = path.normalize(__dirname + "/../");
var CACHE_DIR = ROOT_DIR + '../var/';
CACHE_DIR = path.existsSync(CACHE_DIR) || undefined;
var responseCache = {};
@ -37,7 +38,7 @@ function CachingMiddleware() {
}
CachingMiddleware.prototype = new function () {
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);
}