GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — dns: fix port validation · nodejs/node@9ceed7a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal
    • errors.js
  • test/parallel
    • test-dns.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/errors.js‎

Copy file name to clipboardExpand all lines: lib/internal/errors.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,7 @@ E('ERR_SOCKET_BAD_PORT', (name, port, allowZero = true) => {
15691569
assert(typeof allowZero === 'boolean',
15701570
"The 'allowZero' argument must be of type boolean.");
15711571
const operator = allowZero ? '>=' : '>';
1572-
return `${name} should be ${operator} 0 and < 65536. Received ${port}.`;
1572+
return `${name} should be ${operator} 0 and < 65536. Received ${determineSpecificType(port)}.`;
15731573
}, RangeError);
15741574
E('ERR_SOCKET_BAD_TYPE',
15751575
'Bad socket type specified. Valid types are: udp4, udp6', TypeError);
Collapse file

‎test/parallel/test-dns.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-dns.js
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,6 @@ dns.lookup('', {
310310
const portErr = (port) => {
311311
const err = {
312312
code: 'ERR_SOCKET_BAD_PORT',
313-
message:
314-
`Port should be >= 0 and < 65536. Received ${port}.`,
315313
name: 'RangeError'
316314
};
317315

@@ -323,10 +321,7 @@ const portErr = (port) => {
323321
dns.lookupService('0.0.0.0', port, common.mustNotCall());
324322
}, err);
325323
};
326-
portErr(null);
327-
portErr(undefined);
328-
portErr(65538);
329-
portErr('test');
324+
[null, undefined, 65538, 'test', NaN, Infinity, Symbol(), 0n, true, false, '', () => {}, {}].forEach(portErr);
330325

331326
assert.throws(() => {
332327
dns.lookupService('0.0.0.0', 80, null);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.