Handle port as number in socket.url.build
In particular, luasec passes port as number to socket.url.build. Under Lua 5.3 this can lead to '.0' added to port when converting to string, use 'string.format("%d", port)' to avoid that.
This commit is contained in:
parent
30a64c585a
commit
270ec1b51a
1 changed files with 7 additions and 1 deletions
|
@ -193,7 +193,13 @@ function _M.build(parsed)
|
|||
if string.find(authority, ":") then -- IPv6?
|
||||
authority = "[" .. authority .. "]"
|
||||
end
|
||||
if parsed.port then authority = authority .. ":" .. parsed.port end
|
||||
local port = parsed.port
|
||||
if port then
|
||||
if type(port) == "number" then
|
||||
port = string.format("%d", port)
|
||||
end
|
||||
authority = authority .. ":" .. port
|
||||
end
|
||||
local userinfo = parsed.userinfo
|
||||
if parsed.user then
|
||||
userinfo = parsed.user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue