Permalink
Browse files

Doh, missed some changes

  • Loading branch information...
1 parent b7f5857 commit 93257b0c39401c4e9ce24e9a0d86e3abefd5e096 @ryanrolds ryanrolds committed with tj Oct 2, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/middleware/staticCache.js
@@ -108,13 +108,14 @@ module.exports = function staticCache(options){
// cache hit, doesnt support range requests
if (hit && hit.complete && !ranges) {
+ // todo clean these messy headers
header = utils.merge({}, hit[0]);
- header.Age = age = (new Date - hit.createdAt) / 1000 | 0;
+ header.Age = age = (new Date - header.date) / 1000 | 0;
header.date = new Date().toUTCString();
// parse cache-controls
hitCC = utils.parseCacheControl(header['cache-control'] || '');
- uaCC = utils.parseCacheControl(req.headers['cache-control'] || '')
+ uaCC = utils.parseCacheControl(req.headers['cache-control'] || '');
// check if we must revalidate(bypass)
if (hitCC['no-cache'] || uaCC['no-cache']) return next();
@@ -126,7 +127,7 @@ module.exports = function staticCache(options){
if (utils.conditionalGET(req)) {
if (!utils.modified(req, res, header)) {
header['content-length'] = 0;
- res.writeHead(304, header)
+ res.writeHead(304, header);
return res.end();
}
}

0 comments on commit 93257b0

Please sign in to comment.