@mavogel/awscdk-rootmail 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +10 -10
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +5 -5
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/schemas/schemas_0.js +4 -4
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeDeliveryDestinationsCommand.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/GetDeliveryDestinationCommand.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/PutAccountPolicyCommand.d.ts +4 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/PutDeliveryDestinationCommand.d.ts +2 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/models_0.d.ts +80 -36
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/models_0.d.ts +2 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +1 -1
- package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-route-53/package.json +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +2 -1
- package/node_modules/@aws-sdk/client-s3/dist-es/models/enums.js +1 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetBucketInventoryConfigurationCommand.d.ts +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/ListBucketInventoryConfigurationsCommand.d.ts +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutBucketInventoryConfigurationCommand.d.ts +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/models/enums.d.ts +1 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/enums.d.ts +1 -0
- package/node_modules/@aws-sdk/client-s3/package.json +2 -2
- package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ses/package.json +1 -1
- package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +9 -3
- package/node_modules/@aws-sdk/client-ssm/dist-es/models/enums.js +4 -0
- package/node_modules/@aws-sdk/client-ssm/dist-es/schemas/schemas_0.js +3 -2
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/DeleteResourcePolicyCommand.d.ts +6 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/PutResourcePolicyCommand.d.ts +12 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/enums.d.ts +12 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/models_0.d.ts +20 -1
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/models_1.d.ts +2 -2
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/enums.d.ts +5 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/models_0.d.ts +2 -0
- package/node_modules/@aws-sdk/client-ssm/package.json +1 -1
- package/node_modules/@zone-eu/mailsplit/lib/flowed-decoder.js +1 -5
- package/node_modules/@zone-eu/mailsplit/lib/headers.js +35 -25
- package/node_modules/@zone-eu/mailsplit/lib/message-splitter.js +126 -79
- package/node_modules/@zone-eu/mailsplit/lib/mime-node.js +27 -5
- package/node_modules/@zone-eu/mailsplit/lib/node-rewriter.js +3 -2
- package/node_modules/@zone-eu/mailsplit/lib/types.d.ts +0 -3
- package/node_modules/@zone-eu/mailsplit/package.json +5 -5
- package/node_modules/libbase64/.github/workflows/release.yaml +12 -10
- package/node_modules/libbase64/.ncurc.js +7 -1
- package/node_modules/libbase64/CHANGELOG.md +7 -0
- package/node_modules/libbase64/lib/libbase64.js +27 -0
- package/node_modules/libbase64/package.json +4 -4
- package/node_modules/libmime/CHANGELOG.md +14 -0
- package/node_modules/libmime/lib/libmime.js +41 -21
- package/node_modules/libmime/package.json +3 -3
- package/node_modules/libqp/.github/workflows/release.yaml +12 -10
- package/node_modules/libqp/CHANGELOG.md +7 -0
- package/node_modules/libqp/lib/libqp.js +6 -4
- package/node_modules/libqp/package.json +2 -2
- package/node_modules/libqp/test/libqp-test.js +71 -14
- package/node_modules/mailparser/.release-please-manifest.json +1 -1
- package/node_modules/mailparser/CHANGELOG.md +42 -0
- package/node_modules/mailparser/README.md +5 -0
- package/node_modules/mailparser/lib/mail-parser.js +107 -32
- package/node_modules/mailparser/lib/simple-parser.js +12 -0
- package/node_modules/mailparser/lib/stream-hash.js +1 -1
- package/node_modules/mailparser/package.json +6 -6
- package/node_modules/nodemailer/CHANGELOG.md +38 -0
- package/node_modules/nodemailer/README.md +1 -1
- package/node_modules/nodemailer/dist/cjs/addressparser/index.d.ts +16 -2
- package/node_modules/nodemailer/dist/cjs/addressparser/index.js +147 -28
- package/node_modules/nodemailer/dist/cjs/base64/index.js +2 -1
- package/node_modules/nodemailer/dist/cjs/dkim/index.d.ts +13 -1
- package/node_modules/nodemailer/dist/cjs/dkim/index.js +25 -8
- package/node_modules/nodemailer/dist/cjs/dkim/message-parser.d.ts +10 -1
- package/node_modules/nodemailer/dist/cjs/dkim/message-parser.js +28 -4
- package/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.d.ts +10 -1
- package/node_modules/nodemailer/dist/cjs/dkim/sign.d.ts +3 -0
- package/node_modules/nodemailer/dist/cjs/dkim/sign.js +18 -1
- package/node_modules/nodemailer/dist/cjs/errors.d.ts +3 -2
- package/node_modules/nodemailer/dist/cjs/fetch/cookies.d.ts +12 -1
- package/node_modules/nodemailer/dist/cjs/fetch/index.d.ts +15 -1
- package/node_modules/nodemailer/dist/cjs/fetch/index.js +39 -64
- package/node_modules/nodemailer/dist/cjs/json-transport/index.d.ts +14 -4
- package/node_modules/nodemailer/dist/cjs/json-transport/index.js +2 -0
- package/node_modules/nodemailer/dist/cjs/mail-composer/index.d.ts +8 -3
- package/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +43 -25
- package/node_modules/nodemailer/dist/cjs/mailer/mail-message.d.ts +11 -4
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.d.ts +7 -3
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +198 -84
- package/node_modules/nodemailer/dist/cjs/mime-node/index.d.ts +5 -2
- package/node_modules/nodemailer/dist/cjs/mime-node/index.js +2 -1
- package/node_modules/nodemailer/dist/cjs/nodemailer.d.ts +38 -16
- package/node_modules/nodemailer/dist/cjs/nodemailer.js +1 -0
- package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
- package/node_modules/nodemailer/dist/cjs/punycode/index.js +1 -0
- package/node_modules/nodemailer/dist/cjs/qp/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/cjs/qp/index.js +10 -1
- package/node_modules/nodemailer/dist/cjs/sendmail-transport/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/cjs/ses-transport/index.d.ts +39 -2
- package/node_modules/nodemailer/dist/cjs/shared/index.d.ts +43 -7
- package/node_modules/nodemailer/dist/cjs/shared/index.js +5 -2
- package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.d.ts +2 -1
- package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.js +32 -24
- package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.d.ts +13 -5
- package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.js +23 -11
- package/node_modules/nodemailer/dist/cjs/smtp-connection/index.d.ts +59 -24
- package/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +156 -75
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.d.ts +12 -4
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.js +39 -11
- package/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.js +27 -31
- package/node_modules/nodemailer/dist/cjs/smtp-transport/index.d.ts +19 -6
- package/node_modules/nodemailer/dist/cjs/smtp-transport/index.js +25 -33
- package/node_modules/nodemailer/dist/cjs/stream-transport/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/cjs/well-known/services.js +6 -0
- package/node_modules/nodemailer/dist/cjs/xoauth2/index.d.ts +13 -3
- package/node_modules/nodemailer/dist/cjs/xoauth2/index.js +25 -13
- package/node_modules/nodemailer/dist/esm/addressparser/index.d.ts +16 -2
- package/node_modules/nodemailer/dist/esm/addressparser/index.js +147 -27
- package/node_modules/nodemailer/dist/esm/base64/index.js +2 -1
- package/node_modules/nodemailer/dist/esm/dkim/index.d.ts +13 -1
- package/node_modules/nodemailer/dist/esm/dkim/index.js +25 -8
- package/node_modules/nodemailer/dist/esm/dkim/message-parser.d.ts +10 -1
- package/node_modules/nodemailer/dist/esm/dkim/message-parser.js +30 -5
- package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.d.ts +10 -1
- package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js +2 -1
- package/node_modules/nodemailer/dist/esm/dkim/sign.d.ts +3 -0
- package/node_modules/nodemailer/dist/esm/dkim/sign.js +18 -1
- package/node_modules/nodemailer/dist/esm/errors.d.ts +3 -2
- package/node_modules/nodemailer/dist/esm/fetch/cookies.d.ts +12 -1
- package/node_modules/nodemailer/dist/esm/fetch/cookies.js +2 -1
- package/node_modules/nodemailer/dist/esm/fetch/index.d.ts +15 -1
- package/node_modules/nodemailer/dist/esm/fetch/index.js +39 -64
- package/node_modules/nodemailer/dist/esm/json-transport/index.d.ts +14 -4
- package/node_modules/nodemailer/dist/esm/json-transport/index.js +2 -0
- package/node_modules/nodemailer/dist/esm/mail-composer/index.d.ts +8 -3
- package/node_modules/nodemailer/dist/esm/mailer/index.d.ts +43 -25
- package/node_modules/nodemailer/dist/esm/mailer/mail-message.d.ts +11 -4
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.d.ts +7 -3
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.js +198 -84
- package/node_modules/nodemailer/dist/esm/mime-node/index.d.ts +5 -2
- package/node_modules/nodemailer/dist/esm/mime-node/index.js +2 -1
- package/node_modules/nodemailer/dist/esm/nodemailer.d.ts +38 -16
- package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
- package/node_modules/nodemailer/dist/esm/punycode/index.js +1 -0
- package/node_modules/nodemailer/dist/esm/qp/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/esm/qp/index.js +10 -1
- package/node_modules/nodemailer/dist/esm/sendmail-transport/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/esm/ses-transport/index.d.ts +39 -2
- package/node_modules/nodemailer/dist/esm/shared/index.d.ts +43 -7
- package/node_modules/nodemailer/dist/esm/shared/index.js +5 -2
- package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.d.ts +2 -1
- package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js +32 -24
- package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.d.ts +13 -5
- package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.js +23 -11
- package/node_modules/nodemailer/dist/esm/smtp-connection/index.d.ts +59 -24
- package/node_modules/nodemailer/dist/esm/smtp-connection/index.js +156 -75
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.d.ts +12 -4
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.js +39 -11
- package/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.js +27 -31
- package/node_modules/nodemailer/dist/esm/smtp-transport/index.d.ts +19 -6
- package/node_modules/nodemailer/dist/esm/smtp-transport/index.js +25 -33
- package/node_modules/nodemailer/dist/esm/stream-transport/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/esm/well-known/services.js +6 -0
- package/node_modules/nodemailer/dist/esm/xoauth2/index.d.ts +13 -3
- package/node_modules/nodemailer/dist/esm/xoauth2/index.js +25 -13
- package/node_modules/nodemailer/dist/well-known/services.json +7 -0
- package/node_modules/nodemailer/package.json +16 -12
- package/package.json +16 -16
|
@@ -1294,6 +1294,7 @@ class MimeNode {
|
|
|
1294
1294
|
*
|
|
1295
1295
|
* @param addresses An array of address objects
|
|
1296
1296
|
* @param [uniqueList] An array to be populated with addresses
|
|
1297
|
+
* @param [seenAddresses] Addresses already added to uniqueList, shared with recursive calls to keep deduplication linear
|
|
1297
1298
|
* @return address string
|
|
1298
1299
|
* @internal
|
|
1299
1300
|
*/
|
|
@@ -1431,7 +1432,7 @@ class MimeNode {
|
|
|
1431
1432
|
/**
|
|
1432
1433
|
* If needed, mime encodes the name part
|
|
1433
1434
|
*
|
|
1434
|
-
* @param
|
|
1435
|
+
* @param value Name part of an address
|
|
1435
1436
|
* @returns Mime word encoded string if needed
|
|
1436
1437
|
* @internal
|
|
1437
1438
|
*/
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import Mail from './mailer/index.js';
|
|
2
2
|
import type { MailDefaults, SentMessageInfo, Transport, TransportOptions } from './mailer/index.js';
|
|
3
|
+
import SMTPPool from './smtp-pool/index.js';
|
|
3
4
|
import type { SMTPPoolOptions, SMTPPoolSentMessageInfo } from './smtp-pool/index.js';
|
|
5
|
+
import SMTPTransport from './smtp-transport/index.js';
|
|
4
6
|
import type { SMTPTransportOptions, SMTPSentMessageInfo } from './smtp-transport/index.js';
|
|
7
|
+
import SendmailTransport from './sendmail-transport/index.js';
|
|
5
8
|
import type { SendmailTransportOptions, SendmailSentMessageInfo } from './sendmail-transport/index.js';
|
|
9
|
+
import StreamTransport from './stream-transport/index.js';
|
|
6
10
|
import type { StreamTransportOptions, StreamSentMessageInfo } from './stream-transport/index.js';
|
|
7
|
-
import
|
|
11
|
+
import JSONTransport from './json-transport/index.js';
|
|
12
|
+
import type { JSONTransportOptions, JSONSentMessageInfo, JSONSentMessageObjectInfo } from './json-transport/index.js';
|
|
13
|
+
import SESTransport from './ses-transport/index.js';
|
|
8
14
|
import type { SESTransportOptions, SESSentMessageInfo } from './ses-transport/index.js';
|
|
9
15
|
/**
|
|
10
16
|
* Connection details of a service endpoint of an Ethereal test account
|
|
@@ -43,32 +49,48 @@ export type TransportConfig = SMTPTransportOptions | SMTPPoolOptions | SendmailT
|
|
|
43
49
|
* @param defaults Default message fields that are merged into every message
|
|
44
50
|
* @returns Mail instance wrapping the transport
|
|
45
51
|
*/
|
|
46
|
-
export declare function createTransport(transporter: SMTPPoolOptions & {
|
|
52
|
+
export declare function createTransport(transporter: SMTPPool | (SMTPPoolOptions & {
|
|
47
53
|
pool: true;
|
|
48
|
-
}, defaults?: MailDefaults): Mail<SMTPPoolSentMessageInfo>;
|
|
49
|
-
export declare function createTransport(transporter: SendmailTransportOptions & {
|
|
54
|
+
}), defaults?: MailDefaults): Mail<SMTPPoolSentMessageInfo, SMTPPoolOptions>;
|
|
55
|
+
export declare function createTransport(transporter: SendmailTransport | (SendmailTransportOptions & {
|
|
50
56
|
sendmail: true | string;
|
|
51
|
-
}, defaults?: MailDefaults): Mail<SendmailSentMessageInfo>;
|
|
52
|
-
export declare function createTransport(transporter: StreamTransportOptions & {
|
|
57
|
+
}), defaults?: MailDefaults): Mail<SendmailSentMessageInfo, SendmailTransportOptions>;
|
|
58
|
+
export declare function createTransport(transporter: StreamTransport | (StreamTransportOptions & {
|
|
53
59
|
streamTransport: true;
|
|
54
|
-
}, defaults?: MailDefaults): Mail<StreamSentMessageInfo>;
|
|
60
|
+
}), defaults?: MailDefaults): Mail<StreamSentMessageInfo, StreamTransportOptions>;
|
|
55
61
|
export declare function createTransport(transporter: JSONTransportOptions & {
|
|
56
62
|
jsonTransport: true;
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
skipEncoding: true;
|
|
64
|
+
}, defaults?: MailDefaults): Mail<JSONSentMessageObjectInfo, JSONTransportOptions>;
|
|
65
|
+
export declare function createTransport(transporter: JSONTransport | (JSONTransportOptions & {
|
|
66
|
+
jsonTransport: true;
|
|
67
|
+
}), defaults?: MailDefaults): Mail<JSONSentMessageInfo, JSONTransportOptions>;
|
|
68
|
+
export declare function createTransport(transporter: SESTransport | (SESTransportOptions & {
|
|
59
69
|
SES: object;
|
|
60
|
-
}, defaults?: MailDefaults): Mail<SESSentMessageInfo>;
|
|
61
|
-
export declare function createTransport
|
|
62
|
-
export declare function createTransport(transporter
|
|
63
|
-
export declare function createTransport(transporter?:
|
|
70
|
+
}), defaults?: MailDefaults): Mail<SESSentMessageInfo, SESTransportOptions>;
|
|
71
|
+
export declare function createTransport(transporter: SMTPTransport, defaults?: MailDefaults): Mail<SMTPSentMessageInfo, SMTPTransportOptions>;
|
|
72
|
+
export declare function createTransport<T = SentMessageInfo, D extends TransportOptions = TransportOptions>(transporter: Transport<T, D>, defaults?: MailDefaults): Mail<T, D>;
|
|
73
|
+
export declare function createTransport(transporter?: SMTPTransportOptions | string, defaults?: MailDefaults): Mail<SMTPSentMessageInfo, SMTPTransportOptions>;
|
|
74
|
+
export declare function createTransport(transporter?: TransportConfig | Transport<any, any> | string, defaults?: MailDefaults): Mail<any, any>;
|
|
64
75
|
/**
|
|
65
76
|
* Creates a test account from the Ethereal service (https://ethereal.email)
|
|
66
77
|
*
|
|
67
|
-
* @param
|
|
68
|
-
* @param callback Callback function to run with the account object. If not set, a Promise is returned
|
|
78
|
+
* @param callback Callback function to run with the account object
|
|
69
79
|
*/
|
|
70
80
|
export declare function createTestAccount(callback: TestAccountCallback): void;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a test account from the Ethereal service (https://ethereal.email)
|
|
83
|
+
*
|
|
84
|
+
* @param apiUrl API endpoint, defaults to https://api.nodemailer.com
|
|
85
|
+
* @param callback Callback function to run with the account object
|
|
86
|
+
*/
|
|
71
87
|
export declare function createTestAccount(apiUrl: string | false | null | undefined, callback: TestAccountCallback): void;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a test account from the Ethereal service (https://ethereal.email)
|
|
90
|
+
*
|
|
91
|
+
* @param [apiUrl] API endpoint, defaults to https://api.nodemailer.com
|
|
92
|
+
* @returns Promise that resolves with the account object
|
|
93
|
+
*/
|
|
72
94
|
export declare function createTestAccount(apiUrl?: string | false | null): Promise<TestAccount>;
|
|
73
95
|
/**
|
|
74
96
|
* Resolves the Ethereal web URL for a message sent through an Ethereal test account
|
|
@@ -98,5 +120,5 @@ export type { SMTPTransportOptions, SMTPSentMessageInfo };
|
|
|
98
120
|
export type { SMTPPoolOptions, SMTPPoolSentMessageInfo };
|
|
99
121
|
export type { SendmailTransportOptions, SendmailSentMessageInfo };
|
|
100
122
|
export type { StreamTransportOptions, StreamSentMessageInfo };
|
|
101
|
-
export type { JSONTransportOptions, JSONSentMessageInfo };
|
|
123
|
+
export type { JSONTransportOptions, JSONSentMessageInfo, JSONSentMessageObjectInfo };
|
|
102
124
|
export type { SESTransportOptions, SESSentMessageInfo };
|
|
@@ -178,6 +178,7 @@ const basicToDigit = function (codePoint) {
|
|
|
178
178
|
* @see `basicToDigit()`
|
|
179
179
|
* @private
|
|
180
180
|
* @param digit The numeric value of a basic code point.
|
|
181
|
+
* @param flag Non-zero to use the uppercase form of the code point.
|
|
181
182
|
* @returns The basic code point whose value (when used for
|
|
182
183
|
* representing integers) is `digit`, which needs to be in the range
|
|
183
184
|
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
@@ -15,6 +15,8 @@ export interface QPEncoderOptions {
|
|
|
15
15
|
/** Maximum length for lines, set to false to disable wrapping */
|
|
16
16
|
lineLength?: number | false | undefined;
|
|
17
17
|
}
|
|
18
|
+
/** The name @types/nodemailer used for QPEncoderOptions */
|
|
19
|
+
export type EncoderOptions = QPEncoderOptions;
|
|
18
20
|
/**
|
|
19
21
|
* Creates a transform stream for encoding data to Quoted-Printable encoding
|
|
20
22
|
*
|
|
@@ -10,6 +10,8 @@ const node_stream_1 = require("node:stream");
|
|
|
10
10
|
* @param buffer Buffer to convert
|
|
11
11
|
* @returns Quoted-Printable encoded string
|
|
12
12
|
*/
|
|
13
|
+
// the shortest line wrap() can make progress with: a complete =XX sequence and the soft break
|
|
14
|
+
const MIN_LINE_LENGTH = 4;
|
|
13
15
|
// usable characters that do not need encoding
|
|
14
16
|
// https://tools.ietf.org/html/rfc2045#section-6.7
|
|
15
17
|
const QP_RANGES = [
|
|
@@ -46,7 +48,9 @@ function encode(buffer) {
|
|
|
46
48
|
*/
|
|
47
49
|
function wrap(str, lineLength) {
|
|
48
50
|
str = (str || '').toString();
|
|
49
|
-
|
|
51
|
+
// a line has to hold a complete =XX sequence plus the soft break, shorter lengths
|
|
52
|
+
// (or a negative one) would loop without consuming input
|
|
53
|
+
lineLength = Math.max(Number(lineLength) || 76, MIN_LINE_LENGTH);
|
|
50
54
|
if (str.length <= lineLength) {
|
|
51
55
|
return str;
|
|
52
56
|
}
|
|
@@ -100,6 +104,11 @@ function wrap(str, lineLength) {
|
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
}
|
|
107
|
+
if (!line.length) {
|
|
108
|
+
// the trimming above emptied the line, which only happens for an incomplete
|
|
109
|
+
// escape at the very end of the input. Take it as is rather than loop on it
|
|
110
|
+
line = str.substr(pos, lineLength);
|
|
111
|
+
}
|
|
103
112
|
if (pos + line.length < len && line.substr(-1) !== '\n') {
|
|
104
113
|
if (line.length === lineLength && line.match(/[=][\da-f]{2}$/i)) {
|
|
105
114
|
line = line.substr(0, line.length - 3);
|
|
@@ -64,4 +64,6 @@ declare namespace SendmailTransport {
|
|
|
64
64
|
type MailOptions = SendMailOptions;
|
|
65
65
|
type SentMessageInfo = SendmailSentMessageInfo;
|
|
66
66
|
}
|
|
67
|
+
/** The same aliases as module level exports, for `import * as SendmailTransport` and `import SendmailTransport = require()` */
|
|
68
|
+
export type { SendmailTransportOptions as Options, SendMailOptions as MailOptions, SendmailSentMessageInfo as SentMessageInfo };
|
|
67
69
|
export default SendmailTransport;
|
|
@@ -21,6 +21,32 @@ export interface SESTransportOptions extends TransportOptions {
|
|
|
21
21
|
SendEmailCommand: new (input: any) => unknown;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
/** The SESv2Client shape the transport needs */
|
|
25
|
+
export type SESTransportClient = SESTransportOptions['SES']['sesClient'];
|
|
26
|
+
/** The SendEmailCommand constructor shape the transport needs */
|
|
27
|
+
export type SESTransportSendEmailCommand = SESTransportOptions['SES']['SendEmailCommand'];
|
|
28
|
+
/**
|
|
29
|
+
* SendEmailCommand parameters, the shape of the `ses` message option that is merged into
|
|
30
|
+
* the API call. Any further SendEmailCommandInput field is accepted as well
|
|
31
|
+
*/
|
|
32
|
+
export interface SESSendEmailRequest {
|
|
33
|
+
FromEmailAddress?: string | undefined;
|
|
34
|
+
Destination?: {
|
|
35
|
+
ToAddresses?: string[] | undefined;
|
|
36
|
+
CcAddresses?: string[] | undefined;
|
|
37
|
+
BccAddresses?: string[] | undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
ReplyToAddresses?: string[] | undefined;
|
|
40
|
+
Content?: unknown;
|
|
41
|
+
EmailTags?: Array<{
|
|
42
|
+
Name?: string | undefined;
|
|
43
|
+
Value?: string | undefined;
|
|
44
|
+
}> | undefined;
|
|
45
|
+
ConfigurationSetName?: string | undefined;
|
|
46
|
+
ListManagementOptions?: unknown;
|
|
47
|
+
FeedbackForwardingEmailAddress?: string | undefined;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
24
50
|
/**
|
|
25
51
|
* The value the SES transport hands to the send callback
|
|
26
52
|
*/
|
|
@@ -47,7 +73,7 @@ declare class SESTransport extends EventEmitter {
|
|
|
47
73
|
name: string;
|
|
48
74
|
version: string;
|
|
49
75
|
logger: Logger;
|
|
50
|
-
constructor(options
|
|
76
|
+
constructor(options: SESTransportOptions);
|
|
51
77
|
getRegion(cb: (err: Error | null, region?: string | false) => void): void;
|
|
52
78
|
/**
|
|
53
79
|
* Compiles a mailcomposer message and forwards it to SES
|
|
@@ -59,9 +85,14 @@ declare class SESTransport extends EventEmitter {
|
|
|
59
85
|
/**
|
|
60
86
|
* Verifies SES configuration
|
|
61
87
|
*
|
|
62
|
-
* @
|
|
88
|
+
* @returns Promise that resolves to true if the configuration is usable
|
|
63
89
|
*/
|
|
64
90
|
verify(): Promise<true>;
|
|
91
|
+
/**
|
|
92
|
+
* Verifies SES configuration
|
|
93
|
+
*
|
|
94
|
+
* @param callback Callback function
|
|
95
|
+
*/
|
|
65
96
|
verify(callback: VerifyCallback): void;
|
|
66
97
|
}
|
|
67
98
|
/**
|
|
@@ -71,5 +102,11 @@ declare namespace SESTransport {
|
|
|
71
102
|
type Options = SESTransportOptions;
|
|
72
103
|
type MailOptions = SendMailOptions;
|
|
73
104
|
type SentMessageInfo = SESSentMessageInfo;
|
|
105
|
+
type SESv2ClientLike = SESTransportClient;
|
|
106
|
+
type SendEmailCommandConstructorLike = SESTransportSendEmailCommand;
|
|
107
|
+
type SendEmailRequestLike = SESSendEmailRequest;
|
|
108
|
+
type MailSesOptions = SESSendEmailRequest;
|
|
74
109
|
}
|
|
110
|
+
/** The same aliases as module level exports, for `import * as SESTransport` and `import SESTransport = require()` */
|
|
111
|
+
export type { SESTransportOptions as Options, SendMailOptions as MailOptions, SESSentMessageInfo as SentMessageInfo, SESTransportClient as SESv2ClientLike, SESTransportSendEmailCommand as SendEmailCommandConstructorLike, SESSendEmailRequest as SendEmailRequestLike, SESSendEmailRequest as MailSesOptions };
|
|
75
112
|
export default SESTransport;
|
|
@@ -34,6 +34,8 @@ export interface ResolvedHostname {
|
|
|
34
34
|
/** The resolver error when a cached value was used because of it */
|
|
35
35
|
error?: Error | undefined;
|
|
36
36
|
}
|
|
37
|
+
/** The name @types/nodemailer used for ResolvedHostname */
|
|
38
|
+
export type ResolveHostnameValue = ResolvedHostname;
|
|
37
39
|
/**
|
|
38
40
|
* Resolved addresses as stored in the DNS cache
|
|
39
41
|
*/
|
|
@@ -83,6 +85,8 @@ export interface LogEntry {
|
|
|
83
85
|
[key: string]: any;
|
|
84
86
|
}
|
|
85
87
|
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
88
|
+
/** The name @types/nodemailer used for LogLevel */
|
|
89
|
+
export type LoggerLevel = LogLevel;
|
|
86
90
|
/**
|
|
87
91
|
* A logger supplied by the caller, bunyan style. Any object works, a level it does not
|
|
88
92
|
* implement is routed to one it does, see _logFunc
|
|
@@ -104,16 +108,24 @@ export interface GetLoggerOptions {
|
|
|
104
108
|
/** A bunyan compatible logger, true for the default console logger, false or unset for no logging */
|
|
105
109
|
logger?: ExternalLogger | boolean | undefined;
|
|
106
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* A bunyan style log method: a data object followed by a printf style message, or the
|
|
113
|
+
* message alone
|
|
114
|
+
*/
|
|
115
|
+
export interface LogMethod {
|
|
116
|
+
(data: LogEntry | undefined, message?: string, ...args: any[]): void;
|
|
117
|
+
(message?: string, ...args: any[]): void;
|
|
118
|
+
}
|
|
107
119
|
/**
|
|
108
120
|
* The bunyan compatible logger interface returned by getLogger
|
|
109
121
|
*/
|
|
110
122
|
export interface Logger {
|
|
111
|
-
trace
|
|
112
|
-
debug
|
|
113
|
-
info
|
|
114
|
-
warn
|
|
115
|
-
error
|
|
116
|
-
fatal
|
|
123
|
+
trace: LogMethod;
|
|
124
|
+
debug: LogMethod;
|
|
125
|
+
info: LogMethod;
|
|
126
|
+
warn: LogMethod;
|
|
127
|
+
error: LogMethod;
|
|
128
|
+
fatal: LogMethod;
|
|
117
129
|
}
|
|
118
130
|
/**
|
|
119
131
|
* A parsed data URI
|
|
@@ -175,6 +187,7 @@ export declare const parseConnectionUrl: (str?: string | null) => ConnectionUrlO
|
|
|
175
187
|
* creates a default console logger
|
|
176
188
|
*
|
|
177
189
|
* @param [options] Options object that might include 'logger' value
|
|
190
|
+
* @param [defaults] Fields merged into every log entry, overridden by the fields of the entry itself
|
|
178
191
|
* @return bunyan compatible logger
|
|
179
192
|
*/
|
|
180
193
|
export declare const getLogger: (options?: GetLoggerOptions, defaults?: LogEntry) => Logger;
|
|
@@ -198,18 +211,41 @@ export declare const parseDataURI: (uri: unknown) => ParsedDataURI | null;
|
|
|
198
211
|
*
|
|
199
212
|
* @param data An object or an Array you want to resolve an element for, see ContentDescriptor for the values it understands
|
|
200
213
|
* @param key Property name or an Array index
|
|
201
|
-
* @param [options] Optional access policy: { disableFileAccess, disableUrlAccess }
|
|
202
214
|
* @param callback Callback function with (err, value)
|
|
203
215
|
*/
|
|
204
216
|
export declare function resolveContent(data: {
|
|
205
217
|
[key: string]: any;
|
|
206
218
|
}, key: string | number, callback: ResolveContentCallback): void;
|
|
219
|
+
/**
|
|
220
|
+
* Resolves a String or a Buffer value for content value
|
|
221
|
+
*
|
|
222
|
+
* @param data An object or an Array you want to resolve an element for, see ContentDescriptor for the values it understands
|
|
223
|
+
* @param key Property name or an Array index
|
|
224
|
+
* @param options Access policy: { disableFileAccess, disableUrlAccess }
|
|
225
|
+
* @param callback Callback function with (err, value)
|
|
226
|
+
*/
|
|
207
227
|
export declare function resolveContent(data: {
|
|
208
228
|
[key: string]: any;
|
|
209
229
|
}, key: string | number, options: ResolveContentOptions | false | undefined, callback: ResolveContentCallback): void;
|
|
230
|
+
/**
|
|
231
|
+
* Resolves a String or a Buffer value for content value
|
|
232
|
+
*
|
|
233
|
+
* @param data An object or an Array you want to resolve an element for, see ContentDescriptor for the values it understands
|
|
234
|
+
* @param key Property name or an Array index
|
|
235
|
+
* @param [options] Optional access policy: { disableFileAccess, disableUrlAccess }
|
|
236
|
+
* @returns Promise that resolves with the value
|
|
237
|
+
*/
|
|
210
238
|
export declare function resolveContent(data: {
|
|
211
239
|
[key: string]: any;
|
|
212
240
|
}, key: string | number, options?: ResolveContentOptions | false): Promise<any>;
|
|
241
|
+
/**
|
|
242
|
+
* Resolves a String or a Buffer value for content value
|
|
243
|
+
*
|
|
244
|
+
* @param data An object or an Array you want to resolve an element for, see ContentDescriptor for the values it understands
|
|
245
|
+
* @param key Property name or an Array index
|
|
246
|
+
* @param options Access policy: { disableFileAccess, disableUrlAccess }
|
|
247
|
+
* @param callback Callback function with (err, value), a Promise is returned if not set
|
|
248
|
+
*/
|
|
213
249
|
export declare function resolveContent(data: {
|
|
214
250
|
[key: string]: any;
|
|
215
251
|
}, key: string | number, options: ResolveContentOptions | false | undefined, callback: ResolveContentCallback | undefined): Promise<any> | void;
|
|
@@ -362,6 +362,7 @@ exports._logFunc = _logFunc;
|
|
|
362
362
|
* creates a default console logger
|
|
363
363
|
*
|
|
364
364
|
* @param [options] Options object that might include 'logger' value
|
|
365
|
+
* @param [defaults] Fields merged into every log entry, overridden by the fields of the entry itself
|
|
365
366
|
* @return bunyan compatible logger
|
|
366
367
|
*/
|
|
367
368
|
const getLogger = (options, defaults) => {
|
|
@@ -377,8 +378,10 @@ const getLogger = (options, defaults) => {
|
|
|
377
378
|
}
|
|
378
379
|
const logger = options.logger === true ? createDefaultLogger(levels) : options.logger;
|
|
379
380
|
levels.forEach(level => {
|
|
380
|
-
response[level] = (
|
|
381
|
-
|
|
381
|
+
response[level] = (...args) => {
|
|
382
|
+
// the bunyan forms: a data object first, or the message alone
|
|
383
|
+
const data = typeof args[0] === 'string' ? undefined : args.shift();
|
|
384
|
+
(0, exports._logFunc)(logger, level, defaults, data, ...args);
|
|
382
385
|
};
|
|
383
386
|
});
|
|
384
387
|
return response;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Transform, type TransformOptions } from 'node:stream';
|
|
2
2
|
/**
|
|
3
3
|
* Escapes dots in the beginning of lines. Ends the stream with <CR><LF>.<CR><LF>
|
|
4
|
-
* Also makes sure that only <CR><LF> sequences are used for linebreaks
|
|
4
|
+
* Also makes sure that only <CR><LF> sequences are used for linebreaks, bare CR and bare LF
|
|
5
|
+
* are both turned into <CR><LF>
|
|
5
6
|
*
|
|
6
7
|
* @param options Stream options
|
|
7
8
|
*/
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const node_stream_1 = require("node:stream");
|
|
4
|
+
// bytes inserted into the output, shared as they are only ever copied by Buffer.concat
|
|
5
|
+
const INSERT_LF = Buffer.from('\n');
|
|
6
|
+
const INSERT_LF_DOT = Buffer.from('\n.');
|
|
7
|
+
const INSERT_CR = Buffer.from('\r');
|
|
8
|
+
const INSERT_DOT = Buffer.from('.');
|
|
4
9
|
/**
|
|
5
10
|
* Escapes dots in the beginning of lines. Ends the stream with <CR><LF>.<CR><LF>
|
|
6
|
-
* Also makes sure that only <CR><LF> sequences are used for linebreaks
|
|
11
|
+
* Also makes sure that only <CR><LF> sequences are used for linebreaks, bare CR and bare LF
|
|
12
|
+
* are both turned into <CR><LF>
|
|
7
13
|
*
|
|
8
14
|
* @param options Stream options
|
|
9
15
|
*/
|
|
@@ -32,33 +38,35 @@ class DataStream extends node_stream_1.Transform {
|
|
|
32
38
|
}
|
|
33
39
|
this.inByteCount += chunk.length;
|
|
34
40
|
for (i = 0, len = chunk.length; i < len; i++) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const byte = chunk[i];
|
|
42
|
+
const prev = i ? chunk[i - 1] : this.lastByte;
|
|
43
|
+
let insert = false;
|
|
44
|
+
if (prev === 0x0d && byte !== 0x0a) {
|
|
45
|
+
// a bare CR becomes CRLF. A receiver that treats a lone CR as a line end would
|
|
46
|
+
// otherwise see "\r.\r" as the end of the data (SMTP smuggling), so a dot
|
|
47
|
+
// following it is stuffed like at the start of any other line
|
|
48
|
+
insert = byte === 0x2e ? INSERT_LF_DOT : INSERT_LF;
|
|
49
|
+
}
|
|
50
|
+
else if (byte === 0x0a && prev !== 0x0d) {
|
|
51
|
+
// a bare LF becomes CRLF
|
|
52
|
+
insert = INSERT_CR;
|
|
44
53
|
}
|
|
45
|
-
else if (
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
chunklen += 2;
|
|
55
|
-
}
|
|
56
|
-
chunks.push(Buffer.from('\r\n'));
|
|
57
|
-
lastPos = i + 1;
|
|
54
|
+
else if (byte === 0x2e && (prev === 0x0a || prev === false)) {
|
|
55
|
+
// a dot at the start of a line
|
|
56
|
+
insert = INSERT_DOT;
|
|
57
|
+
}
|
|
58
|
+
if (insert) {
|
|
59
|
+
if (i > lastPos) {
|
|
60
|
+
buf = chunk.slice(lastPos, i);
|
|
61
|
+
chunks.push(buf);
|
|
62
|
+
chunklen += buf.length;
|
|
58
63
|
}
|
|
64
|
+
chunks.push(insert);
|
|
65
|
+
chunklen += insert.length;
|
|
66
|
+
lastPos = i;
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
|
-
if (
|
|
69
|
+
if (chunks.length) {
|
|
62
70
|
// add last piece
|
|
63
71
|
if (lastPos < chunk.length) {
|
|
64
72
|
buf = chunk.slice(lastPos);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Minimal HTTP/S proxy client
|
|
3
3
|
*/
|
|
4
4
|
import net from 'node:net';
|
|
5
|
-
import type {
|
|
5
|
+
import type { Callback } from '../errors.js';
|
|
6
6
|
/**
|
|
7
7
|
* TLS options for connecting to an HTTPS proxy
|
|
8
8
|
*/
|
|
@@ -13,7 +13,7 @@ export interface HttpProxyClientOptions {
|
|
|
13
13
|
/**
|
|
14
14
|
* Receives the proxied socket once the CONNECT handshake has succeeded, or the error that prevented it
|
|
15
15
|
*/
|
|
16
|
-
export type HttpProxyClientCallback =
|
|
16
|
+
export type HttpProxyClientCallback = Callback<net.Socket>;
|
|
17
17
|
/**
|
|
18
18
|
* Establishes proxied connection to destinationPort
|
|
19
19
|
*
|
|
@@ -21,13 +21,21 @@ export type HttpProxyClientCallback = (err: NodemailerError | null, socket?: net
|
|
|
21
21
|
* socket.write("GET / HTTP/1.0\r\n\r\n");
|
|
22
22
|
* });
|
|
23
23
|
*
|
|
24
|
-
* @param proxyUrl proxy configuration,
|
|
24
|
+
* @param proxyUrl proxy configuration, e.g. "http://proxy.host:3128/"
|
|
25
25
|
* @param destinationPort Port to open in destination host
|
|
26
26
|
* @param destinationHost Destination hostname
|
|
27
|
-
* @param
|
|
28
|
-
* @param callback Callback to run with the rocket object once connection is established
|
|
27
|
+
* @param callback Callback to run with the socket object once connection is established
|
|
29
28
|
*/
|
|
30
29
|
declare function httpProxyClient(proxyUrl: string, destinationPort: number | string, destinationHost: string, callback: HttpProxyClientCallback): void;
|
|
30
|
+
/**
|
|
31
|
+
* Establishes proxied connection to destinationPort through an HTTPS proxy
|
|
32
|
+
*
|
|
33
|
+
* @param proxyUrl proxy configuration, e.g. "https://proxy.host:3128/"
|
|
34
|
+
* @param destinationPort Port to open in destination host
|
|
35
|
+
* @param destinationHost Destination hostname
|
|
36
|
+
* @param tlsOptions TLS options for the proxy connection (e.g. { rejectUnauthorized: false })
|
|
37
|
+
* @param callback Callback to run with the socket object once connection is established
|
|
38
|
+
*/
|
|
31
39
|
declare function httpProxyClient(proxyUrl: string, destinationPort: number | string, destinationHost: string, tlsOptions: HttpProxyClientOptions | undefined, callback: HttpProxyClientCallback): void;
|
|
32
40
|
/**
|
|
33
41
|
* Socket timeout in milliseconds while the CONNECT handshake is in progress, defaults to 30 seconds.
|
|
@@ -52,6 +52,8 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
52
52
|
tlsOptions = {};
|
|
53
53
|
}
|
|
54
54
|
tlsOptions = tlsOptions || {};
|
|
55
|
+
// the error paths hand over the error alone
|
|
56
|
+
const done = callback;
|
|
55
57
|
// Reject CRLF in the destination before it reaches the CONNECT request line
|
|
56
58
|
// and Host header. A tainted host/port could otherwise inject additional
|
|
57
59
|
// request headers into the proxy connection (HTTP request splitting).
|
|
@@ -59,7 +61,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
59
61
|
if (!destinationPort || /[\r\n]/.test(destinationHost)) {
|
|
60
62
|
const err = new Error('Invalid proxy destination');
|
|
61
63
|
err.code = errors.EPROXY;
|
|
62
|
-
setImmediate(() =>
|
|
64
|
+
setImmediate(() => done(err));
|
|
63
65
|
return;
|
|
64
66
|
}
|
|
65
67
|
const proxy = urllib.parse(proxyUrl);
|
|
@@ -93,7 +95,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
93
95
|
catch (_E) {
|
|
94
96
|
// ignore
|
|
95
97
|
}
|
|
96
|
-
|
|
98
|
+
done(err);
|
|
97
99
|
};
|
|
98
100
|
const timeoutErr = () => {
|
|
99
101
|
const err = new Error('Proxy socket timed out');
|
|
@@ -124,18 +126,28 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
124
126
|
.join('\r\n') +
|
|
125
127
|
// End request
|
|
126
128
|
'\r\n\r\n');
|
|
127
|
-
|
|
129
|
+
// The response is collected as chunks and only the bytes that just arrived, together
|
|
130
|
+
// with the three before them, are searched for the end of the headers. Appending to a
|
|
131
|
+
// string and searching all of it again re-read the whole response on every chunk.
|
|
132
|
+
const chunks = [];
|
|
133
|
+
let received = 0;
|
|
134
|
+
let tail = '';
|
|
128
135
|
const onSocketData = (chunk) => {
|
|
129
136
|
let match;
|
|
130
|
-
let remainder;
|
|
131
137
|
if (finished) {
|
|
132
138
|
return;
|
|
133
139
|
}
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
const window = tail + chunk.toString('binary');
|
|
141
|
+
const windowEnd = window.indexOf('\r\n\r\n');
|
|
142
|
+
chunks.push(chunk);
|
|
143
|
+
received += chunk.length;
|
|
144
|
+
tail = window.slice(-3);
|
|
145
|
+
if (windowEnd >= 0) {
|
|
136
146
|
socket.removeListener('data', onSocketData);
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
const headerEnd = received - window.length + windowEnd;
|
|
148
|
+
const response = Buffer.concat(chunks, received).toString('binary');
|
|
149
|
+
const headers = response.substr(0, headerEnd);
|
|
150
|
+
const remainder = response.substr(headerEnd + 4);
|
|
139
151
|
if (remainder) {
|
|
140
152
|
socket.unshift(Buffer.from(remainder, 'binary'));
|
|
141
153
|
}
|
|
@@ -152,14 +164,14 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
152
164
|
}
|
|
153
165
|
const err = new Error('Invalid response from proxy' + ((match && ': ' + match[1]) || ''));
|
|
154
166
|
err.code = errors.EPROXY;
|
|
155
|
-
return
|
|
167
|
+
return done(err);
|
|
156
168
|
}
|
|
157
169
|
socket.removeListener('error', tempSocketErr);
|
|
158
170
|
socket.removeListener('timeout', timeoutErr);
|
|
159
171
|
socket.setTimeout(0);
|
|
160
|
-
return
|
|
172
|
+
return done(null, socket);
|
|
161
173
|
}
|
|
162
|
-
if (
|
|
174
|
+
if (received > MAX_RESPONSE_HEADER_BYTES) {
|
|
163
175
|
socket.removeListener('data', onSocketData);
|
|
164
176
|
const err = new Error('Proxy response headers too large');
|
|
165
177
|
err.code = errors.EPROXY;
|