libs/lucid-http: use SERVER_ADDR as fallback
This commit is contained in:
parent
b3a7ff9f8f
commit
8c359115f9
1 changed files with 3 additions and 4 deletions
|
@ -39,7 +39,7 @@ end
|
||||||
function Redirect.handle_GET(self, request)
|
function Redirect.handle_GET(self, request)
|
||||||
local target = self.target
|
local target = self.target
|
||||||
local protocol = request.env.HTTPS and "https://" or "http://"
|
local protocol = request.env.HTTPS and "https://" or "http://"
|
||||||
local server
|
local server = request.env.SERVER_ADDR
|
||||||
|
|
||||||
if request.env.REMOTE_ADDR and not request.env.REMOTE_ADDR:find(":") then
|
if request.env.REMOTE_ADDR and not request.env.REMOTE_ADDR:find(":") then
|
||||||
local compare = ip.IPv4(request.env.REMOTE_ADDR)
|
local compare = ip.IPv4(request.env.REMOTE_ADDR)
|
||||||
|
@ -51,9 +51,8 @@ function Redirect.handle_GET(self, request)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
server = request.env.SERVER_ADDR
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if server:find(":") then
|
if server:find(":") then
|
||||||
server = "[" .. server .. "]"
|
server = "[" .. server .. "]"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue