proxy-chain
Advanced tools
Comparing version 0.1.18 to 0.1.19
@@ -123,2 +123,3 @@ 'use strict'; | ||
value: function onSrcSocketClose() { | ||
if (this.isClosed) return; | ||
this.log('Source socket closed'); | ||
@@ -130,2 +131,3 @@ this.close(); | ||
value: function onSrcSocketEnd() { | ||
if (this.isClosed) return; | ||
this.log('Source socket ended'); | ||
@@ -137,2 +139,3 @@ this.close(); | ||
value: function onSrcSocketError(err) { | ||
if (this.isClosed) return; | ||
this.log('Source socket failed: ' + (err.stack || err)); | ||
@@ -144,2 +147,3 @@ this.close(); | ||
value: function onSrcResponseFinish() { | ||
if (this.isClosed) return; | ||
this.log('Source response finished'); | ||
@@ -151,2 +155,3 @@ this.close(); | ||
value: function onTrgSocket(socket) { | ||
if (this.isClosed) return; | ||
this.log('Target socket assigned'); | ||
@@ -167,2 +172,3 @@ | ||
value: function onTrgSocketClose() { | ||
if (this.isClosed) return; | ||
this.log('Target socket closed'); | ||
@@ -174,2 +180,3 @@ if (this.srcSocket) this.srcSocket.end(); | ||
value: function onTrgSocketEnd() { | ||
if (this.isClosed) return; | ||
this.log('Target socket ended'); | ||
@@ -181,2 +188,3 @@ if (this.srcSocket) this.srcSocket.end(); | ||
value: function onTrgSocketError(err) { | ||
if (this.isClosed) return; | ||
this.log('Target socket failed: ' + (err.stack || err)); | ||
@@ -238,24 +246,2 @@ this.fail(err); | ||
}, { | ||
key: 'removeListeners', | ||
value: function removeListeners() { | ||
this.log('Removing listeners'); | ||
if (this.srcSocket) { | ||
this.srcSocket.removeListener('close', this.onSrcSocketClose); | ||
this.srcSocket.removeListener('end', this.onSrcSocketEnd); | ||
this.srcSocket.removeListener('error', this.onSrcSocketError); | ||
} | ||
if (this.srcResponse) { | ||
this.srcResponse.removeListener('finish', this.onSrcResponseFinish); | ||
} | ||
if (this.trgRequest) { | ||
this.trgRequest.removeListener('socket', this.onTrgSocket); | ||
} | ||
if (this.trgSocket) { | ||
this.trgSocket.removeListener('socket', this.onTrgSocketClose); | ||
this.trgSocket.removeListener('socket', this.onTrgSocketEnd); | ||
this.trgSocket.removeListener('socket', this.onTrgSocketError); | ||
} | ||
} | ||
}, { | ||
key: 'getStats', | ||
@@ -280,3 +266,2 @@ value: function getStats() { | ||
this.log('Closing handler'); | ||
this.removeListeners(); | ||
@@ -283,0 +268,0 @@ // Save stats before sockets are destroyed |
@@ -9,4 +9,2 @@ 'use strict'; | ||
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
var _http = require('http'); | ||
@@ -139,2 +137,3 @@ | ||
value: function onTrgResponse(response) { | ||
if (this.isClosed) return; | ||
this.log('Received response from target (' + response.statusCode + ')'); | ||
@@ -165,16 +164,6 @@ // console.dir(response); | ||
value: function onTrgError(err) { | ||
if (this.isClosed) return; | ||
this.log('Target socket failed: ' + (err.stack || err)); | ||
this.fail(err); | ||
} | ||
}, { | ||
key: 'removeListeners', | ||
value: function removeListeners() { | ||
_get(HandlerForward.prototype.__proto__ || Object.getPrototypeOf(HandlerForward.prototype), 'removeListeners', this).call(this); | ||
if (this.trgRequest) { | ||
this.trgRequest.removeListener('response', this.onTrgResponse); | ||
this.trgRequest.removeListener('error', this.onTrgError); | ||
this.trgRequest.removeListener('socket', this.onTrgSocket); | ||
} | ||
} | ||
}]); | ||
@@ -181,0 +170,0 @@ |
@@ -9,4 +9,2 @@ 'use strict'; | ||
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
var _http = require('http'); | ||
@@ -77,2 +75,3 @@ | ||
value: function onTrgRequestConnect(response, socket) { | ||
if (this.isClosed) return; | ||
this.log('Connected to upstream proxy'); | ||
@@ -111,2 +110,3 @@ | ||
value: function onTrgRequestAbort() { | ||
if (this.isClosed) return; | ||
this.log('Target aborted'); | ||
@@ -118,17 +118,6 @@ this.close(); | ||
value: function onTrgRequestError(err) { | ||
if (this.isClosed) return; | ||
this.log('Target request failed: ' + (err.stack || err)); | ||
this.fail(err); | ||
} | ||
}, { | ||
key: 'removeListeners', | ||
value: function removeListeners() { | ||
_get(HandlerTunnelChain.prototype.__proto__ || Object.getPrototypeOf(HandlerTunnelChain.prototype), 'removeListeners', this).call(this); | ||
if (this.trgRequest) { | ||
this.trgRequest.removeListener('connect', this.onTrgRequestConnect); | ||
this.trgRequest.removeListener('close', this.onTrgRequestAbort); | ||
this.trgRequest.removeListener('end', this.onTrgRequestError); | ||
this.trgRequest.removeListener('socket', this.onTrgSocket); | ||
} | ||
} | ||
}]); | ||
@@ -135,0 +124,0 @@ |
@@ -9,4 +9,2 @@ 'use strict'; | ||
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
var _net = require('net'); | ||
@@ -56,2 +54,3 @@ | ||
value: function onTrgSocketConnect() { | ||
if (this.isClosed) return; | ||
this.log('Connected'); | ||
@@ -79,11 +78,2 @@ | ||
} | ||
}, { | ||
key: 'removeListeners', | ||
value: function removeListeners() { | ||
_get(HandlerTunnelDirect.prototype.__proto__ || Object.getPrototypeOf(HandlerTunnelDirect.prototype), 'removeListeners', this).call(this); | ||
if (this.trgSocket) { | ||
this.trgSocket.removeListener('connect', this.onTrgSocketConnect); | ||
} | ||
} | ||
}]); | ||
@@ -90,0 +80,0 @@ |
@@ -0,1 +1,5 @@ | ||
0.1.19 / 2018-01-25 | ||
================== | ||
- fixed uncaught error events, code improved | ||
0.1.18 / 2018-01-25 | ||
@@ -2,0 +6,0 @@ ================== |
{ | ||
"name": "proxy-chain", | ||
"version": "0.1.18", | ||
"version": "0.1.19", | ||
"description": "Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
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
83822
1276