From 31ef21901866b7b76755436646ab0ed2857815a1 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 2 Jul 2015 11:35:51 +0100 Subject: Add workarounds for numeric hosts in URLs. --- test/lua/unit/url.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/lua/unit/url.lua b/test/lua/unit/url.lua index 4362a3999..9836ed127 100644 --- a/test/lua/unit/url.lua +++ b/test/lua/unit/url.lua @@ -65,7 +65,22 @@ context("URL check functions", function() }}, {"http://%25DOMAIN:foobar@foodomain.com/", true, { host = 'foodomain.com', user = '%25DOMAIN' - }} + }}, + {"http://0.0xFFFFFF", true, { + host = '0.255.255.255' + }}, + {"http://030052000001", true, { + host = '192.168.0.1' + }}, + {"http://0xc0.052000001", true, { + host = '192.168.0.1' + }}, + {"http://192.168.0.1.", true, { + host = '192.168.0.1' + }}, + {"http://[::eeee:192.168.0.1]", true, { + host = '::eeee:c0a8:1' + }}, } for _,c in ipairs(cases) do @@ -78,7 +93,7 @@ context("URL check functions", function() for k,v in pairs(c[3]) do assert_not_nil(uf[k], k .. ' is missing in url, must be ' .. v) - assert_equal(uf[k], v, 'expected ' .. v .. ' for ' .. k .. ' but got ' .. uf[k]) + assert_equal(uf[k], v, 'expected ' .. v .. ' for ' .. k .. ' but got ' .. uf[k] .. ' in url ' .. c[1]) end for k,v in pairs(uf) do if k ~= 'url' and k ~= 'protocol' and k ~= 'tld' then -- cgit v1.2.3