Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue when servername not match the hsot. the certificate will got an error with ERR_TLS_CERT_ALTNAME_INVALID #887

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function Connection(config) {
socket: config.socket,
socketTimeout: config.socketTimeout || 0,
host: config.host || 'localhost',
servername: config.servername,
port: config.port || 143,
tls: config.tls,
tlsOptions: config.tlsOptions,
Expand Down Expand Up @@ -118,7 +119,7 @@ Connection.prototype.connect = function() {
if (config.tls) {
tlsOptions = {};
// servername must be set to prevent issues with some imap server and openssl 1.1.1
tlsOptions.servername = config.host;
tlsOptions.servername = config.servername || config.host
tlsOptions.host = config.host;
// Host name may be overridden the tlsOptions
for (var k in config.tlsOptions)
Expand Down