[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp

Henry Castro hcastro at collabora.com
Wed Mar 16 23:57:54 UTC 2016


 loolwsd/LOOLWSD.cpp |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit 3f93cdc1d1e5ff8146e76ed2e277cdc0aa923850
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Mar 16 19:57:18 2016 -0400

    Revert "loolwsd: read WOPI scheme, hostname from config values"
    
    This reverts commit ad980bee0217cf4e49962e1e8baa876afd99033f.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 23db1d3..2c47456 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -629,21 +629,17 @@ private:
         }
     }
 
-    void handleGetDiscovery(HTTPServerResponse& response)
+    void handleGetDiscovery(HTTPServerRequest& request, HTTPServerResponse& response)
     {
         DOMParser parser;
         DOMWriter writer;
+        URI uri("http", request.getHost(), request.getURI());
 
-        LOOLWSD& appSrv = static_cast<LOOLWSD&>(Application::instance());
-        const std::string discoveryPath = Path(appSrv.commandPath()).parent().toString() + "discovery.xml";
+        const std::string discoveryPath = Path(Application::instance().commandPath()).parent().toString() + "discovery.xml";
         const std::string mediaType = "text/xml";
         const std::string action = "action";
         const std::string urlsrc = "urlsrc";
-        const std::string uriValue = appSrv.config().getString("loolwsd.wopi.scheme", "http") + "://" +
-                                     appSrv.config().getString("loolwsd.wopi.hostname", "localhost") +
-                                     // TODO. LOOLWSD does not serve loleaflet.html, so set default 80
-                                     //appSrv.config().getString("loolwsd.wopi.port", "9980") +
-                                     LOLEAFLET_PATH;
+        const std::string uriValue = "http://" + uri.getHost() + LOLEAFLET_PATH;
 
         InputSource inputSrc(discoveryPath);
         AutoPtr<Poco::XML::Document> docXML = parser.parse(&inputSrc);
@@ -683,7 +679,7 @@ public:
             if (request.getMethod() == HTTPRequest::HTTP_GET && request.getURI() == "/hosting/discovery")
             {
                 // http://server/hosting/discovery
-                handleGetDiscovery(response);
+                handleGetDiscovery(request, response);
             }
             else if (!(request.find("Upgrade") != request.end() && Poco::icompare(request["Upgrade"], "websocket") == 0))
             {


More information about the Libreoffice-commits mailing list