node_modules: update (#344)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurlaanddawidd6 authored and GitHub committed 2026-10-10 17:27:57 +02:00
1 parent b099186883
commit 6e88c72525
63 files changed
+2863 -1227

No files matched your search

+23 -7
View File
@@ -157,6 +157,11 @@ class Mail extends node_events_1.EventEmitter {
this.getSocket = false;
}
const mail = new mail_message_js_1.default(this, data);
// a failed message is not going to be read anymore, release its content streams
const fail = (err) => {
mail.releaseStreams();
done(err);
};
this.logger.debug({
tnx: 'transport',
name: this.transporter.name,
@@ -170,7 +175,7 @@ class Mail extends node_events_1.EventEmitter {
tnx: 'plugin',
action: 'compile'
}, 'PluginCompile Error: %s', err.message);
return done(err);
return fail(err);
}
let recipientCount;
try {
@@ -187,7 +192,7 @@ class Mail extends node_events_1.EventEmitter {
tnx: 'transport',
action: 'send'
}, 'Compile Error: %s', err.message);
return done(err);
return fail(err);
}
const maxRecipients = mail.data.maxRecipients === undefined ? DEFAULT_MAX_RECIPIENTS : mail.data.maxRecipients;
if (maxRecipients && recipientCount > maxRecipients) {
@@ -198,7 +203,7 @@ class Mail extends node_events_1.EventEmitter {
tnx: 'transport',
action: 'send'
}, 'Send Error: %s', err.message);
return done(err);
return fail(err);
}
this._processPlugins('stream', mail, err => {
if (err) {
@@ -207,7 +212,7 @@ class Mail extends node_events_1.EventEmitter {
tnx: 'plugin',
action: 'stream'
}, 'PluginStream Error: %s', err.message);
return done(err);
return fail(err);
}
if (mail.data.dkim || this.dkim) {
mail.message.processFunc(input => {
@@ -222,6 +227,7 @@ class Mail extends node_events_1.EventEmitter {
}
this.transporter.send(mail, (...args) => {
if (args[0]) {
mail.releaseStreams();
this.logger.error({
err: args[0],
tnx: 'transport',
@@ -289,6 +295,11 @@ class Mail extends node_events_1.EventEmitter {
// setup socket handler for the mailer object
this.getSocket = (options, callback) => {
const protocol = proxy.protocol.replace(/:$/, '').toLowerCase();
// The proxy handshake is a part of connecting and draws from the same deadline as the
// SMTP connection that follows it: whatever the proxy takes, the connection does not get
const configuredTimeout = Number(this.options.connectionTimeout) || 0;
const connectStartedAt = Number(options.connectStartedAt) || Date.now();
const connectionTimeout = configuredTimeout ? Math.max(connectStartedAt + configuredTimeout - Date.now(), 1) : undefined;
if (this.meta.has('proxy_handler_' + protocol)) {
return this.meta.get('proxy_handler_' + protocol)(proxy, options, callback);
}
@@ -296,7 +307,7 @@ class Mail extends node_events_1.EventEmitter {
// Connect using a HTTP CONNECT method
case 'http':
case 'https':
(0, http_proxy_client_js_1.default)(proxy.href, options.port, options.host, this.options.tls || {}, (err, socket) => {
(0, http_proxy_client_js_1.default)(proxy.href, options.port, options.host, connectionTimeout ? Object.assign({}, this.options.tls, { timeout: connectionTimeout }) : this.options.tls || {}, (err, socket) => {
if (err) {
return callback(err);
}
@@ -330,6 +341,9 @@ class Mail extends node_events_1.EventEmitter {
},
command: 'connect'
};
if (connectionTimeout) {
connectionOpts.timeout = connectionTimeout;
}
if (proxy.username || proxy.password) {
const username = proxy.username || '';
const password = proxy.password || '';
@@ -359,11 +373,13 @@ class Mail extends node_events_1.EventEmitter {
if (node_net_1.default.isIP(proxy.hostname)) {
return connect(proxy.hostname);
}
return node_dns_1.default.resolve(proxy.hostname, (err, address) => {
// lookup goes through the hosts file and returns an IPv6 address as well,
// the same way a connection to the proxy host would be resolved otherwise
return node_dns_1.default.lookup(proxy.hostname, (err, address) => {
if (err) {
return callback(err);
}
connect(Array.isArray(address) ? address[0] : address);
connect(address);
});
}
}
+5
View File
@@ -90,6 +90,11 @@ export default class MailMessage<T = SentMessageInfo> {
[key: string]: any;
}, key: string | number, options?: ResolveContentOptions | false): Promise<any>;
resolveAll(callback: MailMessageDataCallback): void;
/**
* Destroys the content streams of the message once sending failed. A stream that was not
* read to the end would otherwise keep the file or the socket behind it open
*/
releaseStreams(): void;
normalize(callback: MailMessageDataCallback): void;
setMailerHeader(): void;
setPriorityHeaders(): void;
+20
View File
@@ -174,6 +174,26 @@ class MailMessage {
};
setImmediate(() => resolveNext());
}
/**
* Destroys the content streams of the message once sending failed. A stream that was not
* read to the end would otherwise keep the file or the socket behind it open
*/
releaseStreams() {
const data = this.data;
const values = [data.html, data.text, data.watchHtml, data.amp, data.raw, data.icalEvent];
for (const key of ['attachments', 'alternatives']) {
if (Array.isArray(data[key])) {
values.push(...data[key]);
}
}
for (const value of values) {
if (value && typeof value === 'object') {
shared.destroyStream(value);
shared.destroyStream(value.content);
shared.destroyStream(value.raw);
}
}
}
normalize(callback) {
const envelope = this.message.getEnvelope();
const messageId = this.message.messageId();