Skip to content

Commit 63c6b7e

Browse files
committed
Updated the socket.url Lua module.
1 parent 6f46b8b commit 63c6b7e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

includes/modules/socket.url.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ local function make_set(t)
4949
return s
5050
end
5151

52-
-- these are allowed withing a path segment, along with alphanum
52+
-- these are allowed within a path segment, along with alphanum
5353
-- other characters must be escaped
5454
local segment_set = make_set {
5555
"-", "_", ".", "!", "~", "*", "'", "(",
@@ -59,7 +59,7 @@ local segment_set = make_set {
5959
local function protect_segment(s)
6060
return string.gsub(s, "([^A-Za-z0-9_])", function (c)
6161
if segment_set[c] then return c
62-
else return string.format("%%%02x", string.byte(c)) end
62+
else return string.format("%%%02X", string.byte(c)) end
6363
end)
6464
end
6565

@@ -183,8 +183,9 @@ end
183183
-- a stringing with the corresponding URL
184184
-----------------------------------------------------------------------------
185185
function _M.build(parsed)
186-
local ppath = _M.parse_path(parsed.path or "")
187-
local url = _M.build_path(ppath)
186+
--local ppath = _M.parse_path(parsed.path or "")
187+
--local url = _M.build_path(ppath)
188+
local url = parsed.path or ""
188189
if parsed.params then url = url .. ";" .. parsed.params end
189190
if parsed.query then url = url .. "?" .. parsed.query end
190191
local authority = parsed.authority
@@ -193,7 +194,7 @@ function _M.build(parsed)
193194
if string.find(authority, ":") then -- IPv6?
194195
authority = "[" .. authority .. "]"
195196
end
196-
if parsed.port then authority = authority .. ":" .. parsed.port end
197+
if parsed.port then authority = authority .. ":" .. base.tostring(parsed.port) end
197198
local userinfo = parsed.userinfo
198199
if parsed.user then
199200
userinfo = parsed.user

0 commit comments

Comments
 (0)