Comparing version 0.1.0 to 0.1.1
@@ -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 @@ |
@@ -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": "*" |
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances 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
14378
3
315
4
5
- Removedbatch@*
- Removedmkdirp@*
- Removedbatch@0.6.1(transitive)
- Removedmkdirp@3.0.1(transitive)