Skip to content

Commit

Permalink
fix(pop3-starttls): ensure default SNICallback option
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Feb 26, 2024
1 parent 4b19dee commit f61111e
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/pop3/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};
}
}

Expand Down

0 comments on commit f61111e

Please sign in to comment.