From f61111e3cc2d48aaa4ae0ad31e0665caa3db8394 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Mon, 26 Feb 2024 09:16:46 +0200 Subject: [PATCH] fix(pop3-starttls): ensure default SNICallback option --- lib/pop3/server.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/pop3/server.js b/lib/pop3/server.js index 4bb425e..1d231a1 100644 --- a/lib/pop3/server.js +++ b/lib/pop3/server.js @@ -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)); + }; } }