aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/url.lua4
-rw-r--r--test/urltest.lua1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/url.lua b/src/url.lua
index 243ee1c..10a9d90 100644
--- a/src/url.lua
+++ b/src/url.lua
@@ -89,6 +89,10 @@ local function remove_dot_components(path)
89 until path == was 89 until path == was
90 repeat 90 repeat
91 local was = path 91 local was = path
92 path = path:gsub('//%.%./([^/]+)', '/%1', 1)
93 until path == was
94 repeat
95 local was = path
92 path = path:gsub('[^/]+/%.%./([^/]+)', '%1', 1) 96 path = path:gsub('[^/]+/%.%./([^/]+)', '%1', 1)
93 until path == was 97 until path == was
94 path = path:gsub('[^/]+/%.%./*$', '') 98 path = path:gsub('[^/]+/%.%./*$', '')
diff --git a/test/urltest.lua b/test/urltest.lua
index b6ee299..13deb10 100644
--- a/test/urltest.lua
+++ b/test/urltest.lua
@@ -691,6 +691,7 @@ check_absolute_url("http://example.com/a/b/c/d/", "../q", "http://example.com/a/
691check_absolute_url("http://example.com/a/b/c/d/", "../../q", "http://example.com/a/b/q") 691check_absolute_url("http://example.com/a/b/c/d/", "../../q", "http://example.com/a/b/q")
692check_absolute_url("http://example.com/a/b/c/d/", "../../../q", "http://example.com/a/q") 692check_absolute_url("http://example.com/a/b/c/d/", "../../../q", "http://example.com/a/q")
693check_absolute_url("http://example.com", ".badhost.com", "http://example.com/.badhost.com") 693check_absolute_url("http://example.com", ".badhost.com", "http://example.com/.badhost.com")
694check_absolute_url("http://example.com/a/b/c/d/", "..//../../../q", "http://example.com/a/q")
694 695
695print("testing path parsing and composition") 696print("testing path parsing and composition")
696check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 }) 697check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 })