dns: report out of memory properly
This addresses a part of a TODO by properly reporting an out of memory error to the user instead of reporting `ENOTFOUND`. PR-URL: https://github.com/nodejs/node/pull/20317 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
283a967e35
commit
a158d412b3
@ -29,7 +29,6 @@ const READABLE_OPERATOR = {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
errmap,
|
errmap,
|
||||||
UV_EAI_MEMORY,
|
|
||||||
UV_EAI_NODATA,
|
UV_EAI_NODATA,
|
||||||
UV_EAI_NONAME
|
UV_EAI_NONAME
|
||||||
} = process.binding('uv');
|
} = process.binding('uv');
|
||||||
@ -640,9 +639,7 @@ function dnsException(code, syscall, hostname) {
|
|||||||
if (typeof code === 'number') {
|
if (typeof code === 'number') {
|
||||||
// FIXME(bnoordhuis) Remove this backwards compatibility nonsense and pass
|
// FIXME(bnoordhuis) Remove this backwards compatibility nonsense and pass
|
||||||
// the true error to the user. ENOTFOUND is not even a proper POSIX error!
|
// the true error to the user. ENOTFOUND is not even a proper POSIX error!
|
||||||
if (code === UV_EAI_MEMORY ||
|
if (code === UV_EAI_NODATA || code === UV_EAI_NONAME) {
|
||||||
code === UV_EAI_NODATA ||
|
|
||||||
code === UV_EAI_NONAME) {
|
|
||||||
code = 'ENOTFOUND'; // Fabricated error name.
|
code = 'ENOTFOUND'; // Fabricated error name.
|
||||||
} else {
|
} else {
|
||||||
code = lazyInternalUtil().getSystemErrorName(code);
|
code = lazyInternalUtil().getSystemErrorName(code);
|
||||||
|
@ -29,7 +29,7 @@ const assert = require('assert');
|
|||||||
const http = require('http');
|
const http = require('http');
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
|
|
||||||
const host = '*'.repeat(256);
|
const host = '*'.repeat(64);
|
||||||
const MAX_TRIES = 5;
|
const MAX_TRIES = 5;
|
||||||
|
|
||||||
let errCode = 'ENOTFOUND';
|
let errCode = 'ENOTFOUND';
|
||||||
|
@ -25,7 +25,7 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
|
|
||||||
const host = '*'.repeat(256);
|
const host = '*'.repeat(64);
|
||||||
const errCode = common.isOpenBSD ? 'EAI_FAIL' : 'ENOTFOUND';
|
const errCode = common.isOpenBSD ? 'EAI_FAIL' : 'ENOTFOUND';
|
||||||
|
|
||||||
const socket = net.connect(42, host, common.mustNotCall());
|
const socket = net.connect(42, host, common.mustNotCall());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user