SHA256
1
0
nodejs20/c-ares-fixes.patch
Adam Majer e23d5ebf4b - update to 20.11.0:
* esm: add import.meta.dirname and import.meta.filename
  * fs: add c++ fast path for writeFileSync utf8
  * module: remove useCustomLoadersIfPresent flag
  * module: bootstrap module loaders in shadow realm
  * src: add --disable-warning option
  * src: create per isolate proxy env template
  * src: make process binding data weak
  * stream: use Array for Readable buffer
  * stream: optimize creation
  * test_runner: adds built in lcov reporter
  * test_runner: add Date to the supported mock APIs
  * test_runner, cli: add --test-timeout flag
- c-ares-fixes.patch: refreshed

OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs20?expand=0&rev=64
2024-02-12 14:47:36 +00:00

47 lines
2.0 KiB
Diff

Index: node-v20.11.0/test/parallel/test-dns-resolveany-bad-ancount.js
===================================================================
--- node-v20.11.0.orig/test/parallel/test-dns-resolveany-bad-ancount.js
+++ node-v20.11.0/test/parallel/test-dns-resolveany-bad-ancount.js
@@ -7,6 +7,8 @@ const dgram = require('dgram');
const dnsPromises = dns.promises;
const server = dgram.createSocket('udp4');
+const resolver = new dns.Resolver({ timeout: 100, tries: 1 });
+const resolverPromises = new dnsPromises.Resolver({ timeout: 100, tries: 1 });
server.on('message', common.mustCall((msg, { address, port }) => {
const parsed = dnstools.parseDNSPacket(msg);
@@ -18,16 +20,20 @@ server.on('message', common.mustCall((ms
questions: parsed.questions,
answers: { type: 'A', address: '1.2.3.4', ttl: 123, domain },
});
- // Overwrite the # of answers with 2, which is incorrect.
+ // Overwrite the # of answers with 2, which is incorrect. The response is
+ // discarded in c-ares >= 1.21.0. This is the reason why a small timeout is
+ // used in the `Resolver` constructor. See
+ // https://github.com/nodejs/node/pull/50743#issue-1994909204
buf.writeUInt16LE(2, 6);
server.send(buf, port, address);
}, 2));
server.bind(0, common.mustCall(async () => {
const address = server.address();
- dns.setServers([`127.0.0.1:${address.port}`]);
+ resolver.setServers([`127.0.0.1:${address.port}`]);
+ resolverPromises.setServers([`127.0.0.1:${address.port}`]);
- dnsPromises.resolveAny('example.org')
+ resolverPromises.resolveAny('example.org')
.then(common.mustNotCall())
.catch(common.expectsError({
// May return EBADRESP or ETIMEOUT
@@ -36,7 +42,7 @@ server.bind(0, common.mustCall(async ()
hostname: 'example.org'
}));
- dns.resolveAny('example.org', common.mustCall((err) => {
+ resolver.resolveAny('example.org', common.mustCall((err) => {
assert.notStrictEqual(err.code, 'SUCCESS');
assert.strictEqual(err.syscall, 'queryAny');
assert.strictEqual(err.hostname, 'example.org');