serve-favicon
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -0,1 +1,8 @@ | ||
2.1.4 / 2014-09-15 | ||
================== | ||
* Fix content headers being sent in 304 response | ||
* deps: etag@~1.3.1 | ||
- Improve ETag generation speed | ||
2.1.3 / 2014-09-07 | ||
@@ -2,0 +9,0 @@ ================== |
27
index.js
@@ -92,6 +92,4 @@ /*! | ||
headers: { | ||
'Content-Type': 'image/x-icon', | ||
'Content-Length': buf.length, | ||
'Cache-Control': 'public, max-age=' + ~~(maxAge / 1000), | ||
'etag': etag(buf) | ||
'ETag': etag(buf) | ||
} | ||
@@ -110,9 +108,20 @@ }; | ||
function send(req, res, icon){ | ||
var _fresh = fresh(req.headers, icon.headers); | ||
var buf = _fresh ? '' : icon.body; | ||
var status = _fresh ? 304 : 200; | ||
function send(req, res, icon) { | ||
var headers = icon.headers; | ||
res.writeHead(status, icon.headers); | ||
res.end(buf); | ||
// Set headers | ||
for (var header in headers) { | ||
res.setHeader(header, headers[header]); | ||
} | ||
if (fresh(req.headers, res._headers)) { | ||
res.statusCode = 304; | ||
res.end(); | ||
return; | ||
} | ||
res.statusCode = 200; | ||
res.setHeader('Content-Length', icon.body.length); | ||
res.setHeader('Content-Type', 'image/x-icon'); | ||
res.end(icon.body); | ||
} |
{ | ||
"name": "serve-favicon", | ||
"description": "favicon serving middleware with caching", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
@@ -14,3 +14,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"etag": "~1.3.0", | ||
"etag": "~1.3.1", | ||
"fresh": "0.2.4", | ||
@@ -17,0 +17,0 @@ "ms": "0.6.2" |
@@ -106,5 +106,5 @@ # serve-favicon | ||
[coveralls-url]: https://coveralls.io/r/expressjs/serve-favicon?branch=master | ||
[downloads-image]: http://img.shields.io/npm/dm/serve-favicon.svg?style=flat | ||
[downloads-image]: https://img.shields.io/npm/dm/serve-favicon.svg?style=flat | ||
[downloads-url]: https://npmjs.org/package/serve-favicon | ||
[gittip-image]: https://img.shields.io/gittip/dougwilson.svg?style=flat | ||
[gittip-url]: https://www.gittip.com/dougwilson/ |
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
8791
103
Updatedetag@~1.3.1