Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed `staticCache()` Age header field

  • Loading branch information...
commit 9319760eb9b68ab487cb6d0ad66f5693354dfde7 1 parent 470cfc2
@tj tj authored
Showing with 3 additions and 4 deletions.
  1. +1 −1  lib/middleware/static.js
  2. +2 −3 lib/middleware/staticCache.js
View
2  lib/middleware/static.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);
}
}
View
5 lib/middleware/staticCache.js
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.