mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 12:28:21 +01:00
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
@ -193,7 +193,13 @@ function _M.build(parsed)
|
|||||||
if string.find(authority, ":") then -- IPv6?
|
if string.find(authority, ":") then -- IPv6?
|
||||||
authority = "[" .. authority .. "]"
|
authority = "[" .. authority .. "]"
|
||||||
end
|
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
|
local userinfo = parsed.userinfo
|
||||||
if parsed.user then
|
if parsed.user then
|
||||||
userinfo = parsed.user
|
userinfo = parsed.user
|
||||||
|
Loading…
Reference in New Issue
Block a user