Permalink
Browse files

Fixed `staticCache()` Age header field

  • Loading branch information...
1 parent 470cfc2 commit 9319760eb9b68ab487cb6d0ad66f5693354dfde7 @tj tj committed Oct 16, 2011
Showing with 3 additions and 4 deletions.
  1. +1 −1 lib/middleware/static.js
  2. +2 −3 lib/middleware/staticCache.js
@@ -169,7 +169,7 @@ var send = exports.send = function(req, res, next, options){
// conditional GET support
if (utils.conditionalGET(req)) {
if (!utils.modified(req, res)) {
- req.emit('static', null);
+ req.emit('static');
return utils.notModified(res);
}
}
@@ -73,7 +73,7 @@ module.exports = function staticCache(options){
if (!contentLength || contentLength > maxlen) return;
// dont cache items we shouldn't be
- if (cc['no-cache']
+ if ( cc['no-cache']
|| cc['no-store']
|| cc['private']
|| cc['must-revalidate']) return;
@@ -108,9 +108,8 @@ 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 - header.date) / 1000 | 0;
+ header.Age = age = (new Date - new Date(header.date)) / 1000 | 0;
header.date = new Date().toUTCString();
// parse cache-controls

0 comments on commit 9319760

Please sign in to comment.