aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorE. Westbrook <github@westbrook.io>2018-08-21 12:42:26 -0600
committerE. Westbrook <github@westbrook.io>2018-08-21 12:43:30 -0600
commit043e99771352aff47680b99f09b66a32f0cc3ef5 (patch)
treecf5a837a349305ad10b54d1ce152e7cdc490edfc
parentca5398be098b571912dcbd93c83ab78151814f99 (diff)
downloadluasocket-043e99771352aff47680b99f09b66a32f0cc3ef5.tar.gz
luasocket-043e99771352aff47680b99f09b66a32f0cc3ef5.tar.bz2
luasocket-043e99771352aff47680b99f09b66a32f0cc3ef5.zip
url.lua:remove_dot_components(): avoid ambiguous numeric representation as empty-path-segment marker
-rw-r--r--src/url.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/url.lua b/src/url.lua
index 466d4fa..0a3a80a 100644
--- a/src/url.lua
+++ b/src/url.lua
@@ -83,9 +83,10 @@ end
83-- Returns 83-- Returns
84-- dot-normalized path 84-- dot-normalized path
85local function remove_dot_components(path) 85local function remove_dot_components(path)
86 local marker = string.char(1)
86 repeat 87 repeat
87 local was = path 88 local was = path
88 path = path:gsub('//', '/'..0x00..'/', 1) 89 path = path:gsub('//', '/'..marker..'/', 1)
89 until path == was 90 until path == was
90 repeat 91 repeat
91 local was = path 92 local was = path
@@ -99,7 +100,7 @@ local function remove_dot_components(path)
99 path = path:gsub('/%.%.$', '/') 100 path = path:gsub('/%.%.$', '/')
100 path = path:gsub('/%.$', '/') 101 path = path:gsub('/%.$', '/')
101 path = path:gsub('^/%.%./', '/') 102 path = path:gsub('^/%.%./', '/')
102 path = path:gsub(0x00, '') 103 path = path:gsub(marker, '')
103 return path 104 return path
104end 105end
105 106