From: Adam Sutton Date: Tue, 5 Jan 2016 23:11:50 +0000 (+0000) Subject: webui: fix webroot handling broken trying to support out of scope URLs X-Git-Tag: v4.2.1~1209 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a12ec36830c0ee8d34cd66c39b93577c903ebd16;p=thirdparty%2Ftvheadend.git webui: fix webroot handling broken trying to support out of scope URLs --- diff --git a/src/webui/webui.c b/src/webui/webui.c index ebb39b1c1..fc7fbda88 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -139,6 +139,14 @@ page_root(http_connection_t *hc, const char *remain, void *opaque) static int page_root2(http_connection_t *hc, const char *remain, void *opaque) +{ + if (!tvheadend_webroot) return 1; + http_redirect(hc, "/", &hc->hc_req_args, 0); + return 0; +} + +static int +page_no_webroot(http_connection_t *hc, const char *remain, void *opaque) { size_t l; char *s; @@ -1818,9 +1826,10 @@ webui_init(int xspf) s = tvheadend_webroot; tvheadend_webroot = NULL; - http_path_add("", NULL, page_root2, ACCESS_WEB_INTERFACE); + http_path_add("", NULL, page_no_webroot, ACCESS_WEB_INTERFACE); tvheadend_webroot = s; + http_path_add("", NULL, page_root2, ACCESS_WEB_INTERFACE); http_path_add("/", NULL, page_root, ACCESS_WEB_INTERFACE); http_path_add("/login", NULL, page_login, ACCESS_WEB_INTERFACE); http_path_add("/logout", NULL, page_logout, ACCESS_WEB_INTERFACE);