From f36ed612c62756039f76bad2d89c487c2adc709b Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Mon, 22 Aug 2022 13:09:47 +0200 Subject: [PATCH] chore: revert IPv4 DNS resolution workaround for Firefox from PR 8447 --- src/node/NodeWebSocketTransport.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/node/NodeWebSocketTransport.ts b/src/node/NodeWebSocketTransport.ts index 0a55419357c9e..fbe8e7c92c0c0 100644 --- a/src/node/NodeWebSocketTransport.ts +++ b/src/node/NodeWebSocketTransport.ts @@ -16,27 +16,12 @@ import NodeWebSocket from 'ws'; import {ConnectionTransport} from '../common/ConnectionTransport.js'; import {packageVersion} from '../generated/version.js'; -import {promises as dns} from 'dns'; -import {URL} from 'url'; /** * @internal */ export class NodeWebSocketTransport implements ConnectionTransport { - static async create(urlString: string): Promise { - // TODO(jrandolf): Starting in Node 17, IPv6 is favoured over IPv4 due to a change - // in a default option: - // - https://github.com/nodejs/node/issues/40537, - // Due to this, for Firefox, we must parse and resolve the `localhost` hostname - // manually with the previous behavior according to: - // - https://nodejs.org/api/dns.html#dnslookuphostname-options-callback - // because of https://bugzilla.mozilla.org/show_bug.cgi?id=1769994. - const url = new URL(urlString); - if (url.hostname === 'localhost') { - const {address} = await dns.lookup(url.hostname, {verbatim: false}); - url.hostname = address; - } - + static create(url: string): Promise { return new Promise((resolve, reject) => { const ws = new NodeWebSocket(url, [], { followRedirects: true,