proxy-chain
Advanced tools
Comparing version 0.1.33 to 0.1.34
@@ -17,2 +17,4 @@ 'use strict'; | ||
var _server = require('./server'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -206,3 +208,3 @@ | ||
if (this.upstreamProxyUrlParsed && response.statusCode === 407) { | ||
this.fail('Invalid credentials provided for the upstream proxy.', 502); | ||
this.fail(new _server.RequestError('Invalid credentials provided for the upstream proxy.', 502)); | ||
return true; | ||
@@ -214,10 +216,10 @@ } | ||
key: 'fail', | ||
value: function fail(err, statusCode) { | ||
value: function fail(err) { | ||
if (this.srcGotResponse) { | ||
this.log('Source already received a response, just destroying the socket...'); | ||
this.close(); | ||
} else if (statusCode) { | ||
// Manual error | ||
this.log(err + ', responding with custom status code ' + statusCode + ' to client'); | ||
this.srcResponse.writeHead(statusCode); | ||
} else if (err.statusCode) { | ||
// Error is RequestError with HTTP status code | ||
this.log(err + ', responding with custom status code ' + err.statusCode + ' to client'); | ||
this.srcResponse.writeHead(err.statusCode); | ||
this.srcResponse.end('' + err); | ||
@@ -224,0 +226,0 @@ } else if (err.code === 'ENOTFOUND' && !this.upstreamProxyUrlParsed) { |
@@ -533,3 +533,4 @@ 'use strict'; | ||
* It is passed to `prepareRequestFunction` function. | ||
* @return {Object} statistics { srcTxBytes, srcRxBytes, trgTxBytes, trgRxBytes } | ||
* @return {Object} An object with statistics { srcTxBytes, srcRxBytes, trgTxBytes, trgRxBytes }, | ||
* or null if connection does not exist or has been closed. | ||
*/ | ||
@@ -536,0 +537,0 @@ |
@@ -0,1 +1,5 @@ | ||
0.1.34 / 2018-06-08 | ||
=================== | ||
- Minor improvement: HandlerBase.fail() now supports RequestError | ||
0.1.33 / 2018-06-08 | ||
@@ -2,0 +6,0 @@ =================== |
{ | ||
"name": "proxy-chain", | ||
"version": "0.1.33", | ||
"version": "0.1.34", | ||
"description": "Node.js implementation of a proxy server (think Squid) with support for SSL, authentication, upstream proxy chaining, and protocol tunneling.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -95,3 +95,3 @@ # Programmable HTTP proxy server for Node.js | ||
// Optional HTTP headers of the response | ||
headers: {} | ||
headers: { | ||
'X-My-Header': 'bla bla', | ||
@@ -98,0 +98,0 @@ } |
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
114988
1786