diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 2c474562c..23db1d382 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -629,17 +629,21 @@ private: } } - void handleGetDiscovery(HTTPServerRequest& request, HTTPServerResponse& response) + void handleGetDiscovery(HTTPServerResponse& response) { DOMParser parser; DOMWriter writer; - URI uri("http", request.getHost(), request.getURI()); - const std::string discoveryPath = Path(Application::instance().commandPath()).parent().toString() + "discovery.xml"; + LOOLWSD& appSrv = static_cast(Application::instance()); + const std::string discoveryPath = Path(appSrv.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 = "http://" + uri.getHost() + LOLEAFLET_PATH; + 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; InputSource inputSrc(discoveryPath); AutoPtr docXML = parser.parse(&inputSrc); @@ -679,7 +683,7 @@ public: if (request.getMethod() == HTTPRequest::HTTP_GET && request.getURI() == "/hosting/discovery") { // http://server/hosting/discovery - handleGetDiscovery(request, response); + handleGetDiscovery(response); } else if (!(request.find("Upgrade") != request.end() && Poco::icompare(request["Upgrade"], "websocket") == 0)) {