fix(pop3-starttls): ensure default SNICallback option

This commit is contained in:
Andris Reinman 2024-02-26 09:16:46 +02:00
parent 4b19dee20b
commit f61111e3cc
No known key found for this signature in database
GPG key ID: DC6C83F4D584D364

View file

@ -191,21 +191,17 @@ class POP3Server extends EventEmitter {
}
if (this.options.secure) {
// appy changes
// apply changes
Object.keys(defaultTlsOptions || {}).forEach(key => {
if (!(key in this.options)) {
this.options[key] = defaultTlsOptions[key];
}
});
// ensure SNICallback method
if (typeof this.options.SNICallback !== 'function') {
// create default SNI handler
this.options.SNICallback = (servername, cb) => {
cb(null, this.secureContext.get(servername));
};
}
} else if (typeof this.options.SNICallback !== 'function') {
// create a default SNI handler
this.options.SNICallback = (servername, cb) => {
cb(null, this.secureContext.get(servername));
};
}
}