summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoel Pedraza <github@saik0.net>2015-10-30 11:22:15 -0400
committerJoel Pedraza <joel@joelpedraza.com>2015-11-03 09:53:39 -0500
commit5541065793913f8bf201123440e4a827ec779ebd (patch)
tree90384abae132c43033edb652b71a77f282658063
parent20851933bf31579be72cf593a22e00e33ee9105b (diff)
Redirect to root on empty path
* Prevents an empty Location header * Useful in environments where build_url() could return an empty string (such as http server rewrites requests to /cgi-bin/luci) Signed-off-by: Joel Pedraza <github@saik0.net>
-rw-r--r--modules/luci-base/luasrc/http.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/http.lua b/modules/luci-base/luasrc/http.lua
index a92d8affb..4b3573172 100644
--- a/modules/luci-base/luasrc/http.lua
+++ b/modules/luci-base/luasrc/http.lua
@@ -208,6 +208,7 @@ function splice(fd, size)
end
function redirect(url)
+ if url == "" then url = "/" end
status(302, "Found")
header("Location", url)
close()