diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2020-04-23 13:39:33 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2020-04-23 13:41:56 +0100 |
commit | 931fd9241cc45f6650bdad1ae3234ae370faef2a (patch) | |
tree | 255626bed34989971d3cafc09af7e8eaf86fbc04 | |
parent | 5566eb8ac5d9349e4f12afbee24f54332831b3ca (diff) |
Proof: inject ProxyPrefix into discovery xml.feature/proxyhack
Change-Id: Ief79372d17e830c10883805e430a8b8cfb6d4f31
-rw-r--r-- | wsd/LOOLWSD.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 78bbf62d7..6e06b87d7 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -2465,8 +2465,17 @@ private: LOG_DBG("Wopi discovery request: " << request.getURI()); std::string xml = getFileContent("discovery.xml"); - const std::string hostname = (LOOLWSD::ServerName.empty() ? request.getHost() : LOOLWSD::ServerName); - Poco::replaceInPlace(xml, std::string("%SERVER_HOST%"), hostname); + std::string srvUrl = +#if ENABLE_SSL + ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? "https://" : "http://") +#else + "http://" +#endif + + (LOOLWSD::ServerName.empty() ? request.getHost() : LOOLWSD::ServerName) + + LOOLWSD::ServiceRoot; + if (request.has("ProxyPrefix")) + srvUrl += request["ProxyPrefix"]; + Poco::replaceInPlace(xml, std::string("%SRV_URI%"), srvUrl); // TODO: Refactor this to some common handler. std::ostringstream oss; @@ -3146,20 +3155,14 @@ private: discoveryPath = LOOLWSD::FileServerRoot + "/discovery.xml"; } - const std::string action = "action"; - const std::string urlsrc = "urlsrc"; const auto& config = Application::instance().config(); const std::string loleafletHtml = config.getString("loleaflet_html", "loleaflet.html"); - const std::string rootUriValue = -#if ENABLE_SSL - ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? "https://" : "http://") -#else - "http://" -#endif - + std::string("%SERVER_HOST%") - + LOOLWSD::ServiceRoot; - const std::string uriValue = rootUriValue - + "/loleaflet/" LOOLWSD_VERSION_HASH "/" + loleafletHtml + '?'; + + const std::string action = "action"; + const std::string urlsrc = "urlsrc"; + + const std::string rootUriValue = "%SRV_URI%"; + const std::string uriValue = rootUriValue + "/loleaflet/" LOOLWSD_VERSION_HASH "/" + loleafletHtml + '?'; InputSource inputSrc(discoveryPath); DOMParser parser; |