[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp loolwsd/test loolwsd/UserMessages.hpp
loolwsd/LOOLWSD.cpp | 15 +++ loolwsd/UserMessages.hpp |2 -- loolwsd/test/httpwserror.cpp |2 -- 3 files changed, 7 insertions(+), 12 deletions(-) New commits: commit e7009c12e10a472741e0a93b32cf51bff842dd27 Author: Henry CastroDate: Mon Oct 10 22:28:56 2016 -0400 loolwsd: websocket shutdown cleanup diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 7d181fb..bb1a9c6 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -180,7 +180,6 @@ static inline void lcl_shutdownLimitReached(WebSocket& ws) { const std::string error = Poco::format(PAYLOAD_UNAVALABLE_LIMIT_REACHED, MAX_DOCUMENTS, MAX_CONNECTIONS); -const std::string close = Poco::format(SERVICE_UNAVALABLE_LIMIT_REACHED, static_cast(WebSocket::WS_POLICY_VIOLATION)); /* loleaflet sends loolclient, load and partrectangles message immediately after web socket handshake, so closing web socket fails loading page in @@ -202,7 +201,7 @@ void lcl_shutdownLimitReached(WebSocket& ws) if (--retries == 4) { ws.sendFrame(error.data(), error.size()); -ws.shutdown(WebSocket::WS_POLICY_VIOLATION, close); +ws.shutdown(WebSocket::WS_POLICY_VIOLATION, ""); } } while (retries > 0 && (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE); @@ -210,7 +209,7 @@ void lcl_shutdownLimitReached(WebSocket& ws) catch (Exception&) { ws.sendFrame(error.data(), error.size()); -ws.shutdown(WebSocket::WS_POLICY_VIOLATION, close); +ws.shutdown(WebSocket::WS_POLICY_VIOLATION, ""); } } @@ -835,8 +834,8 @@ private: // something wrong, with internal exceptions Log::trace("Abnormal close handshake."); session->closeFrame(); -ws->shutdown(WebSocket::WS_ENDPOINT_GOING_AWAY, SERVICE_UNAVALABLE_INTERNAL_ERROR); -session->shutdownPeer(WebSocket::WS_ENDPOINT_GOING_AWAY, SERVICE_UNAVALABLE_INTERNAL_ERROR); +ws->shutdown(WebSocket::WS_ENDPOINT_GOING_AWAY, ""); +session->shutdownPeer(WebSocket::WS_ENDPOINT_GOING_AWAY, ""); } } @@ -985,7 +984,7 @@ public: const std::string msg = std::string("error: ") + exc.what(); ws->sendFrame(msg.data(), msg.size()); // abnormal close frame handshake -ws->shutdown(WebSocket::WS_ENDPOINT_GOING_AWAY, msg); +ws->shutdown(WebSocket::WS_ENDPOINT_GOING_AWAY, ""); } catch (const std::exception& exc2) { @@ -1199,8 +1198,8 @@ public: // something wrong, with internal exceptions Log::trace("Abnormal close handshake."); session->closeFrame(); -ws->shutdown(WebSocket::WS_ENDPOINT_GOING_AWAY, SERVICE_UNAVALABLE_INTERNAL_ERROR); -session->shutdownPeer(WebSocket::WS_ENDPOINT_GOING_AWAY, SERVICE_UNAVALABLE_INTERNAL_ERROR); +ws->shutdown(WebSocket::WS_ENDPOINT_GOING_AWAY, ""); +session->shutdownPeer(WebSocket::WS_ENDPOINT_GOING_AWAY, ""); } } catch (const Exception& exc) diff --git a/loolwsd/UserMessages.hpp b/loolwsd/UserMessages.hpp index 36e6ad3..7883fc0 100644 --- a/loolwsd/UserMessages.hpp +++ b/loolwsd/UserMessages.hpp @@ -13,9 +13,7 @@ #define INCLUDED_USERMESSAGES_HPP //NOTE: For whatever reason Poco seems to trim the first character. - constexpr auto SERVICE_UNAVALABLE_INTERNAL_ERROR = " Service is unavailable. Please try again later and report to your administrator if the issue persists."; -constexpr auto SERVICE_UNAVALABLE_LIMIT_REACHED = "error: cmd=socket kind=close code=%d"; constexpr auto PAYLOAD_UNAVALABLE_LIMIT_REACHED = "error: cmd=socket kind=limitreached params=%d,%d"; #endif diff --git a/loolwsd/test/httpwserror.cpp b/loolwsd/test/httpwserror.cpp index 8e7769d..509046c 100644 --- a/loolwsd/test/httpwserror.cpp +++ b/loolwsd/test/httpwserror.cpp @@ -103,7 +103,6 @@ void HTTPWSError::testMaxDocuments() sendTextFrame(socket, "partpagerectangles "); statusCode = getErrorCode(socket, message); CPPUNIT_ASSERT_EQUAL(static_cast(Poco::Net::WebSocket::WS_POLICY_VIOLATION), statusCode); -CPPUNIT_ASSERT_MESSAGE("Wrong error message ", message.find("error: cmd=socket kind=close") != std::string::npos); } catch (const Poco::Exception& exc) { @@ -144,7 +143,6 @@ void HTTPWSError::testMaxConnections() sendTextFrame(socketN, "partpagerectangles "); statusCode = getErrorCode(*socketN, message); CPPUNIT_ASSERT_EQUAL(static_cast(Poco::Net::WebSocket::WS_POLICY_VIOLATION), statusCode); -CPPUNIT_ASSERT_MESSAGE("Wrong error message ", message.find("error: cmd=socket kind=close")
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp
loolwsd/LOOLWSD.cpp |3 +++ 1 file changed, 3 insertions(+) New commits: commit 275624284ec9db360135ac4e387c7be06f7b5f7d Author: Michael MeeksDate: Wed Aug 31 22:05:02 2016 +0100 Avoid profiling CL devices during jail setup. diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index e5853dc..240064b 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -1359,6 +1359,9 @@ void LOOLWSD::initialize(Application& self) Log::warn("Launch this in your browser:"); Log::warn(lcl_getLaunchURI()); +// Otherwise we profile the soft-device at jail creation time. +setenv ("SAL_DISABLE_OPENCL", "true", 1); + // In Trial Versions we might want to set some limits. LOOLWSD::NumDocBrokers = 0; LOOLWSD::NumConnections = 0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp
loolwsd/LOOLWSD.cpp |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit e77a553b767b0e00e2009d0831a832909bcb3ea9 Author: Pranav KantDate: Thu Jul 21 14:56:26 2016 +0530 loolwsd: security: Sanitize user input in convert-to API diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 7583537..bb6340a 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -302,7 +302,10 @@ public: Path tempPath = Path::forDirectory(TemporaryFile().tempName() + "/"); File(tempPath).createDirectories(); -tempPath.setFileName(params.get("filename")); +// Prevent user inputting anything funny here. +// A "filename" should always be a filename, not a path +const Path filenameParam(params.get("filename")); +tempPath.setFileName(filenameParam.getFileName()); _filename = tempPath.toString(); // Copy the stream to _filename. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp
loolwsd/LOOLWSD.cpp | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit 61aba974a9e5ef108da2d37080e7d6b05eab0d2b Author: Andras TimarDate: Sun Jul 3 16:43:36 2016 +0200 loolwsd: command line config override should work in non-debug builds as well ;) (cherry picked from commit 801c8f46761f88e66e9dafdd8ff7daa7a9ab8fb2) diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 1969ad0..b9bd1e1 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -1375,13 +1375,6 @@ void LOOLWSD::handleOption(const std::string& optionName, DisplayVersion = true; else if (optionName == "port") ClientPortNumber = std::stoi(value); -#if ENABLE_DEBUG -else if (optionName == "unitlib") -UnitTestLibrary = value; -else if (optionName == "nocaps") -NoCapsForKit = true; -else if (optionName == "careerspan") -careerSpanSeconds = std::stoi(value); else if (optionName == "override") { std::string optName; @@ -1389,6 +1382,13 @@ void LOOLWSD::handleOption(const std::string& optionName, LOOLProtocol::parseNameValuePair(value, optName, optValue); _overrideSettings[optName] = optValue; } +#if ENABLE_DEBUG +else if (optionName == "unitlib") +UnitTestLibrary = value; +else if (optionName == "nocaps") +NoCapsForKit = true; +else if (optionName == "careerspan") +careerSpanSeconds = std::stoi(value); static const char* clientPort = getenv("LOOL_TEST_CLIENT_PORT"); if (clientPort) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp
loolwsd/LOOLWSD.cpp |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit aaa12d7258c1389d211749581f02c486c1e99357 Author: Andras TimarDate: Tue Jun 21 16:15:31 2016 +0200 loolwsd: avoid NotFoundException when per_document.max_concurrency is missing (old config) (cherry picked from commit bc4633a2a13e3608f71cd558fca5625d4cd711b7) diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index a37b3f4..1119d55 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -1258,7 +1258,7 @@ void LOOLWSD::initialize(Application& self) NumPreSpawnedChildren = config().getUInt("num_prespawn_children", 1); } -const auto maxConcurrency = config().getInt("per_document.max_concurrency"); +const auto maxConcurrency = config().getInt("per_document.max_concurrency", 4); if (maxConcurrency > 0) { setenv("MAX_CONCURRENCY", std::to_string(maxConcurrency).c_str(), 1); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp
loolwsd/LOOLWSD.cpp |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 2b5600d49972d8d25565efc5c75a755de1ded2fa Author: Pranav KantDate: Tue Jun 21 16:06:12 2016 +0530 loolwsd: Handle document URIs with spaces DocumentBroker stores encoded docKey, when child answers with dockey in its query params, Poco::URI::getQueryParameter gives decoded docKey -> mismatch -> document load failed. Change-Id: I53d7cf9d932b9193f15f56ec74db24e279cf3b94 (cherry picked from commit 31009fa9c10212afa6f29f27b61286ce90bdd140) diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 1e27187..a37b3f4 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -955,7 +955,8 @@ public: } else if (param.first == "docKey") { -docKey = param.second; +// We store encoded docKey in DocumentBroker only +URI::encode(param.second, "", docKey); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp loolwsd/loolwsd.xml.in loolwsd/test
loolwsd/LOOLWSD.cpp |7 +++ loolwsd/loolwsd.xml.in |5 + loolwsd/test/Makefile.am |2 ++ 3 files changed, 14 insertions(+) New commits: commit e4de35737c6f6396a92ab02f599a4777e9547c55 Author: Ashod NakashianDate: Wed Jun 15 18:46:13 2016 -0400 loolwsd: max_concurrency setting added Change-Id: Iae3789d26ed2e1aba3806a6f99511fa6c7097988 (cherry picked from commit f7587443721c66b0cbf2243ae00d799bfa8c6891) Reviewed-on: https://gerrit.libreoffice.org/26509 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 192c332..1e27187 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -1256,6 +1257,12 @@ void LOOLWSD::initialize(Application& self) NumPreSpawnedChildren = config().getUInt("num_prespawn_children", 1); } +const auto maxConcurrency = config().getInt("per_document.max_concurrency"); +if (maxConcurrency > 0) +{ +setenv("MAX_CONCURRENCY", std::to_string(maxConcurrency).c_str(), 1); +} + StorageBase::initialize(); ServerApplication::initialize(self); diff --git a/loolwsd/loolwsd.xml.in b/loolwsd/loolwsd.xml.in index cb524a8..96c80dc 100644 --- a/loolwsd/loolwsd.xml.in +++ b/loolwsd/loolwsd.xml.in @@ -1,5 +1,7 @@ + + @@ -10,6 +12,9 @@ 1 + +4 + loleaflet.html diff --git a/loolwsd/test/Makefile.am b/loolwsd/test/Makefile.am index c36cc2a..24c350c 100644 --- a/loolwsd/test/Makefile.am +++ b/loolwsd/test/Makefile.am @@ -1,3 +1,5 @@ +# Cap threads pools to 4. +export MAX_CONCURRENCY=4 AUTOMAKE_OPTION = serial-tests check_PROGRAMS = test ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp loolwsd/MasterProcessSession.cpp
loolwsd/LOOLWSD.cpp |1 - loolwsd/MasterProcessSession.cpp | 12 +++- 2 files changed, 11 insertions(+), 2 deletions(-) New commits: commit 0c6887c744fcd811728de43a971ee9c964d86e8e Author: Ashod NakashianDate: Sun May 29 12:00:09 2016 -0400 loolwsd: bccu#1687 - leaking loolkit processes When conversion fails we still have to put something in the save-as queue to avoid hanging WSD forever. Change-Id: Ibc518bc922ee40f579a71e07571b21d9e633d998 Reviewed-on: https://gerrit.libreoffice.org/25618 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index db561d0..404f576 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -389,7 +389,6 @@ private: Log::trace(docKey + ", ws_sessions++: " + std::to_string(sessionsCount)); lock.unlock(); -Log::trace(docKey + ", ws_sessions++: " + std::to_string(sessionsCount)); // Wait until the client has connected with a prison socket. waitBridgeCompleted(session); diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp index c62ef32..31aa772 100644 --- a/loolwsd/MasterProcessSession.cpp +++ b/loolwsd/MasterProcessSession.cpp @@ -157,8 +157,18 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length) { // Rewrite file:// URLs, as they are visible to the outside world. const Path path(_docBroker->getJailRoot(), url.substr(filePrefix.length())); -url = filePrefix + path.toString().substr(1); +if (Poco::File(path).exists()) +{ +url = filePrefix + path.toString().substr(1); +} +else +{ +// Blank for failure. +Log::debug("SaveAs produced no output, producing blank url."); +url.clear(); +} } + peer->_saveAsQueue.put(url); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp
loolwsd/LOOLWSD.cpp |2 ++ 1 file changed, 2 insertions(+) New commits: commit 2d4b9d57c630780e91490cf1bb408724a62b8a11 Author: Ashod NakashianDate: Thu May 19 20:28:54 2016 -0400 loolwsd: replenish children on finishing a prisoner socket thread Change-Id: Id6b1a12439431819910f6c5c99cb630b48c87805 Reviewed-on: https://gerrit.libreoffice.org/25234 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian (cherry picked from commit f3a1e6e81e8419f42ef039f8ecd7eba332908d2d) Reviewed-on: https://gerrit.libreoffice.org/25617 diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index c414c0f..db561d0 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -1051,6 +1051,8 @@ public: Admin::instance().rmDoc(docKey, sessionId); } +// Replenish. +prespawnChildren(); Log::debug("Thread finished."); } }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp
loolwsd/LOOLWSD.cpp |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit bcc7f117a725733fd8e3e53650b0d44f1ebc3489 Author: Ashod NakashianDate: Thu May 12 10:47:05 2016 -0400 loolwsd: initialize logging sooner and log server startup Change-Id: I33ab52069be0b6c0dca5a741857aa86ae58b67cc Reviewed-on: https://gerrit.libreoffice.org/24934 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian (cherry picked from commit 711b59a2bcd07eed2a56b9a1f6d18b7ef9709629) Reviewed-on: https://gerrit.libreoffice.org/25385 diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index f2b47ad..eff2fea 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -1160,6 +1160,8 @@ LOOLWSD::~LOOLWSD() void LOOLWSD::initialize(Application& self) { +Log::initialize("wsd"); + if (geteuid() == 0) { throw std::runtime_error("Do not run as root. Please run as lool user."); @@ -1459,8 +1461,6 @@ Process::PID LOOLWSD::createForKit() int LOOLWSD::main(const std::vector& /*args*/) { -Log::initialize("wsd"); - if (DisplayVersion) Util::displayVersionInfo("loolwsd"); @@ -1548,14 +1548,14 @@ int LOOLWSD::main(const std::vector& /*args*/) #endif ThreadPool threadPool(NumPreSpawnedChildren*6, MAX_SESSIONS * 2); HTTPServer srv(new ClientRequestHandlerFactory(fileServer), threadPool, svs, params1); - +Log::info("Starting master server listening on " + std::to_string(ClientPortNumber)); srv.start(); // And one on the port for child processes SocketAddress addr2("127.0.0.1", MasterPortNumber); ServerSocket svs2(addr2); HTTPServer srv2(new PrisonerRequestHandlerFactory(), threadPool, svs2, params2); - +Log::info("Starting prisoner server listening on " + std::to_string(MasterPortNumber)); srv2.start(); // Fire the ForKit process; we are ready. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp
loolwsd/LOOLWSD.cpp |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 71b7b68f6a32484c3be50fc99179daa0a3c09e4c Author: Ashod NakashianDate: Thu May 12 10:37:54 2016 -0400 loolwsd: correct error report while loading Change-Id: I4e5e4dd1318144255294011c70c6d2bbfd74c1d8 Reviewed-on: https://gerrit.libreoffice.org/24932 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian (cherry picked from commit 9376156ac34de6c28455ef1c14a65dcd0230ba83) Reviewed-on: https://gerrit.libreoffice.org/25384 diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 6a726de..f2b47ad 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -590,8 +590,9 @@ private: // Remove. std::unique_lock lock(docBrokersMutex); docBrokers.erase(docKey); -throw WebSocketErrorMessageException(SERVICE_UNAVALABLE_INTERNAL_ERROR); } + +throw WebSocketErrorMessageException(SERVICE_UNAVALABLE_INTERNAL_ERROR); } // Validate the URI and Storage before moving on. @@ -820,7 +821,7 @@ public: const std::string msg = std::string("error: ") + exc.what(); ws->sendFrame(msg.data(), msg.size()); // abnormal close frame handshake -ws->shutdown(WebSocket::WS_ENDPOINT_GOING_AWAY, exc.what()); +ws->shutdown(WebSocket::WS_ENDPOINT_GOING_AWAY, msg); } catch (const std::exception& exc2) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits