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>
This commit is contained in:
Joel Pedraza 2015-10-30 11:22:15 -04:00 committed by Joel Pedraza
parent 20851933bf
commit 5541065793

View file

@ -208,6 +208,7 @@ function splice(fd, size)
end
function redirect(url)
if url == "" then url = "/" end
status(302, "Found")
header("Location", url)
close()