Wrap missingServerName, update example

This commit is contained in:
Alex Hultman 2020-08-17 05:41:00 +02:00
parent f77d07014a
commit 103a0562be
3 changed files with 37 additions and 9 deletions

View file

@ -7,14 +7,22 @@ const app = uWS.SSLApp({
key_file_name: 'misc/key.pem',
cert_file_name: 'misc/cert.pem',
passphrase: '1234'
}).addServerName("localhost", {
key_file_name: 'misc/key.pem',
cert_file_name: 'misc/cert.pem',
passphrase: '1234'
}).removeServerName("localhost").addServerName("localhost", {
key_file_name: 'misc/key.pem',
cert_file_name: 'misc/cert.pem',
passphrase: '1234'
}).missingServerName((hostname) => {
/* Note: You don't have to use this callback but can pre-load
* relevant server names up front. This callback is not "async",
* you either add the server name HERE IMMEDIATELY, or the hangshake
* will continue with default certificate (which will most likely fail) */
console.log("Hello! We are missing server name <" + hostname + ">");
/* We simply assume it is localhost, so adding it here */
app.addServerName("localhost", {
key_file_name: 'misc/key.pem',
cert_file_name: 'misc/cert.pem',
passphrase: '1234'
});
}).get('/*', (res, req) => {
res.end('Hello World!');
}).listen(port, (token) => {