diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-06-16 14:41:43 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-06-16 14:41:43 +0000 |
commit | 8c359115f9d515d358403897f34c69757adf7af6 (patch) | |
tree | c9300e8f653bfe4a8a92f76b1ed19c76d15b4655 | |
parent | b3a7ff9f8f0569e2c091f1738e7231be242a6dab (diff) |
libs/lucid-http: use SERVER_ADDR as fallback
-rw-r--r-- | libs/lucid-http/luasrc/lucid/http/handler/catchall.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libs/lucid-http/luasrc/lucid/http/handler/catchall.lua b/libs/lucid-http/luasrc/lucid/http/handler/catchall.lua index a5cdce534..13272d91e 100644 --- a/libs/lucid-http/luasrc/lucid/http/handler/catchall.lua +++ b/libs/lucid-http/luasrc/lucid/http/handler/catchall.lua @@ -39,7 +39,7 @@ end function Redirect.handle_GET(self, request) local target = self.target 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 local compare = ip.IPv4(request.env.REMOTE_ADDR) @@ -51,9 +51,8 @@ function Redirect.handle_GET(self, request) end end end - else - server = request.env.SERVER_ADDR end + if server:find(":") then server = "[" .. server .. "]" end @@ -85,4 +84,4 @@ Redirect.handle_POST = Redirect.handle_GET function Redirect.handle_HEAD(self, request) local stat, head = self:handle_GET(request) return stat, head -end
\ No newline at end of file +end |