create-servers
Advanced tools
+4
-0
| # CHANGELOG | ||
| ## 3.1.0 | ||
| - [#23], @DullReferenceException Support "*" for SNI host pattern | ||
| ## 3.0.1 | ||
@@ -4,0 +8,0 @@ |
+1
-1
@@ -228,3 +228,3 @@ 'use strict'; | ||
| var hostRegexps = sniHosts.map(function(host) { | ||
| return new RegExp( | ||
| return host === '*' ? /.*/ : new RegExp( | ||
| '^' + | ||
@@ -231,0 +231,0 @@ host |
+1
-1
| { | ||
| "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(); | ||
| } | ||
| } |
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
56699
0.68%769
1.85%