summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNathan Gass2022-08-11 11:01:04 +0200
committerNathan Gass2022-08-11 11:01:04 +0200
commit9270b33cfd64662a7762621f9ea720c50575c632 (patch)
treeb734fe5d8e3d3f4109270aa5ba1f6ea87a17b3df /test
parent0f2c38eff161623fd5e3063e4beba2882f8dca2a (diff)
downloaditools-9270b33cfd64662a7762621f9ea720c50575c632.tar.gz
itools-9270b33cfd64662a7762621f9ea720c50575c632.tar.bz2
itools-9270b33cfd64662a7762621f9ea720c50575c632.zip
be conservative and block unknown ip formats
Diffstat (limited to 'test')
-rwxr-xr-xtest/it.t7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/it.t b/test/it.t
index 69b46b6..19f445f 100755
--- a/test/it.t
+++ b/test/it.t
@@ -349,6 +349,13 @@ is(it::is_private_ip('cname.gna.ch'), true, "is_private_ip cn
is(it::is_private_ip('pub4.gna.ch'), true, "is_private_ip pub4.gna.ch has public ipv4 but private ipv6");
is(it::is_private_ip('pub6.gna.ch'), true, "is_private_ip pub6.gna.ch has private ipv6 and public ipv6");
+# Stuff which is interpreted by curl
+is(it::is_private_ip('127.1'), true, "is_private_ip loopback ipv4 (zeroes omitted)");
+is(it::is_private_ip('127.0.0.01'), true, "is_private_ip loopback ipv4 (octal)");
+is(it::is_private_ip('127.0.0.0x1'), true, "is_private_ip loopback ipv4 (hexadecimal)");
+is(it::is_private_ip('127.01.0x1'), true, "is_private_ip private with omissions, octal and hexadecimal");
+is(it::is_private_ip('128.01.0x1'), false, "TODO: is_private_ip non-private with omissions, octal and hexadecimal");
+
# it::filter_keys tests
$data = ['a' => 1, 'b' => 2, 'c' => 3];