Comparing version 0.0.5 to 0.0.6
# Changelog | ||
- 0.0.6 (2018/09/11) | ||
- Fix `localAddress` not working (#25) | ||
- Fix `Host:` header for CONNECT method by @tmurakam (#29, #30) | ||
- Fix default port for https (#32) | ||
- Fix error handling when the proxy send illegal response body (#33) | ||
- 0.0.5 (2017/06/12) | ||
@@ -4,0 +10,0 @@ - Fix socket leak. |
@@ -28,2 +28,3 @@ 'use strict'; | ||
agent.createSocket = createSecureSocket; | ||
agent.defaultPort = 443; | ||
return agent; | ||
@@ -42,2 +43,3 @@ } | ||
agent.createSocket = createSecureSocket; | ||
agent.defaultPort = 443; | ||
return agent; | ||
@@ -111,4 +113,10 @@ } | ||
path: options.host + ':' + options.port, | ||
agent: false | ||
agent: false, | ||
headers: { | ||
host: options.host + ':' + options.port | ||
} | ||
}); | ||
if (options.localAddress) { | ||
connectOptions.localAddress = options.localAddress; | ||
} | ||
if (connectOptions.proxyAuth) { | ||
@@ -145,17 +153,25 @@ connectOptions.headers = connectOptions.headers || {}; | ||
if (res.statusCode === 200) { | ||
assert.equal(head.length, 0); | ||
debug('tunneling connection has established'); | ||
self.sockets[self.sockets.indexOf(placeholder)] = socket; | ||
cb(socket); | ||
} else { | ||
if (res.statusCode !== 200) { | ||
debug('tunneling socket could not be established, statusCode=%d', | ||
res.statusCode); | ||
res.statusCode); | ||
socket.destroy(); | ||
var error = new Error('tunneling socket could not be established, ' + | ||
'statusCode=' + res.statusCode); | ||
'statusCode=' + res.statusCode); | ||
error.code = 'ECONNRESET'; | ||
options.request.emit('error', error); | ||
self.removeSocket(placeholder); | ||
return; | ||
} | ||
if (head.length > 0) { | ||
debug('got illegal response body from proxy'); | ||
socket.destroy(); | ||
var error = new Error('got illegal response body from proxy'); | ||
error.code = 'ECONNRESET'; | ||
options.request.emit('error', error); | ||
self.removeSocket(placeholder); | ||
return; | ||
} | ||
debug('tunneling connection has established'); | ||
self.sockets[self.sockets.indexOf(placeholder)] = socket; | ||
return cb(socket); | ||
} | ||
@@ -162,0 +178,0 @@ |
{ | ||
"name": "tunnel", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Node HTTP/HTTPS Agents for tunneling proxies", | ||
@@ -28,4 +28,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"mocha": "*", | ||
"should": "*" | ||
"mocha": "^5.2.0", | ||
"should": "^13.2.3" | ||
}, | ||
@@ -32,0 +32,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
2
5
64886
12
231