1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00

restore cares workaround for windows

This commit is contained in:
Yoshiya Hinosawa 2024-11-14 19:14:22 +09:00
parent cc3d7b2ca8
commit ce620cecbb
No known key found for this signature in database
GPG key ID: 9017DB4559488785

View file

@ -36,6 +36,7 @@ import {
} from "ext:deno_node/internal_binding/async_wrap.ts";
import { ares_strerror } from "ext:deno_node/internal_binding/ares.ts";
import { notImplemented } from "ext:deno_node/_utils.ts";
import { isWindows } from "ext:deno_node/_util/os.ts";
interface LookupAddress {
address: string;
@ -67,7 +68,7 @@ export function getaddrinfo(
_hints: number,
verbatim: boolean,
): number {
const addresses: string[] = [];
let addresses: string[] = [];
// TODO(cmorten): use hints
// REF: https://nodejs.org/api/dns.html#dns_supported_getaddrinfo_flags
@ -106,6 +107,13 @@ export function getaddrinfo(
});
}
// TODO(@bartlomieju): Forces IPv4 as a workaround for Deno not
// aligning with Node on implicit binding on Windows
// REF: https://github.com/denoland/deno/issues/10762
if (isWindows && hostname === "localhost") {
addresses = addresses.filter((address) => isIPv4(address));
}
req.oncomplete(error, addresses);
})();