serve-favicon
Advanced tools
Comparing version 2.4.0 to 2.4.1
@@ -0,1 +1,12 @@ | ||
2.4.1 / 2017-02-27 | ||
================== | ||
* Remove usage of `res._headers` private field | ||
* deps: fresh@0.5.0 | ||
- Fix incorrect result when `If-None-Match` has both `*` and ETags | ||
- Fix weak `ETag` matching to match spec | ||
- perf: skip checking modified time if ETag check failed | ||
- perf: skip parsing `If-None-Match` when no `ETag` header | ||
- perf: use `Date.parse` instead of `new Date` | ||
2.4.0 / 2017-02-19 | ||
@@ -2,0 +13,0 @@ ================== |
20
index.js
@@ -5,3 +5,3 @@ /*! | ||
* Copyright(c) 2011 TJ Holowaychuk | ||
* Copyright(c) 2014-2015 Douglas Christopher Wilson | ||
* Copyright(c) 2014-2017 Douglas Christopher Wilson | ||
* MIT Licensed | ||
@@ -161,2 +161,18 @@ */ | ||
/** | ||
* Determine if the cached representation is fresh. | ||
* | ||
* @param {object} req | ||
* @param {object} res | ||
* @return {boolean} | ||
* @private | ||
*/ | ||
function isFresh (req, res) { | ||
return fresh(req.headers, { | ||
'etag': res.getHeader('ETag'), | ||
'last-modified': res.getHeader('Last-Modified') | ||
}) | ||
} | ||
/** | ||
* Resolve the path to icon. | ||
@@ -198,3 +214,3 @@ * | ||
// Validate freshness | ||
if (fresh(req.headers, res._headers)) { | ||
if (isFresh(req, res)) { | ||
res.statusCode = 304 | ||
@@ -201,0 +217,0 @@ res.end() |
{ | ||
"name": "serve-favicon", | ||
"description": "favicon serving middleware with caching", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
@@ -15,3 +15,3 @@ "license": "MIT", | ||
"etag": "~1.8.0", | ||
"fresh": "0.4.0", | ||
"fresh": "0.5.0", | ||
"ms": "0.7.2", | ||
@@ -21,3 +21,3 @@ "parseurl": "~1.3.1" | ||
"devDependencies": { | ||
"eslint": "3.15.0", | ||
"eslint": "3.16.1", | ||
"eslint-config-standard": "6.2.1", | ||
@@ -24,0 +24,0 @@ "eslint-plugin-markdown": "1.0.0-beta.3", |
@@ -8,3 +8,3 @@ # serve-favicon | ||
[![Test Coverage][coveralls-image]][coveralls-url] | ||
[![Gittip][gittip-image]][gittip-url] | ||
[![Gratipay][gratipay-image]][gratipay-url] | ||
@@ -39,4 +39,4 @@ Node.js middleware for serving a favicon. | ||
```bash | ||
npm install serve-favicon | ||
```sh | ||
$ npm install serve-favicon | ||
``` | ||
@@ -140,3 +140,3 @@ | ||
[downloads-url]: https://npmjs.org/package/serve-favicon | ||
[gittip-image]: https://img.shields.io/gittip/dougwilson.svg | ||
[gittip-url]: https://www.gittip.com/dougwilson/ | ||
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg | ||
[gratipay-url]: https://www.gratipay.com/dougwilson/ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14068
188
+ Addedfresh@0.5.0(transitive)
- Removedfresh@0.4.0(transitive)
Updatedfresh@0.5.0