Socket
Socket
Sign inDemoInstall

serve-favicon

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serve-favicon - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

14

HISTORY.md

@@ -0,1 +1,15 @@

2.3.0 / 2015-06-13
==================
* Send non-chunked response for `OPTIONS`
* deps: etag@~1.7.0
- Always include entity length in ETags for hash length extensions
- Generate non-Stats ETags using MD5 only (no longer CRC32)
- Remove base64 padding in ETags to shorten
* deps: fresh@0.3.0
- Add weak `ETag` matching support
* perf: enable strict mode
* perf: remove argument reassignment
* perf: remove bitwise operations
2.2.1 / 2015-05-14

@@ -2,0 +16,0 @@ ==================

28

index.js

@@ -5,6 +5,8 @@ /*!

* Copyright(c) 2011 TJ Holowaychuk
* Copyright(c) 2014 Douglas Christopher Wilson
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict';
/**

@@ -24,2 +26,9 @@ * Module dependencies.

/**
* Module exports.
* @public
*/
module.exports = favicon;
/**
* Module variables.

@@ -36,12 +45,12 @@ * @private

* @param {String|Buffer} path
* @param {Object} options
* @param {Object} [options]
* @return {Function} middleware
*/
module.exports = function favicon(path, options){
options = options || {};
function favicon(path, options) {
var opts = options || {};
var buf;
var icon; // favicon cache
var maxAge = calcMaxAge(options.maxAge);
var maxAge = calcMaxAge(opts.maxAge);
var stat;

@@ -70,5 +79,6 @@

if ('GET' !== req.method && 'HEAD' !== req.method) {
var status = 'OPTIONS' === req.method ? 200 : 405;
res.writeHead(status, {'Allow': 'GET, HEAD, OPTIONS'});
if (req.method !== 'GET' && req.method !== 'HEAD') {
res.statusCode = req.method === 'OPTIONS' ? 200 : 405;
res.setHeader('Allow', 'GET, HEAD, OPTIONS');
res.setHeader('Content-Length', '0');
res.end();

@@ -119,3 +129,3 @@ return;

headers: {
'Cache-Control': 'public, max-age=' + ~~(maxAge / 1000),
'Cache-Control': 'public, max-age=' + Math.floor(maxAge / 1000),
'ETag': etag(buf)

@@ -122,0 +132,0 @@ }

{
"name": "serve-favicon",
"description": "favicon serving middleware with caching",
"version": "2.2.1",
"version": "2.3.0",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",

@@ -14,4 +14,4 @@ "license": "MIT",

"dependencies": {
"etag": "~1.6.0",
"fresh": "0.2.4",
"etag": "~1.7.0",
"fresh": "0.3.0",
"ms": "0.7.1",

@@ -22,3 +22,3 @@ "parseurl": "~1.3.0"

"istanbul": "0.3.9",
"mocha": "2.2.4",
"mocha": "2.2.5",
"proxyquire": "~1.2.0",

@@ -25,0 +25,0 @@ "supertest": "1.0.1"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc