smtp-server
Advanced tools
Comparing version 3.8.0 to 3.9.0
# Changelog | ||
## v3.9.0 2021-06-01 | ||
- Bumped dependencies | ||
- Added extra log entries for 'close' events | ||
## v3.8.0 2020-11-13 | ||
@@ -4,0 +9,0 @@ |
@@ -291,3 +291,3 @@ 'use strict'; | ||
_setListeners(callback) { | ||
this._socket.on('close', () => this._onClose()); | ||
this._socket.on('close', hadError => this._onCloseEvent(hadError)); | ||
this._socket.on('error', err => this._onError(err)); | ||
@@ -302,2 +302,20 @@ this._socket.setTimeout(this._server.options.socketTimeout || SOCKET_TIMEOUT, () => this._onTimeout()); | ||
_onCloseEvent(hadError) { | ||
this._server.logger.info( | ||
{ | ||
tnx: 'close', | ||
cid: this.id, | ||
host: this.remoteAddress, | ||
user: (this.session.user && this.session.user.username) || this.session.user, | ||
hadError | ||
}, | ||
'%s received "close" event from %s ' + (hadError ? ' after error' : ''), | ||
this.id, | ||
this.remoteAddress, | ||
hadError | ||
); | ||
this._onClose(); | ||
} | ||
/** | ||
@@ -348,9 +366,2 @@ * Fired when the socket is closed | ||
_onError(err) { | ||
if ((err.code === 'ECONNRESET' || err.code === 'EPIPE') && (!this.session.envelope || !this.session.envelope.mailFrom)) { | ||
// We got a connection error outside transaction. In most cases it means dirty | ||
// connection ending by the other party, so we can just ignore it | ||
this.close(); // mark connection as 'closing' | ||
return; | ||
} | ||
err.remote = this.remoteAddress; | ||
@@ -363,5 +374,15 @@ this._server.logger.error( | ||
}, | ||
'%s', | ||
'%s %s %s', | ||
this.id, | ||
this.remoteAddress, | ||
err.message | ||
); | ||
if ((err.code === 'ECONNRESET' || err.code === 'EPIPE') && (!this.session.envelope || !this.session.envelope.mailFrom)) { | ||
// We got a connection error outside transaction. In most cases it means dirty | ||
// connection ending by the other party, so we can just ignore it | ||
this.close(); // mark connection as 'closing' | ||
return; | ||
} | ||
this.emit('error', err); | ||
@@ -1392,3 +1413,3 @@ } | ||
secureSocket.once('close', () => this._onClose()); | ||
secureSocket.once('close', hadError => this._onCloseEvent(hadError)); | ||
secureSocket.once('error', err => this._onError(err)); | ||
@@ -1395,0 +1416,0 @@ secureSocket.once('_tlsError', err => this._onError(err)); |
@@ -259,3 +259,3 @@ 'use strict'; | ||
this.options.SNICallback = (servername, cb) => { | ||
cb(null, this.secureContext.get(this._normalizeHostname(servername)) || this.secureContext.get('*')); | ||
cb(null, this.secureContext.get(servername)); | ||
}; | ||
@@ -449,3 +449,19 @@ } | ||
server: this.server, | ||
SNICallback: this.options.SNICallback | ||
SNICallback: (servername, cb) => { | ||
// eslint-disable-next-line new-cap | ||
this.options.SNICallback(this._normalizeHostname(servername), (err, context) => { | ||
if (err) { | ||
this.logger.error( | ||
{ | ||
tnx: 'sni', | ||
servername, | ||
err | ||
}, | ||
'Failed to fetch SNI context for servername %s', | ||
servername | ||
); | ||
} | ||
return cb(null, context || this.secureContext.get('*')); | ||
}); | ||
} | ||
}; | ||
@@ -452,0 +468,0 @@ |
{ | ||
"name": "smtp-server", | ||
"version": "3.8.0", | ||
"version": "3.9.0", | ||
"description": "Create custom SMTP servers on the fly", | ||
@@ -14,13 +14,13 @@ "main": "lib/smtp-server.js", | ||
"ipv6-normalize": "1.0.1", | ||
"nodemailer": "6.4.16" | ||
"nodemailer": "6.6.1" | ||
}, | ||
"devDependencies": { | ||
"chai": "4.2.0", | ||
"chai": "4.3.4", | ||
"eslint-config-nodemailer": "1.2.0", | ||
"eslint-config-prettier": "6.15.0", | ||
"grunt": "1.3.0", | ||
"grunt-cli": "1.3.2", | ||
"eslint-config-prettier": "8.3.0", | ||
"grunt": "1.4.1", | ||
"grunt-cli": "1.4.3", | ||
"grunt-eslint": "23.0.0", | ||
"grunt-mocha-test": "0.13.3", | ||
"mocha": "8.2.1", | ||
"mocha": "8.4.0", | ||
"pem": "1.14.4" | ||
@@ -27,0 +27,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
161572
3895
+ Addednodemailer@6.6.1(transitive)
- Removednodemailer@6.4.16(transitive)
Updatednodemailer@6.6.1