loolwsd: read WOPI scheme, hostname from config values

This commit is contained in:
Henry Castro 2016-03-16 16:45:20 -04:00
parent 8a6cfdf961
commit ad980bee02

View file

@ -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<LOOLWSD&>(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<Poco::XML::Document> 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))
{