Socket
Socket
Sign inDemoInstall

send

Package Overview
Dependencies
17
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.17.2 to 0.18.0

SECURITY.md

15

HISTORY.md

@@ -0,1 +1,16 @@

0.18.0 / 2022-03-23
===================
* Fix emitted 416 error missing headers property
* Limit the headers removed for 304 response
* deps: depd@2.0.0
- Replace internal `eval` usage with `Function` constructor
- Use instance methods on `process` to check for listeners
* deps: destroy@1.2.0
* deps: http-errors@2.0.0
- deps: depd@2.0.0
- deps: statuses@2.0.1
* deps: on-finished@2.4.1
* deps: statuses@2.0.1
0.17.2 / 2021-12-11

@@ -2,0 +17,0 @@ ===================

64

index.js
/*!
* send
* Copyright(c) 2012 TJ Holowaychuk
* Copyright(c) 2014-2016 Douglas Christopher Wilson
* Copyright(c) 2014-2022 Douglas Christopher Wilson
* MIT Licensed

@@ -270,9 +270,7 @@ */

if (hasListeners(this, 'error')) {
return this.emit('error', createError(status, err, {
expose: false
}))
return this.emit('error', createHttpError(status, err))
}
var res = this.res
var msg = statuses[status] || String(status)
var msg = statuses.message[status] || String(status)
var doc = createHtmlDocument('Error', escapeHtml(msg))

@@ -353,3 +351,3 @@

/**
* Strip content-* header fields.
* Strip various content header fields for a change in entity.
*

@@ -361,10 +359,8 @@ * @private

var res = this.res
var headers = getHeaderNames(res)
for (var i = 0; i < headers.length; i++) {
var header = headers[i]
if (header.substr(0, 8) === 'content-' && header !== 'content-location') {
res.removeHeader(header)
}
}
res.removeHeader('Content-Encoding')
res.removeHeader('Content-Language')
res.removeHeader('Content-Length')
res.removeHeader('Content-Range')
res.removeHeader('Content-Type')
}

@@ -793,4 +789,2 @@

SendStream.prototype.stream = function stream (path, options) {
// TODO: this is all lame, refactor meeee
var finished = false
var self = this

@@ -804,17 +798,15 @@ var res = this.res

// response finished, done with the fd
onFinished(res, function onfinished () {
finished = true
destroy(stream)
})
// cleanup
function cleanup () {
destroy(stream, true)
}
// error handling code-smell
// response finished, cleanup
onFinished(res, cleanup)
// error handling
stream.on('error', function onerror (err) {
// request already finished
if (finished) return
// clean up stream early
cleanup()
// clean up stream
finished = true
destroy(stream)
// error

@@ -983,2 +975,20 @@ self.onStatError(err)

/**
* Create a HttpError object from simple arguments.
*
* @param {number} status
* @param {Error|object} err
* @private
*/
function createHttpError (status, err) {
if (!err) {
return createError(status)
}
return err instanceof Error
? createError(status, err, { expose: false })
: createError(status, err)
}
/**
* decodeURIComponent.

@@ -985,0 +995,0 @@ *

{
"name": "send",
"description": "Better streaming static file server with Range and conditional-GET support",
"version": "0.17.2",
"version": "0.18.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -20,4 +20,4 @@ "contributors": [

"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"depd": "2.0.0",
"destroy": "1.2.0",
"encodeurl": "~1.0.2",

@@ -27,8 +27,8 @@ "escape-html": "~1.0.3",

"fresh": "0.5.2",
"http-errors": "1.8.1",
"http-errors": "2.0.0",
"mime": "1.6.0",
"ms": "2.1.3",
"on-finished": "~2.3.0",
"on-finished": "2.4.1",
"range-parser": "~1.2.1",
"statuses": "~1.5.0"
"statuses": "2.0.1"
},

@@ -39,3 +39,3 @@ "devDependencies": {

"eslint-config-standard": "14.1.1",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-markdown": "2.2.1",

@@ -45,5 +45,5 @@ "eslint-plugin-node": "11.1.0",

"eslint-plugin-standard": "4.1.0",
"mocha": "9.1.3",
"mocha": "9.2.2",
"nyc": "15.1.0",
"supertest": "6.1.6"
"supertest": "6.2.2"
},

@@ -54,2 +54,3 @@ "files": [

"README.md",
"SECURITY.md",
"index.js"

@@ -56,0 +57,0 @@ ],

@@ -321,4 +321,4 @@ # send

[coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master
[github-actions-ci-image]: https://badgen.net/github/checks/pillarjs/send/master?label=ci
[github-actions-ci-url]: https://github.com/pillarjs/send/actions?query=workflow%3Aci
[github-actions-ci-image]: https://badgen.net/github/checks/pillarjs/send/master?label=linux
[github-actions-ci-url]: https://github.com/pillarjs/send/actions/workflows/ci.yml
[node-image]: https://badgen.net/npm/node/send

@@ -325,0 +325,0 @@ [node-url]: https://nodejs.org/en/download/

Sorry, the diff of this file is not supported yet

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