[Libreoffice-commits] online.git: wsd/LOOLWSD.cpp
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 24 18:58:38 UTC 2020
wsd/LOOLWSD.cpp | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
New commits:
commit 840fb7c4bd0c6d4cd4c2937f8830a60e29c92aef
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Apr 23 13:39:33 2020 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Apr 24 20:58:20 2020 +0200
Proof: inject ProxyPrefix into discovery xml.
Change-Id: Ief79372d17e830c10883805e430a8b8cfb6d4f31
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92821
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 856eaa345..c34c2c315 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2485,8 +2485,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;
@@ -3169,20 +3178,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;
More information about the Libreoffice-commits
mailing list