Socket
Socket
Sign inDemoInstall

tunnel

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tunnel - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

.idea/encodings.xml

6

CHANGELOG.md
# 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.

34

lib/tunnel.js

@@ -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

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