mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-05-06 17:30:35 +07:00
node_modules: update (#290)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
24
node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js
generated
vendored
24
node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js
generated
vendored
@@ -22,18 +22,14 @@ const errors = require('../errors');
|
||||
* @param {Function} callback Callback to run with the rocket object once connection is established
|
||||
*/
|
||||
function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
|
||||
let proxy = urllib.parse(proxyUrl);
|
||||
const proxy = urllib.parse(proxyUrl);
|
||||
|
||||
// create a socket connection to the proxy server
|
||||
let options;
|
||||
let connect;
|
||||
let socket;
|
||||
|
||||
options = {
|
||||
const options = {
|
||||
host: proxy.hostname,
|
||||
port: Number(proxy.port) ? Number(proxy.port) : proxy.protocol === 'https:' ? 443 : 80
|
||||
};
|
||||
|
||||
let connect;
|
||||
if (proxy.protocol === 'https:') {
|
||||
// we can use untrusted proxies as long as we verify actual SMTP certificates
|
||||
options.rejectUnauthorized = false;
|
||||
@@ -42,10 +38,12 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
|
||||
connect = net.connect.bind(net);
|
||||
}
|
||||
|
||||
let socket;
|
||||
|
||||
// Error harness for initial connection. Once connection is established, the responsibility
|
||||
// to handle errors is passed to whoever uses this socket
|
||||
let finished = false;
|
||||
let tempSocketErr = err => {
|
||||
const tempSocketErr = err => {
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
@@ -58,8 +56,8 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
|
||||
callback(err);
|
||||
};
|
||||
|
||||
let timeoutErr = () => {
|
||||
let err = new Error('Proxy socket timed out');
|
||||
const timeoutErr = () => {
|
||||
const err = new Error('Proxy socket timed out');
|
||||
err.code = 'ETIMEDOUT';
|
||||
tempSocketErr(err);
|
||||
};
|
||||
@@ -69,7 +67,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
let reqHeaders = {
|
||||
const reqHeaders = {
|
||||
Host: destinationHost + ':' + destinationPort,
|
||||
Connection: 'close'
|
||||
};
|
||||
@@ -93,7 +91,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
|
||||
);
|
||||
|
||||
let headers = '';
|
||||
let onSocketData = chunk => {
|
||||
const onSocketData = chunk => {
|
||||
let match;
|
||||
let remainder;
|
||||
|
||||
@@ -122,7 +120,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
|
||||
} catch (_E) {
|
||||
// ignore
|
||||
}
|
||||
let err = new Error('Invalid response from proxy' + ((match && ': ' + match[1]) || ''));
|
||||
const err = new Error('Invalid response from proxy' + ((match && ': ' + match[1]) || ''));
|
||||
err.code = errors.EPROXY;
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user