diff options
author | rickyes <mail@zhoumq.cn> | 2020-04-15 08:23:26 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-04-28 20:15:03 +0300 |
commit | 1d0b24924f0953d022167df90c018a75139c71a4 (patch) | |
tree | efff45fed4f617f22e9e9ddefe5c52a7b1d89230 /lib/internal/validators.js | |
parent | aa9708e479787bdffc9e837a6599f10581014891 (diff) |
lib: fix validateport error message when allowZero is false
PR-URL: https://github.com/nodejs/node/pull/32861
Fixes: https://github.com/nodejs/node/issues/32857
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/internal/validators.js')
-rw-r--r-- | lib/internal/validators.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/internal/validators.js b/lib/internal/validators.js index 790c923386f..deab53d4b82 100644 --- a/lib/internal/validators.js +++ b/lib/internal/validators.js @@ -190,7 +190,7 @@ function validatePort(port, name = 'Port', { allowZero = true } = {}) { +port !== (+port >>> 0) || port > 0xFFFF || (port === 0 && !allowZero)) { - throw new ERR_SOCKET_BAD_PORT(name, port); + throw new ERR_SOCKET_BAD_PORT(name, port, allowZero); } return port | 0; } |