Skip to content

Commit f61111e

Browse files
committed
fix(pop3-starttls): ensure default SNICallback option
1 parent 4b19dee commit f61111e

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lib/pop3/server.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,17 @@ class POP3Server extends EventEmitter {
191191
}
192192

193193
if (this.options.secure) {
194-
// appy changes
195-
194+
// apply changes
196195
Object.keys(defaultTlsOptions || {}).forEach(key => {
197196
if (!(key in this.options)) {
198197
this.options[key] = defaultTlsOptions[key];
199198
}
200199
});
201-
202-
// ensure SNICallback method
203-
if (typeof this.options.SNICallback !== 'function') {
204-
// create default SNI handler
205-
this.options.SNICallback = (servername, cb) => {
206-
cb(null, this.secureContext.get(servername));
207-
};
208-
}
200+
} else if (typeof this.options.SNICallback !== 'function') {
201+
// create a default SNI handler
202+
this.options.SNICallback = (servername, cb) => {
203+
cb(null, this.secureContext.get(servername));
204+
};
209205
}
210206
}
211207

0 commit comments

Comments
 (0)