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

distroy

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

distroy - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

35

lib/distroy.js

@@ -37,3 +37,3 @@ /**

this.once("listening", listening);
if(listening) this.once("listening", listening);
}

@@ -86,2 +86,15 @@

/**
* Handle a host `close` event.
* @param {net.Socket} socket
* @param {Array} hosts
* @param {Boolean} hadError
*/
function onHostClose(socket, hosst, hadError) {
for(var i in hosts) {
delete this.hosts[hosts[i]];
delete this.sockets[hosts[i]];
}
}
/**
* Add a server control socket.

@@ -95,14 +108,22 @@ * @param {net.Socket} socket

var port = data.readUInt32BE(6)
, host = data.slice(10).toString("utf8");
var port = data.readUInt32BE(6)
, hosts = data.slice(10).toString("utf8").split(",");
if(host in this.hosts)
return socket.emit("error", new Error("Host `" + host + "` is already in use."));
for(var i in hosts)
if(hosts[i] in this.hosts)
return socket.emit("error", new Error("Host `" + hosts[i] + "` is already in use."));
this.hosts[host] = port;
this.sockets[host] = socket;
for(var i in hosts) {
this.hosts[hosts[i]] = port;
this.sockets[hosts[i]] = socket;
}
socket.once("close", onHostClose.bind(this, socket, hosts));
socket.write("SUCCESS");
};
/**
* Match the Host field in a HTTP header.
* @type {RegExp}
*/
var httpHostRegExp = /^Host:\s+(.*)$/mi;

@@ -109,0 +130,0 @@

7

lib/patch.js

@@ -40,3 +40,3 @@ /**

* @param {Number} port
* @param {String} domain
* @param {String|Array} domain
* @param {Function} cb optional

@@ -53,3 +53,3 @@ * @return {net.Server}

* @param {Number} port
* @param {String} domain
* @param {String|Array} domain
* @param {Function} cb optional

@@ -61,2 +61,5 @@ */

.once("connect", function() {
if(domain instanceof Array)
domain = domain.join(",");
var buf = [

@@ -63,0 +66,0 @@ new Buffer([0xBA, 0xDA, 0x55, 0xC0, 0xFF, 0xEE])

{
"name": "distroy",
"description": "vHost Routing for HTTP and HTTPS",
"version": "0.1.0",
"version": "0.1.1",
"author": "Jan Buschtöns <buschtoens@gmail.com>",

@@ -24,4 +24,2 @@ "contributors": [

"sni": "*",
"mkdirp": "*",
"batch": "*",
"uuid": "*",

@@ -28,0 +26,0 @@ "quevent": "*"

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