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

create-servers

Package Overview
Dependencies
Maintainers
6
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-servers - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

5

index.js

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

2

package.json
{
"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);

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