mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 04:28:20 +01:00
url.lua:remove_dot_components(): empty path component double-dot corner case
This commit is contained in:
parent
5b862e6a3c
commit
38d936ec0e
@ -87,6 +87,10 @@ local function remove_dot_components(path)
|
|||||||
local was = path
|
local was = path
|
||||||
path = path:gsub('/%./', '/', 1)
|
path = path:gsub('/%./', '/', 1)
|
||||||
until path == was
|
until path == was
|
||||||
|
repeat
|
||||||
|
local was = path
|
||||||
|
path = path:gsub('//%.%./([^/]+)', '/%1', 1)
|
||||||
|
until path == was
|
||||||
repeat
|
repeat
|
||||||
local was = path
|
local was = path
|
||||||
path = path:gsub('[^/]+/%.%./([^/]+)', '%1', 1)
|
path = path:gsub('[^/]+/%.%./([^/]+)', '%1', 1)
|
||||||
|
@ -691,6 +691,7 @@ check_absolute_url("http://example.com/a/b/c/d/", "../q", "http://example.com/a/
|
|||||||
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/b/q")
|
||||||
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/", "../../../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", ".badhost.com", "http://example.com/.badhost.com")
|
||||||
|
check_absolute_url("http://example.com/a/b/c/d/", "..//../../../q", "http://example.com/a/q")
|
||||||
|
|
||||||
print("testing path parsing and composition")
|
print("testing path parsing and composition")
|
||||||
check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 })
|
check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 })
|
||||||
|
Loading…
Reference in New Issue
Block a user