mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-09 18:04:08 +07:00
node_modules: update (#340)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
791f27c1e4
commit
0635835dfc
50 files changed
+835
-266
No files matched your search
+11
-3
@@ -21,13 +21,21 @@ export type HttpProxyClientCallback = Callback<net.Socket>;
|
||||
* socket.write("GET / HTTP/1.0\r\n\r\n");
|
||||
* });
|
||||
*
|
||||
* @param proxyUrl proxy configuration, etg "http://proxy.host:3128/"
|
||||
* @param proxyUrl proxy configuration, e.g. "http://proxy.host:3128/"
|
||||
* @param destinationPort Port to open in destination host
|
||||
* @param destinationHost Destination hostname
|
||||
* @param [tlsOptions] Optional TLS options for an HTTPS proxy (e.g. { rejectUnauthorized: false })
|
||||
* @param callback Callback to run with the rocket object once connection is established
|
||||
* @param callback Callback to run with the socket object once connection is established
|
||||
*/
|
||||
declare function httpProxyClient(proxyUrl: string, destinationPort: number | string, destinationHost: string, callback: HttpProxyClientCallback): void;
|
||||
/**
|
||||
* Establishes proxied connection to destinationPort through an HTTPS proxy
|
||||
*
|
||||
* @param proxyUrl proxy configuration, e.g. "https://proxy.host:3128/"
|
||||
* @param destinationPort Port to open in destination host
|
||||
* @param destinationHost Destination hostname
|
||||
* @param tlsOptions TLS options for the proxy connection (e.g. { rejectUnauthorized: false })
|
||||
* @param callback Callback to run with the socket object once connection is established
|
||||
*/
|
||||
declare function httpProxyClient(proxyUrl: string, destinationPort: number | string, destinationHost: string, tlsOptions: HttpProxyClientOptions | undefined, callback: HttpProxyClientCallback): void;
|
||||
/**
|
||||
* Socket timeout in milliseconds while the CONNECT handshake is in progress, defaults to 30 seconds.
|
||||
|
||||
+17
-7
@@ -88,18 +88,28 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
||||
.join('\r\n') +
|
||||
// End request
|
||||
'\r\n\r\n');
|
||||
let headers = '';
|
||||
// The response is collected as chunks and only the bytes that just arrived, together
|
||||
// with the three before them, are searched for the end of the headers. Appending to a
|
||||
// string and searching all of it again re-read the whole response on every chunk.
|
||||
const chunks = [];
|
||||
let received = 0;
|
||||
let tail = '';
|
||||
const onSocketData = (chunk) => {
|
||||
let match;
|
||||
let remainder;
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
headers += chunk.toString('binary');
|
||||
if ((match = headers.match(/\r\n\r\n/))) {
|
||||
const window = tail + chunk.toString('binary');
|
||||
const windowEnd = window.indexOf('\r\n\r\n');
|
||||
chunks.push(chunk);
|
||||
received += chunk.length;
|
||||
tail = window.slice(-3);
|
||||
if (windowEnd >= 0) {
|
||||
socket.removeListener('data', onSocketData);
|
||||
remainder = headers.substr(match.index + match[0].length);
|
||||
headers = headers.substr(0, match.index);
|
||||
const headerEnd = received - window.length + windowEnd;
|
||||
const response = Buffer.concat(chunks, received).toString('binary');
|
||||
const headers = response.substr(0, headerEnd);
|
||||
const remainder = response.substr(headerEnd + 4);
|
||||
if (remainder) {
|
||||
socket.unshift(Buffer.from(remainder, 'binary'));
|
||||
}
|
||||
@@ -123,7 +133,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
||||
socket.setTimeout(0);
|
||||
return done(null, socket);
|
||||
}
|
||||
if (headers.length > MAX_RESPONSE_HEADER_BYTES) {
|
||||
if (received > MAX_RESPONSE_HEADER_BYTES) {
|
||||
socket.removeListener('data', onSocketData);
|
||||
const err = new Error('Proxy response headers too large');
|
||||
err.code = errors.EPROXY;
|
||||
|
||||
+1
-1
@@ -379,7 +379,7 @@ declare class SMTPConnection extends EventEmitter {
|
||||
*
|
||||
* @param envelope Envelope object, {from: addr, to: [addr]}
|
||||
* @param message String, Buffer or a Stream
|
||||
* @param callback Callback to return once sending is completed
|
||||
* @param done Callback to return once sending is completed
|
||||
*/
|
||||
send(envelope: SMTPEnvelope, message: string | Buffer | Readable, done: SMTPConnectionSendCallback): void;
|
||||
/**
|
||||
|
||||
+15
-1
@@ -576,7 +576,7 @@ class SMTPConnection extends EventEmitter {
|
||||
*
|
||||
* @param envelope Envelope object, {from: addr, to: [addr]}
|
||||
* @param message String, Buffer or a Stream
|
||||
* @param callback Callback to return once sending is completed
|
||||
* @param done Callback to return once sending is completed
|
||||
*/
|
||||
send(envelope, message, done) {
|
||||
// ensure that the callback is only called once. The public callback type has a
|
||||
@@ -789,6 +789,8 @@ class SMTPConnection extends EventEmitter {
|
||||
* @event
|
||||
* @param err Error object
|
||||
* @param type Error name
|
||||
* @param data Server response that triggered the error, false if there is none
|
||||
* @param command SMTP command that was in flight
|
||||
* @internal
|
||||
*/
|
||||
_onError(err, type, data, command) {
|
||||
@@ -1057,6 +1059,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* {from:'...', to:['...']}
|
||||
* or
|
||||
* {from:{address:'...',name:'...'}, to:[address:'...',name:'...']}
|
||||
* @param callback Callback to run once the envelope is processed
|
||||
* @internal
|
||||
*/
|
||||
_setEnvelope(envelope, callback) {
|
||||
@@ -1451,6 +1454,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* hosts invalidly use a longer message than VXNlcm5hbWU6
|
||||
*
|
||||
* @param str Message from the server
|
||||
* @param callback Callback to run once the authentication sequence completes
|
||||
* @internal
|
||||
*/
|
||||
_actionAUTH_LOGIN_USER(str, callback) {
|
||||
@@ -1472,6 +1476,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* base64 encoded again.
|
||||
*
|
||||
* @param str Message from the server
|
||||
* @param callback Callback to run once the authentication sequence completes
|
||||
* @internal
|
||||
*/
|
||||
_actionAUTH_CRAM_MD5(str, callback) {
|
||||
@@ -1496,6 +1501,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* the user can be considered logged in. Start waiting for a message to send
|
||||
*
|
||||
* @param str Message from the server
|
||||
* @param callback Callback to run once the authentication sequence completes
|
||||
* @internal
|
||||
*/
|
||||
_actionAUTH_CRAM_MD5_PASS(str, callback) {
|
||||
@@ -1517,6 +1523,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* response needs to be base64 encoded password.
|
||||
*
|
||||
* @param str Message from the server
|
||||
* @param callback Callback to run once the authentication sequence completes
|
||||
* @internal
|
||||
*/
|
||||
_actionAUTH_LOGIN_PASS(str, callback) {
|
||||
@@ -1536,6 +1543,8 @@ class SMTPConnection extends EventEmitter {
|
||||
* the user can be considered logged in. Start waiting for a message to send
|
||||
*
|
||||
* @param str Message from the server
|
||||
* @param isRetry True if this is a retry after a failed login, or the callback itself
|
||||
* @param [callback] Callback to run once the authentication sequence completes
|
||||
* @internal
|
||||
*/
|
||||
_actionAUTHComplete(str, isRetry, callback) {
|
||||
@@ -1578,6 +1587,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* Handle response for a MAIL FROM: command
|
||||
*
|
||||
* @param str Message from the server
|
||||
* @param callback Callback to run once the envelope is processed
|
||||
* @internal
|
||||
*/
|
||||
_actionMAIL(str, callback) {
|
||||
@@ -1606,6 +1616,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* Handle response for a RCPT TO: command
|
||||
*
|
||||
* @param str Message from the server
|
||||
* @param callback Callback to run once the envelope is processed
|
||||
* @internal
|
||||
*/
|
||||
_actionRCPT(str, callback) {
|
||||
@@ -1657,6 +1668,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* Handle response for a DATA command
|
||||
*
|
||||
* @param str Message from the server
|
||||
* @param callback Callback to run once the envelope is processed
|
||||
* @internal
|
||||
*/
|
||||
_actionDATA(str, callback) {
|
||||
@@ -1683,6 +1695,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* We expect a single response that defines if the sending succeeded or failed
|
||||
*
|
||||
* @param str Message from the server
|
||||
* @param callback Callback to run with the final send result
|
||||
* @internal
|
||||
*/
|
||||
_actionSMTPStream(str, callback) {
|
||||
@@ -1699,6 +1712,7 @@ class SMTPConnection extends EventEmitter {
|
||||
* @param recipient The recipient this response applies to
|
||||
* @param final Is this the final recipient?
|
||||
* @param str Message from the server
|
||||
* @param callback Callback to run with the final send result
|
||||
* @internal
|
||||
*/
|
||||
_actionLMTPStream(recipient, final, str, callback) {
|
||||
|
||||
Reference in new issue
Block a user