I think the new HTTP implementation is basically working, now.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4707 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-12-30 18:59:02 +00:00
parent 2f6a92168e
commit d02f17a8cf
6 changed files with 280 additions and 128 deletions

View File

@ -1006,6 +1006,20 @@ loadSettings().then(function() {
}
});
httpd_impl.start(tildefriends.http_port);
if (tildefriends.args.httpdc && tildefriends.https_port) {
async function start_tls() {
const kCertificatePath = "data/httpd/certificate.pem";
const kPrivateKeyPath = "data/httpd/privatekey.pem";
let privateKey = utf8Decode(await File.readFile(kPrivateKeyPath));
let certificate = utf8Decode(await File.readFile(kCertificatePath));
let context = new TlsContext();
context.setPrivateKey(privateKey);
context.setCertificate(certificate);
httpd_impl.start(tildefriends.https_port, context);
}
start_tls();
}
}).catch(function(error) {
print('Failed to load settings.');
printError({print: print}, error);