[Libreoffice-commits] online.git: 3 commits - common/Unit.hpp wsd/ClientSession.cpp wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 12 11:09:20 UTC 2019
common/Unit.hpp | 5 ++++-
wsd/ClientSession.cpp | 5 +++--
wsd/DocumentBroker.cpp | 6 ++++--
wsd/LOOLWSD.cpp | 6 ++++++
wsd/LOOLWSD.hpp | 2 ++
5 files changed, 19 insertions(+), 5 deletions(-)
New commits:
commit a15868642221569a7252e04c5a6d1a9a2294048e
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Aug 12 12:04:10 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Aug 12 13:20:52 2019 +0300
The SavedClipboards stuff presumably makes no sense for MOBILEAPP
It seems to be strongly related to HTTP things at least in error
handling. So bypass as cleanly as possible in the MOBILEAPP case for
now.
Change-Id: If9540f166293635513a3ab06371f01ad381a8cb2
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index a382afbd9..6205909ad 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -1216,6 +1216,8 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
} else if (tokens[0] == "clipboardcontent:") {
+#if !MOBILEAPP // Most likely nothing of this makes sense in a mobile app
+
// FIXME: Ash: we need to return different content depending
// on whether this is a download-everything, or an individual
// 'download' and/or providing our helpful / user page.
@@ -1252,15 +1254,14 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
if (!empty)
{
oss.write(&payload->data()[header], payload->size() - header);
-#if !MOBILEAPP
socket->setSocketBufferSize(std::min(payload->size() + 256,
size_t(Socket::MaximumSendBufferSize)));
-#endif
}
socket->send(oss.str());
socket->shutdown();
LOG_INF("Queued " << (empty?"empty":"clipboard") << " response for send.");
}
+#endif
_clipSockets.clear();
return true;
} else if (tokens[0] == "disconnected:") {
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index deb9104b8..06a423219 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1572,6 +1572,7 @@ bool DocumentBroker::lookupSendClipboardTag(const std::shared_ptr<StreamSocket>
const std::string &tag, bool sendError)
{
LOG_TRC("Clipboard request " << tag << " not for a live session - check cache.");
+#if !MOBILEAPP
std::shared_ptr<std::string> saved =
LOOLWSD::SavedClipboards->getClipboard(tag);
if (saved)
@@ -1585,19 +1586,19 @@ bool DocumentBroker::lookupSendClipboardTag(const std::shared_ptr<StreamSocket>
<< "X-Content-Type-Options: nosniff\r\n"
<< "\r\n";
oss.write(saved->c_str(), saved->length());
-#if !MOBILEAPP
socket->setSocketBufferSize(std::min(saved->length() + 256,
size_t(Socket::MaximumSendBufferSize)));
-#endif
socket->send(oss.str());
socket->shutdown();
LOG_INF("Found and queued clipboard response for send of size " << saved->length());
return true;
}
+#endif
if (!sendError)
return false;
+#if !MOBILEAPP
// Bad request.
std::ostringstream oss;
oss << "HTTP/1.1 400\r\n"
@@ -1607,6 +1608,7 @@ bool DocumentBroker::lookupSendClipboardTag(const std::shared_ptr<StreamSocket>
<< "\r\n"
<< "Failed to find this clipboard";
socket->send(oss.str());
+#endif
socket->shutdown();
return false;
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index a37bef056..207fa66fa 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -722,7 +722,9 @@ static std::string UnitTestLibrary;
unsigned int LOOLWSD::NumPreSpawnedChildren = 0;
std::unique_ptr<TraceFileWriter> LOOLWSD::TraceDumper;
+#if !MOBILEAPP
std::unique_ptr<ClipboardCache> LOOLWSD::SavedClipboards;
+#endif
/// This thread polls basic web serving, and handling of
/// websockets before upgrade: when upgraded they go to the
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index 0af2caa28..4a9796a3a 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -70,7 +70,9 @@ public:
static bool AnonymizeUsernames;
static std::atomic<unsigned> NumConnections;
static std::unique_ptr<TraceFileWriter> TraceDumper;
+#if !MOBILEAPP
static std::unique_ptr<ClipboardCache> SavedClipboards;
+#endif
static std::set<std::string> EditFileExtensions;
static unsigned MaxConnections;
static unsigned MaxDocuments;
commit 98dab7d74f3f675f5f49b3223021b85a16672ce2
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Aug 12 11:31:02 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Aug 12 13:20:52 2019 +0300
Avoid assertion failure in the iOS app
There is just one process, and the UnitBase::Global is dummy, its type
is irrelevant.
Change-Id: I73fd0c32e50dd698161f25dbc3f4c8655776286a
diff --git a/common/Unit.hpp b/common/Unit.hpp
index 19996d555..57d7916bf 100644
--- a/common/Unit.hpp
+++ b/common/Unit.hpp
@@ -264,7 +264,10 @@ public:
virtual ~UnitKit();
static UnitKit& get()
{
- assert(Global && Global->_type == UnitType::Kit);
+ assert(Global);
+#if !MOBILEAPP
+ assert(Global->_type == UnitType::Kit);
+#endif
return *static_cast<UnitKit *>(Global);
}
commit 5d0c858770282ee85fe0ac12cedc93098f671aa1
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Aug 12 11:29:30 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Aug 12 13:20:52 2019 +0300
Avoid unexpected exception in the iOS app
There is no "host" or "server name" in the MOBILEAPP case. The
getHost() call throws an exception.
Change-Id: If950f83b2f0b9fa7ee91bf2e2194e637414bff06
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index e053c4107..a37bef056 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2795,8 +2795,12 @@ private:
std::shared_ptr<DocumentBroker> docBroker = findOrCreateDocBroker(ws, url, docKey, _id, uriPublic);
if (docBroker)
{
+#if MOBILEAPP
+ const std::string hostNoTrust;
+#else
// We can send this back to whomever sent it to us though.
const std::string hostNoTrust = (LOOLWSD::ServerName.empty() ? request.getHost() : LOOLWSD::ServerName);
+#endif
std::shared_ptr<ClientSession> clientSession = createNewClientSession(&ws, _id, uriPublic,
docBroker, isReadOnly, hostNoTrust);
More information about the Libreoffice-commits
mailing list