From a24294d331d32f161e98a16f4a79fd658d798752 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Wed, 22 Aug 2018 14:19:48 -0300 Subject: Revert "url.lua:absolute_path(): fix issue #254" --- test/urltest.lua | 44 +++++--------------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) (limited to 'test') diff --git a/test/urltest.lua b/test/urltest.lua index ae8ba75..1090a7e 100644 --- a/test/urltest.lua +++ b/test/urltest.lua @@ -61,7 +61,7 @@ end local check_absolute_url = function(base, relative, absolute) local res = socket.url.absolute(base, relative) if res ~= absolute then - io.write("absolute: In test for base='", base, "', rel='", relative, "' expected '", + io.write("absolute: In test for '", relative, "' expected '", absolute, "' but got '", res, "'\n") os.exit() end @@ -627,37 +627,25 @@ check_absolute_url("http://a/b/c/d;p?q#f", "/g", "http://a/g") check_absolute_url("http://a/b/c/d;p?q#f", "//g", "http://g") check_absolute_url("http://a/b/c/d;p?q#f", "?y", "http://a/b/c/d;p?y") check_absolute_url("http://a/b/c/d;p?q#f", "g?y", "http://a/b/c/g?y") -check_absolute_url("http://a/b/c/d;p?q#f", "g?y/./x", "http://a/b/c/g?y/x") +check_absolute_url("http://a/b/c/d;p?q#f", "g?y/./x", "http://a/b/c/g?y/./x") check_absolute_url("http://a/b/c/d;p?q#f", "#s", "http://a/b/c/d;p?q#s") check_absolute_url("http://a/b/c/d;p?q#f", "g#s", "http://a/b/c/g#s") -check_absolute_url("http://a/b/c/d;p?q#f", "g#s/./x", "http://a/b/c/g#s/x") +check_absolute_url("http://a/b/c/d;p?q#f", "g#s/./x", "http://a/b/c/g#s/./x") check_absolute_url("http://a/b/c/d;p?q#f", "g?y#s", "http://a/b/c/g?y#s") check_absolute_url("http://a/b/c/d;p?q#f", ";x", "http://a/b/c/d;x") check_absolute_url("http://a/b/c/d;p?q#f", "g;x", "http://a/b/c/g;x") check_absolute_url("http://a/b/c/d;p?q#f", "g;x?y#s", "http://a/b/c/g;x?y#s") check_absolute_url("http://a/b/c/d;p?q#f", ".", "http://a/b/c/") check_absolute_url("http://a/b/c/d;p?q#f", "./", "http://a/b/c/") -check_absolute_url("http://a/b/c/d;p?q#f", "./g", "http://a/b/c/g") -check_absolute_url("http://a/b/c/d;p?q#f", "./g/", "http://a/b/c/g/") -check_absolute_url("http://a/b/c/d;p?q#f", "././g", "http://a/b/c/g") -check_absolute_url("http://a/b/c/d;p?q#f", "././g/", "http://a/b/c/g/") -check_absolute_url("http://a/b/c/d;p?q#f", "g/.", "http://a/b/c/g/") -check_absolute_url("http://a/b/c/d;p?q#f", "g/./", "http://a/b/c/g/") -check_absolute_url("http://a/b/c/d;p?q#f", "g/./.", "http://a/b/c/g/") -check_absolute_url("http://a/b/c/d;p?q#f", "g/././", "http://a/b/c/g/") -check_absolute_url("http://a/b/c/d;p?q#f", "./.", "http://a/b/c/") -check_absolute_url("http://a/b/c/d;p?q#f", "././.", "http://a/b/c/") -check_absolute_url("http://a/b/c/d;p?q#f", "././g/./.", "http://a/b/c/g/") check_absolute_url("http://a/b/c/d;p?q#f", "..", "http://a/b/") check_absolute_url("http://a/b/c/d;p?q#f", "../", "http://a/b/") check_absolute_url("http://a/b/c/d;p?q#f", "../g", "http://a/b/g") check_absolute_url("http://a/b/c/d;p?q#f", "../..", "http://a/") check_absolute_url("http://a/b/c/d;p?q#f", "../../", "http://a/") check_absolute_url("http://a/b/c/d;p?q#f", "../../g", "http://a/g") -check_absolute_url("http://a/b/c/d;p?q#f", "../../../g", "http://a/g") check_absolute_url("http://a/b/c/d;p?q#f", "", "http://a/b/c/d;p?q#f") -check_absolute_url("http://a/b/c/d;p?q#f", "/./g", "http://a/g") -check_absolute_url("http://a/b/c/d;p?q#f", "/../g", "http://a/g") +check_absolute_url("http://a/b/c/d;p?q#f", "/./g", "http://a/./g") +check_absolute_url("http://a/b/c/d;p?q#f", "/../g", "http://a/../g") check_absolute_url("http://a/b/c/d;p?q#f", "g.", "http://a/b/c/g.") check_absolute_url("http://a/b/c/d;p?q#f", ".g", "http://a/b/c/.g") check_absolute_url("http://a/b/c/d;p?q#f", "g..", "http://a/b/c/g..") @@ -667,17 +655,6 @@ check_absolute_url("http://a/b/c/d;p?q#f", "./g/.", "http://a/b/c/g/") check_absolute_url("http://a/b/c/d;p?q#f", "g/./h", "http://a/b/c/g/h") check_absolute_url("http://a/b/c/d;p?q#f", "g/../h", "http://a/b/c/h") -check_absolute_url("http://a/b/c/d:p?q#f/", "../g/", "http://a/b/g/") -check_absolute_url("http://a/b/c/d:p?q#f/", "../g", "http://a/b/g") -check_absolute_url("http://a/b/c/d:p?q#f/", "../.g/", "http://a/b/.g/") -check_absolute_url("http://a/b/c/d:p?q#f/", "../.g", "http://a/b/.g") -check_absolute_url("http://a/b/c/d:p?q#f/", "../.g.h/", "http://a/b/.g.h/") -check_absolute_url("http://a/b/c/d:p?q#f/", "../.g.h", "http://a/b/.g.h") - -check_absolute_url("http://a/b/c/d:p?q#f/", "g.h/", "http://a/b/c/g.h/") -check_absolute_url("http://a/b/c/d:p?q#f/", "../g.h/", "http://a/b/g.h/") -check_absolute_url("http://a/", "../g.h/", "http://a/g.h/") - -- extra tests check_absolute_url("//a/b/c/d;p?q#f", "d/e/f", "//a/b/c/d/e/f") check_absolute_url("/a/b/c/d;p?q#f", "d/e/f", "/a/b/c/d/e/f") @@ -685,17 +662,6 @@ check_absolute_url("a/b/c/d", "d/e/f", "a/b/c/d/e/f") check_absolute_url("a/b/c/d/../", "d/e/f", "a/b/c/d/e/f") check_absolute_url("http://velox.telemar.com.br", "/dashboard/index.html", "http://velox.telemar.com.br/dashboard/index.html") -check_absolute_url("http://example.com/", "../.badhost.com/", "http://example.com/.badhost.com/") -check_absolute_url("http://example.com/", "...badhost.com/", "http://example.com/...badhost.com/") -check_absolute_url("http://example.com/a/b/c/d/", "../q", "http://example.com/a/b/c/q") -check_absolute_url("http://example.com/a/b/c/d/", "../../q", "http://example.com/a/b/q") -check_absolute_url("http://example.com/a/b/c/d/", "../../../q", "http://example.com/a/q") -check_absolute_url("http://example.com", ".badhost.com", "http://example.com/.badhost.com") -check_absolute_url("http://example.com/a/b/c/d/", "..//../../../q", "http://example.com/a/q") -check_absolute_url("http://example.com/a/b/c/d/", "..//a/../../../../q", "http://example.com/a/q") -check_absolute_url("http://example.com/a/b/c/d/", "..//a/..//../../../q", "http://example.com/a/b/q") -check_absolute_url("http://example.com/a/b/c/d/", "..//a/..///../../../../q", "http://example.com/a/b/q") -check_absolute_url("http://example.com/a/b/c/d/", "../x/a/../y/z/../../../../q", "http://example.com/a/b/q") print("testing path parsing and composition") check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 }) -- cgit v1.2.3-55-g6feb