[Libreoffice-commits] online.git: loolwsd/Common.hpp loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Mar 14 03:05:56 UTC 2016
loolwsd/Common.hpp | 1 +
loolwsd/LOOLKit.cpp | 3 +--
loolwsd/LOOLWSD.cpp | 22 +++++++++++++++++-----
loolwsd/LOOLWSD.hpp | 1 -
4 files changed, 19 insertions(+), 8 deletions(-)
New commits:
commit 1268507bf0c9cbc37e9f9c567c2e7ea026119d2c
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Mar 12 08:46:36 2016 -0500
loolwsd: child WS URL format changed
The current format is more flexible and standard.
/loolwsd/child?sessionId=xxx&jailId=yyy
The sessionId is the client-specific connection ID (which
is originally passed to the child via the Broker.
The jailId is the PID of the child.
Change-Id: I69c88e84114f9678addf795896ca2da15ca1221b
Reviewed-on: https://gerrit.libreoffice.org/23211
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/Common.hpp b/loolwsd/Common.hpp
index 40251d3..d6b7b3f 100644
--- a/loolwsd/Common.hpp
+++ b/loolwsd/Common.hpp
@@ -35,6 +35,7 @@ constexpr int READ_BUFFER_SIZE = 2048;
constexpr int SMALL_MESSAGE_SIZE = READ_BUFFER_SIZE / 2;
static const std::string JailedDocumentRoot = "/user/docs/";
+static const std::string CHILD_URI = "/loolws/child?";
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 59f526d..5414a26 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -68,7 +68,6 @@ using Poco::Thread;
using Poco::ThreadLocal;
using Poco::Util::Application;
-const std::string CHILD_URI = "/loolws/child/";
const std::string FIFO_PATH = "pipe";
const std::string FIFO_BROKER = "loolbroker.fifo";
const std::string FIFO_NOTIFY = "loolnotify.fifo";
@@ -405,7 +404,7 @@ public:
HTTPClientSession cs("127.0.0.1", MASTER_PORT_NUMBER);
cs.setTimeout(0);
- HTTPRequest request(HTTPRequest::HTTP_GET, CHILD_URI + sessionId);
+ HTTPRequest request(HTTPRequest::HTTP_GET, CHILD_URI + "sessionId=" + sessionId + "&jailId=" + _jailId);
HTTPResponse response;
auto ws = std::make_shared<WebSocket>(cs, request, response);
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 2fcc86c..162dae7 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -617,16 +617,29 @@ public:
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) override
{
assert(request.serverAddress().port() == MASTER_PORT_NUMBER);
- assert(request.getURI().find(LOOLWSD::CHILD_URI) == 0);
+ assert(request.getURI().find(CHILD_URI) == 0);
std::string thread_name = "prison_ws_";
try
{
- const auto index = request.getURI().find_last_of('/');
- const auto id = request.getURI().substr(index + 1);
+ const auto params = Poco::URI(request.getURI()).getQueryParameters();
+ std::string sessionId;
+ std::string jailId;
+ for (const auto& param : params)
+ {
+ if (param.first == "sessionId")
+ {
+ sessionId = param.second;
+ }
+ else if (param.first == "jailId")
+ {
+ jailId = param.second;
+ }
+ }
- thread_name += id;
+ Log::debug("Child socket for SessionId: " + sessionId + ", jailId: " + jailId + " connected.");
+ thread_name += sessionId;
if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(thread_name.c_str()), 0, 0, 0) != 0)
Log::error("Cannot set thread name to " + thread_name + ".");
@@ -775,7 +788,6 @@ std::string LOOLWSD::LoSubPath = "lo";
int LOOLWSD::NumPreSpawnedChildren = 10;
bool LOOLWSD::DoTest = false;
-const std::string LOOLWSD::CHILD_URI = "/loolws/child/";
const std::string LOOLWSD::PIDLOG = "/tmp/loolwsd.pid";
const std::string LOOLWSD::FIFO_PATH = "pipe";
const std::string LOOLWSD::FIFO_LOOLWSD = "loolwsdfifo";
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index e7ce8eb..37c3561 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -45,7 +45,6 @@ public:
static std::string LoSubPath;
//static Auth AuthAgent;
- static const std::string CHILD_URI;
static const std::string PIDLOG;
static const std::string FIFO_PATH;
static const std::string FIFO_LOOLWSD;
More information about the Libreoffice-commits
mailing list