[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Mar 14 03:09:32 UTC 2016
loolwsd/LOOLKit.cpp | 14 +++++++++++---
loolwsd/LOOLWSD.cpp | 12 +++++++++---
2 files changed, 20 insertions(+), 6 deletions(-)
New commits:
commit 8ef45a975e1ef950d4e754e43b82cda78f917847
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Mar 12 18:12:40 2016 -0500
loolwsd: child URI now includes docKey
Change-Id: I62b91fee98fd853c84c3c5cbb48e65e5c9788ef0
Reviewed-on: https://gerrit.libreoffice.org/23215
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 4fb6141..33aebe1 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -39,6 +39,7 @@
#include <Poco/Thread.h>
#include <Poco/ThreadLocal.h>
#include <Poco/Util/Application.h>
+#include <Poco/URI.h>
#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKitInit.h>
@@ -310,10 +311,12 @@ public:
Document(LibreOfficeKit *loKit,
const std::string& jailId,
+ const std::string& docKey,
const std::string& url)
: _multiView(std::getenv("LOK_VIEW_CALLBACK")),
_loKit(loKit),
_jailId(jailId),
+ _docKey(docKey),
_url(url),
_loKitDocument(nullptr),
_docPassword(""),
@@ -404,7 +407,7 @@ public:
HTTPClientSession cs("127.0.0.1", MASTER_PORT_NUMBER);
cs.setTimeout(0);
- HTTPRequest request(HTTPRequest::HTTP_GET, CHILD_URI + "sessionId=" + sessionId + "&jailId=" + _jailId);
+ HTTPRequest request(HTTPRequest::HTTP_GET, CHILD_URI + "sessionId=" + sessionId + "&jailId=" + _jailId + "&docKey=" + _docKey);
HTTPResponse response;
auto ws = std::make_shared<WebSocket>(cs, request, response);
@@ -734,6 +737,7 @@ private:
const bool _multiView;
LibreOfficeKit *_loKit;
const std::string _jailId;
+ const std::string _docKey;
const std::string _url;
std::string _jailedUrl;
@@ -1007,12 +1011,16 @@ void lokit_main(const std::string& childRoot,
{
const std::string& sessionId = tokens[1];
const unsigned intSessionId = Util::decodeId(sessionId);
- const std::string& url = tokens[2];
+ const std::string& docKey = tokens[2];
+ std::string url;
+ Poco::URI::decode(docKey, url);
Log::debug("Thread request for session [" + sessionId + "], url: [" + url + "].");
auto it = _documents.lower_bound(url);
if (it == _documents.end())
- it = _documents.emplace_hint(it, url, std::make_shared<Document>(loKit, jailId, url));
+ {
+ it = _documents.emplace_hint(it, url, std::make_shared<Document>(loKit, jailId, docKey, url));
+ }
it->second->createSession(sessionId, intSessionId);
isUsedKit = true;
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 1e833d9..b295bb6 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -506,7 +506,8 @@ private:
// Log::info("Cookie: " + cookies.get("PHPSESSID", ""));
const auto uri = DocumentStoreManager::getUri(request.getURI());
- const auto docKey = uri.getPath();
+ std::string docKey;
+ Poco::URI::encode(uri.getPath(), "", docKey);
// Request a kit process for this doc.
const std::string aMessage = "request " + id + " " + docKey + "\r\n";
@@ -609,6 +610,7 @@ public:
const auto params = Poco::URI(request.getURI()).getQueryParameters();
std::string sessionId;
std::string jailId;
+ std::string docKey;
for (const auto& param : params)
{
if (param.first == "sessionId")
@@ -619,16 +621,20 @@ public:
{
jailId = param.second;
}
+ else if (param.first == "docKey")
+ {
+ docKey = param.second;
+ }
}
- 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 + ".");
Log::debug("Thread [" + thread_name + "] started.");
+ Log::debug("Child socket for SessionId: " + sessionId + ", jailId: " + jailId +
+ ", docKey: " + docKey + " connected.");
auto ws = std::make_shared<WebSocket>(request, response);
auto session = std::make_shared<MasterProcessSession>(sessionId, LOOLSession::Kind::ToPrisoner, ws, nullptr);
More information about the Libreoffice-commits
mailing list