From e1e56aca37c62ba565dbeace60ca2fd7d7afbf02 Mon Sep 17 00:00:00 2001 From: Sergey Linev <S.Linev@gsi.de> Date: Fri, 15 Mar 2019 13:22:09 +0100 Subject: [PATCH] webui: let force usage of http for WebWindows With WebGui.ForceHttp: 1 rootrc parameter all web window will use real http server for communication. It can be important for some JavaScript libraries which does not support redirection with specialized protocol names. --- gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx | 2 +- gui/webdisplay/src/RWebWindowsManager.cxx | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx b/gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx index 69b0d7e665b..20d1a94ee36 100644 --- a/gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx +++ b/gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx @@ -84,7 +84,7 @@ protected: public: - /// Function should return URL for the widget dislpayed - local or http + /// Function should return URL for the widget displayed - local or http using CreateUrlFunc_t = std::function<std::string(bool)>; RWebDisplayHandle(const std::string &url) : fUrl(url) {} diff --git a/gui/webdisplay/src/RWebWindowsManager.cxx b/gui/webdisplay/src/RWebWindowsManager.cxx index 790c6ec708d..d5ae25a889a 100644 --- a/gui/webdisplay/src/RWebWindowsManager.cxx +++ b/gui/webdisplay/src/RWebWindowsManager.cxx @@ -378,6 +378,7 @@ std::string ROOT::Experimental::RWebWindowsManager::GetUrl(const ROOT::Experimen /// WebGui.LaunchTmout: time required to start process in seconds (default 30 s) /// WebGui.OperationTmout: time required to perform WebWindow operation like execute command or update drawings /// WebGui.RecordData: if specified enables data recording for each web window 0 - off, 1 - on +/// WebGui.ForceHttp: 0 - off (default), 1 - always create real http server to run web window /// /// Http-server related parameters documented in RWebWindowsManager::CreateServer() method @@ -417,7 +418,11 @@ unsigned ROOT::Experimental::RWebWindowsManager::ShowWindow(ROOT::Experimental:: if (args.GetWidth() <= 0) args.SetWidth(win.GetWidth()); if (args.GetHeight() <= 0) args.SetHeight(win.GetHeight()); - std::string url = GetUrl(win, batch_mode, !args.IsLocalDisplay()); + bool normal_http = !args.IsLocalDisplay(); + if (!normal_http && (gEnv->GetValue("WebGui.ForceHttp",0) == 1)) + normal_http = true; + + std::string url = GetUrl(win, batch_mode, normal_http); if (url.empty()) { R__ERROR_HERE("WebDisplay") << "Cannot create URL for the window"; return 0; @@ -431,7 +436,8 @@ unsigned ROOT::Experimental::RWebWindowsManager::ShowWindow(ROOT::Experimental:: args.SetUrl(url); - args.SetHttpServer(GetServer()); + if (!normal_http) + args.SetHttpServer(GetServer()); auto handle = RWebDisplayHandle::Display(args); -- GitLab