create-servers
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -103,5 +103,8 @@ 'use strict'; | ||
var server = http.createServer(options.http.handler || handler), | ||
timeout = options.timeout || options.http.timeout, | ||
port = !isNaN(options.http.port) ? +options.http.port : 80, // accepts string or number | ||
args; | ||
if (typeof timeout === 'number') server.setTimeout(timeout); | ||
args = [server, port]; | ||
@@ -130,2 +133,3 @@ if (options.http.host) { | ||
ciphers = ssl.ciphers || CIPHERS, | ||
timeout = options.timeout || ssl.timeout, | ||
ca = ssl.ca, | ||
@@ -170,2 +174,3 @@ server, | ||
if (typeof timeout === 'number') server.setTimeout(timeout); | ||
args = [server, port]; | ||
@@ -172,0 +177,0 @@ if (options.https.host) { |
{ | ||
"name": "create-servers", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "Create an http AND/OR an https server and call the same request handler.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -54,2 +54,20 @@ /* | ||
test('only http, timeout', function (t) { | ||
t.plan(5); | ||
var time = 3000000; | ||
createServers({ | ||
log: console.log, | ||
timeout: time, | ||
http: 0, | ||
handler: fend | ||
}, function (err, servers) { | ||
console.dir(err); | ||
t.error(err); | ||
t.equals(typeof servers, 'object'); | ||
t.equals(typeof servers.http, 'object'); | ||
t.equals(typeof servers.http.address().port, 'number'); | ||
t.equals(servers.http.timeout, time); | ||
servers.http.close(); | ||
}); | ||
}); | ||
@@ -75,2 +93,24 @@ test('only https', function (t) { | ||
test('only https', function (t) { | ||
t.plan(4); | ||
var time = 4000000; | ||
createServers({ | ||
log: console.log, | ||
https: { | ||
timeout: time, | ||
port: 3456, | ||
root: path.join(__dirname, 'fixtures'), | ||
cert: 'agent2-cert.pem', | ||
key: 'agent2-key.pem' | ||
}, | ||
handler: fend | ||
}, function (err, servers) { | ||
t.error(err); | ||
t.equals(typeof servers, 'object'); | ||
t.equals(typeof servers.https, 'object'); | ||
t.equals(servers.https.timeout, time); | ||
servers.https.close(); | ||
}); | ||
}); | ||
test('absolute cert path resolution', function (t) { | ||
@@ -77,0 +117,0 @@ t.plan(3); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
19230
434
5