From c0fc7f9b0c58fa3caf3cd49b83fe477a98e020c3 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 4 Mar 2012 15:04:54 -0800 Subject: [PATCH] Avoid orphaned cache files from breaking the caching layer. (cherry picked from commit 57d0a2e803d8efd2721c575e225bc9d90910d6d3) --- src/node/utils/caching_middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/utils/caching_middleware.js b/src/node/utils/caching_middleware.js index 29c95049f..9e62ee842 100644 --- a/src/node/utils/caching_middleware.js +++ b/src/node/utils/caching_middleware.js @@ -55,7 +55,7 @@ CachingMiddleware.prototype = new function () { var modifiedSince = (req.headers['if-modified-since'] && new Date(req.headers['if-modified-since'])); var lastModifiedCache = !error && stats.mtime; - if (lastModifiedCache) { + if (lastModifiedCache && responseCache[cacheKey]) { req.headers['if-modified-since'] = lastModifiedCache.toUTCString(); } else { delete req.headers['if-modified-since'];