@@ -49,7 +49,7 @@ local function make_set(t)
4949 return s
5050end
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
5454local segment_set = make_set {
5555 " -" , " _" , " ." , " !" , " ~" , " *" , " '" , " (" ,
@@ -59,7 +59,7 @@ local segment_set = make_set {
5959local 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 )
6464end
6565
183183-- a stringing with the corresponding URL
184184---- -------------------------------------------------------------------------
185185function _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