attempt to fix mail sending
This commit is contained in:
Vendored
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"chat.tools.terminal.autoApprove": {
|
"chat.tools.terminal.autoApprove": {
|
||||||
"setopt": true,
|
"setopt": true,
|
||||||
"npx shopify": true
|
"npx shopify": true,
|
||||||
|
"npx tsx": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,11 +170,42 @@ export async function safeFetch(rawUrl: string, opts: SafeFetchOptions = {}): Pr
|
|||||||
// Pin the resolved IP. We pass an Agent with a custom `lookup` that always
|
// Pin the resolved IP. We pass an Agent with a custom `lookup` that always
|
||||||
// returns our pre-validated address, so the actual TCP connect can't be
|
// returns our pre-validated address, so the actual TCP connect can't be
|
||||||
// re-resolved to something else (DNS-rebinding defense).
|
// re-resolved to something else (DNS-rebinding defense).
|
||||||
|
//
|
||||||
|
// Note: Node 20+ enables Happy Eyeballs (`autoSelectFamily: true`) by
|
||||||
|
// default on the http/https agents. Happy Eyeballs calls `lookup` with
|
||||||
|
// `{ all: true }` and expects the callback to receive an *array* of
|
||||||
|
// `{ address, family }` records. If we ignore that and always invoke the
|
||||||
|
// 3-arg form, the connector hands `undefined` to `socket.connect()`,
|
||||||
|
// which then throws `Invalid IP address: undefined`.
|
||||||
|
type LookupCb =
|
||||||
|
| ((err: NodeJS.ErrnoException | null, address: string, family: number) => void)
|
||||||
|
| ((err: NodeJS.ErrnoException | null, addresses: { address: string; family: number }[]) => void);
|
||||||
const pinnedLookup = (
|
const pinnedLookup = (
|
||||||
_hostname: string,
|
_hostname: string,
|
||||||
_options: unknown,
|
optionsOrCb: { all?: boolean; family?: number } | LookupCb,
|
||||||
cb: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
maybeCb?: LookupCb,
|
||||||
) => cb(null, address, family);
|
) => {
|
||||||
|
let options: { all?: boolean; family?: number } = {};
|
||||||
|
let cb: LookupCb;
|
||||||
|
if (typeof optionsOrCb === "function") {
|
||||||
|
cb = optionsOrCb;
|
||||||
|
} else {
|
||||||
|
options = optionsOrCb ?? {};
|
||||||
|
cb = maybeCb as LookupCb;
|
||||||
|
}
|
||||||
|
if (options.all) {
|
||||||
|
(cb as (err: NodeJS.ErrnoException | null, addresses: { address: string; family: number }[]) => void)(
|
||||||
|
null,
|
||||||
|
[{ address, family }],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
(cb as (err: NodeJS.ErrnoException | null, address: string, family: number) => void)(
|
||||||
|
null,
|
||||||
|
address,
|
||||||
|
family,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const isHttps = url.protocol === "https:";
|
const isHttps = url.protocol === "https:";
|
||||||
const agent = isHttps
|
const agent = isHttps
|
||||||
|
|||||||
Reference in New Issue
Block a user