[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-cd' - common/Unit.hpp wsd/LOOLWSD.cpp
Jan Holesovsky
kendy at collabora.com
Wed Sep 27 13:46:08 UTC 2017
common/Unit.hpp | 6 ++++++
wsd/LOOLWSD.cpp | 10 +++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
New commits:
commit acaa12c0a6b5dc789dc289b16ad117ed6c1d9102
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Aug 9 22:02:29 2017 +0200
wsd: Fix the OAuth unit test.
Trying to combine the Poco's http server together with our polling loop leads
only to problem; so instead let's introduce a hook where we can do the WOPI
serving directly in the unit test.
Change-Id: Id3fec6ff93c3ad652aa4e0fc6309c5b7639728cb
Reviewed-on: https://gerrit.libreoffice.org/42857
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/common/Unit.hpp b/common/Unit.hpp
index 5f8d20ea..335a3c81 100644
--- a/common/Unit.hpp
+++ b/common/Unit.hpp
@@ -102,6 +102,12 @@ public:
return false;
}
+ /// Custom response to a http request.
+ virtual bool handleHttpRequest(const Poco::Net::HTTPRequest& /*request*/, std::shared_ptr<StreamSocket>& /*socket*/)
+ {
+ return false;
+ }
+
/// If the test times out this gets invoked, the default just exits.
virtual void timeout();
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index ec9fe37c..9aa3f986 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1636,14 +1636,18 @@ private:
std::vector<std::string> reqPathSegs;
requestUri.getPathSegments(reqPathSegs);
- // File server
- if (reqPathSegs.size() >= 1 && reqPathSegs[0] == "loleaflet")
+ if (UnitWSD::get().handleHttpRequest(request, socket))
{
+ // Unit testing, nothing to do here
+ }
+ else if (reqPathSegs.size() >= 1 && reqPathSegs[0] == "loleaflet")
+ {
+ // File server
handleFileServerRequest(request, message);
}
- // Admin connections
else if (reqPathSegs.size() >= 2 && reqPathSegs[0] == "lool" && reqPathSegs[1] == "adminws")
{
+ // Admin connections
LOG_INF("Admin request: " << request.getURI());
if (AdminSocketHandler::handleInitialRequest(_socket, request))
{
More information about the Libreoffice-commits
mailing list