Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-08-21 19:33:07 +0300
committerNode.js GitHub Bot <github-bot@iojs.org>2020-08-31 18:09:47 +0300
commit37a8179673590af10b9e8e413388adffc21ba713 (patch)
treef5b8be4cbd0f12fcaa9804a715b5ed0498da457e /lib/internal/blocklist.js
parenta996df6b25e0c1dbe351480f71a51a6992214d25 (diff)
net: make blocklist family case insensitive
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/34864 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib/internal/blocklist.js')
-rw-r--r--lib/internal/blocklist.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/internal/blocklist.js b/lib/internal/blocklist.js
index 0ad58373b74..28a31caa165 100644
--- a/lib/internal/blocklist.js
+++ b/lib/internal/blocklist.js
@@ -55,6 +55,7 @@ class BlockList {
throw new ERR_INVALID_ARG_TYPE('address', 'string', address);
if (typeof family !== 'string')
throw new ERR_INVALID_ARG_TYPE('family', 'string', family);
+ family = family.toLowerCase();
if (family !== 'ipv4' && family !== 'ipv6')
throw new ERR_INVALID_ARG_VALUE('family', family);
const type = family === 'ipv4' ? AF_INET : AF_INET6;
@@ -68,6 +69,7 @@ class BlockList {
throw new ERR_INVALID_ARG_TYPE('end', 'string', end);
if (typeof family !== 'string')
throw new ERR_INVALID_ARG_TYPE('family', 'string', family);
+ family = family.toLowerCase();
if (family !== 'ipv4' && family !== 'ipv6')
throw new ERR_INVALID_ARG_VALUE('family', family);
const type = family === 'ipv4' ? AF_INET : AF_INET6;
@@ -83,6 +85,7 @@ class BlockList {
throw new ERR_INVALID_ARG_TYPE('prefix', 'number', prefix);
if (typeof family !== 'string')
throw new ERR_INVALID_ARG_TYPE('family', 'string', family);
+ family = family.toLowerCase();
let type;
switch (family) {
case 'ipv4':
@@ -106,6 +109,7 @@ class BlockList {
throw new ERR_INVALID_ARG_TYPE('address', 'string', address);
if (typeof family !== 'string')
throw new ERR_INVALID_ARG_TYPE('family', 'string', family);
+ family = family.toLowerCase();
if (family !== 'ipv4' && family !== 'ipv6')
throw new ERR_INVALID_ARG_VALUE('family', family);
const type = family === 'ipv4' ? AF_INET : AF_INET6;