From: Joel Pedraza Date: Fri, 30 Oct 2015 15:22:15 +0000 (-0400) Subject: Redirect to root on empty path X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=5541065793913f8bf201123440e4a827ec779ebd;ds=sidebyside 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 --- 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()