Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-hijackresponse

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-hijackresponse - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

20

lib/index.js

@@ -1,3 +0,1 @@

var Stream = require('stream').Stream;
require('http').OutgoingMessage.prototype.hijack = function (cb) {

@@ -9,3 +7,3 @@ var writeHead = this.writeHead,

hijacking = true,
hijackedResponse = new Stream();
hijackedResponse = {};

@@ -22,16 +20,4 @@ hijackedResponse.readable = hijackedResponse.writable = true;

['getHeader', 'setHeader', 'removeHeader', 'writeHead'].forEach(function (methodName) {
hijackedResponse[methodName] = function () { // ...
return res[methodName].apply(res, arguments);
};
});
hijackedResponse.__proto__ = res;
hijackedResponse.__defineGetter__('statusCode', function () {
return res.statusCode;
});
hijackedResponse.__defineSetter__('statusCode', function (statusCode) {
res.statusCode = statusCode;
});
this.writeHead = function (statusCode, headers) {

@@ -67,2 +53,4 @@ if (statusCode) {

this.write(chunk, encoding);
} else if (!this.headerSent && this.writeHead !== writeHead) {
this._implicitHeader();
}

@@ -69,0 +57,0 @@ if (hijacking) {

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Rewrite HTTP responses on their way out.",
"version": "0.0.1",
"version": "0.0.2",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

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