Socket
Socket
Sign inDemoInstall

compression

Package Overview
Dependencies
10
Maintainers
7
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.2 to 1.6.0

14

HISTORY.md

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

1.6.0 / 2015-09-29
==================
* Skip compression when response has `Cache-Control: no-transform`
* deps: accepts@~1.3.0
- deps: mime-types@~2.1.7
- deps: negotiator@0.6.0
* deps: compressible@~2.0.6
- deps: mime-db@'>= 1.19.0 < 2'
* deps: on-headers@~1.0.1
- perf: enable strict mode
* deps: vary@~1.1.0
- Only accept valid field names in the `field` argument
1.5.2 / 2015-07-30

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

@@ -33,2 +33,9 @@ /*!

/**
* Module variables.
* @private
*/
var cacheControlNoTransformRegExp = /(?:^|,)\s*?no-transform\s*?(?:,|$)/
/**
* Compress response data with gzip / deflate.

@@ -139,2 +146,8 @@ *

// determine if the entity should be transformed
if (!shouldTransform(req, res)) {
nocompress('no transform')
return
}
// vary

@@ -251,1 +264,15 @@ vary(res, 'Accept-Encoding')

}
/**
* Determine if the entity should be transformed.
* @private
*/
function shouldTransform(req, res) {
var cacheControl = res.getHeader('Cache-Control')
// Don't compress for Cache-Control: no-transform
// https://tools.ietf.org/html/rfc7234#section-5.2.2.4
return !cacheControl
|| !cacheControlNoTransformRegExp.test(cacheControl)
}

16

package.json
{
"name": "compression",
"description": "Node.js compression middleware",
"version": "1.5.2",
"version": "1.6.0",
"contributors": [

@@ -12,13 +12,13 @@ "Douglas Christopher Wilson <doug@somethingdoug.com>",

"dependencies": {
"accepts": "~1.2.12",
"accepts": "~1.3.0",
"bytes": "2.1.0",
"compressible": "~2.0.5",
"compressible": "~2.0.6",
"debug": "~2.2.0",
"on-headers": "~1.0.0",
"vary": "~1.0.1"
"on-headers": "~1.0.1",
"vary": "~1.1.0"
},
"devDependencies": {
"istanbul": "0.3.17",
"mocha": "2.2.5",
"supertest": "1.0.1"
"istanbul": "0.3.21",
"mocha": "2.3.3",
"supertest": "1.1.0"
},

@@ -25,0 +25,0 @@ "files": [

@@ -30,4 +30,10 @@ # compression

Returns the compression middleware using the given `options`.
Returns the compression middleware using the given `options`. The middleware
will attempt to compress response bodies for all request that traverse through
the middleware, based on the given `options`.
This middleware will never compress responses that include a `Cache-Control`
header with the [`no-transform` directive](https://tools.ietf.org/html/rfc7234#section-5.2.2.4),
as compressing will transform the body.
#### Options

@@ -34,0 +40,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc