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 3.0.1 to 3.1.0

4

CHANGELOG.md
# CHANGELOG
## 3.1.0
- [#23], @DullReferenceException Support "*" for SNI host pattern
## 3.0.1

@@ -4,0 +8,0 @@

2

index.js

@@ -228,3 +228,3 @@ 'use strict';

var hostRegexps = sniHosts.map(function(host) {
return new RegExp(
return host === '*' ? /.*/ : new RegExp(
'^' +

@@ -231,0 +231,0 @@ host

{
"name": "create-servers",
"version": "3.0.1",
"version": "3.1.0",
"description": "Create an http AND/OR an https server and call the same request handler.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -375,51 +375,29 @@ /*

test('supports SNI', async t => {
t.plan(1);
await testSni(t, {
'example.com': {
key: 'example-com-key.pem',
cert: 'example-com-cert.pem'
},
'example.net': {
key: 'example-net-key.pem',
cert: 'example-net-cert.pem'
},
'*.example.org': {
key: 'example-org-key.pem',
cert: 'example-org-cert.pem'
}
}, ['example.com', 'example.net', 'foo.example.org']);
});
const hostNames = ['example.com', 'example.net', 'foo.example.org'];
let httpsServer;
try {
const servers = await createServersAsync({
https: {
port: 3456,
root: path.join(__dirname, 'fixtures'),
sni: {
'example.com': {
key: 'example-com-key.pem',
cert: 'example-com-cert.pem'
},
'example.net': {
key: 'example-net-key.pem',
cert: 'example-net-cert.pem'
},
'*.example.org': {
key: 'example-org-key.pem',
cert: 'example-org-cert.pem'
}
}
},
handler: (req, res) => {
res.write('Hello');
res.end();
}
});
httpsServer = servers.https;
hostNames.forEach(host => evilDNS.add(host, '0.0.0.0'));
const responses = await Promise.all(
hostNames.map(hostname => download(`https://${hostname}:3456/`))
);
t.equals(
responses.every(str => str === 'Hello'),
true,
'responses are as expected'
);
} catch (err) {
return void t.error(err);
} finally {
httpsServer && httpsServer.close();
evilDNS.clear();
}
test('supports catch-all * for SNI', async t => {
await testSni(t, {
'example.com': {
key: 'example-com-key.pem',
cert: 'example-com-cert.pem'
},
'*': {
key: 'example-org-key.pem',
cert: 'example-org-cert.pem'
}
}, ['example.com', 'foo.example.org']);
});

@@ -470,1 +448,38 @@

});
async function testSni(t, sniConfig, hostNames) {
t.plan(1);
let httpsServer;
try {
const servers = await createServersAsync({
https: {
port: 3456,
root: path.join(__dirname, 'fixtures'),
sni: sniConfig
},
handler: (req, res) => {
res.write('Hello');
res.end();
}
});
httpsServer = servers.https;
hostNames.forEach(host => evilDNS.add(host, '0.0.0.0'));
const responses = await Promise.all(
hostNames.map(hostname => download(`https://${hostname}:3456/`))
);
t.equals(
responses.every(str => str === 'Hello'),
true,
'responses are as expected'
);
} catch (err) {
return void t.error(err);
} finally {
httpsServer && httpsServer.close();
evilDNS.clear();
}
}
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