Commit graph

23 commits

Author SHA1 Message Date
Ashod Nakashian
61cf7b9601 wsd: clean up unused header includes
Clang-tidy recommendation driven header
include clean-up.

Change-Id: I30c32866b7798e70df0463ee6bc7a0bcc3de5049
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-08 08:38:48 +01:00
Michael Meeks
7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Caolán McNamara
00705d4a32 use more string_view
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iad56a97f9bef1f6f905f08002b1958072a209551
2023-06-15 13:29:04 +02:00
Ashod Nakashian
480fb7b931 wsd: move tokenizer helpers into StringVector
In an attempt to reduce the size of Util.{c,h}pp
which has grown to contain all sorts of unrelated
helpers, we move StringVector helpers into
the StringVector.{c,h}pp files.

This makes the code better organized.

Change-Id: I152f341606807ae66253415b951bc9f89b09df57
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Andras Timar
f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00
Andras Timar
0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
Ashod Nakashian
65c245eab0 wsd: move string-to-integer helper to Util
Improved implementation.

Change-Id: I0b426f8742c8b718f8c939d271f6645a8ed466d4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96374
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-02 02:38:35 +02:00
Ashod Nakashian
d2d0492245 wsd: move LOOLProtocol::tokenize to Util::tokenize
The tokenizer(s) are more generic than the protocol
logic, and are used from contexts that don't involve
the protocol as such.

Change-Id: Ie8c256bf11a91e466bff794021f41603c9596a7f
2020-06-02 18:03:36 +01:00
Miklos Vajna
b8bd1990aa Rework LOOLProtocol::tokenize() to return a StringVector object
The bulk of this commit just changes std::vector<std::string> to
StringVector when we deal with tokens from a websocket message.

The less boring part of it is the new StringVector class, which is a
wrapper around std::vector<std::string>, and provides the same API,
except that operator[] returns a string, not a string&, and this allows
returning an empty string in case that prevents reading past the end of
the underlying array.

This means in case client code forgets to check size() before invoking
operator[], we don't crash. (See the ~3 previous commits which fixed
such crashes.)

Later the ctor could be changed to take a single underlying string to
avoid lots of tiny allocations, that's not yet done in this commit.

Change-Id: I8a6082143a8ac0b65824f574b32104d7889c184f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89687
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-02-28 16:07:56 +01:00
Miklos Vajna
8d2a8da960 common: fix crash when the version string contains no dot character
==13901==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000904678 bp 0x7ffdb9e21580 sp 0x7ffdb9e21340 T0)
==13901==The signal is caused by a READ memory access.
==13901==Hint: address points to the zero page.
    #0 0x904677 in LOOLProtocol::tokenize[abi:cxx11](char const*, unsigned long, char) common/Protocol.hpp:113:40
    #1 0x898c52 in LOOLProtocol::tokenize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char) common/Protocol.hpp:141:16
    #2 0x18dc2d9 in LOOLProtocol::ParseVersion(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) common/Protocol.cpp:35:51
    #3 0x1148824 in ClientSession::_handleInput(char const*, int) wsd/ClientSession.cpp:358:64
    #4 0x18efcb8 in Session::handleMessage(bool, WSOpCode, std::vector<char, std::allocator<char> >&) common/Session.cpp:232:13

Next commit will add the actual simple fuzzer that found this.

Change-Id: I8623b4451a57390f6f84c11084c5a1120a11fcc5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89225
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-02-22 12:18:11 +01:00
Jan Holesovsky
d906c78198 killpoco: Remove POCO from Protocol.cpp + related StringTokenizer usage.
Change-Id: I9d93c03dde110a4e88f7ec86e5934916596a27c1
Reviewed-on: https://gerrit.libreoffice.org/82301
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2019-11-08 22:20:58 +01:00
Pranav Kant
ad1da235d3 IME support
Dialogs still need to be adapted to this. Only works for documents as of
now.

Change-Id: I0fb1114e279a9e563943f3f65dd5a577523e9841
2018-02-08 14:16:34 +05:30
Miklos Vajna
9eacfe4fcb common: spell out non-trivial autos to improve readability
Change-Id: Id13bc0e48cec845f5b05171128be5b4efc05c6bc
2018-02-07 10:18:12 +01:00
Pranav Kant
f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +05:30
Michael Meeks
73a87493f0 Use WireIds instead of long hashes to identify tiles efficiently.
Changes protocol to use 'wid' instead of 'hash' everywhere. Wire-ids
are monotonically increasing integers that can be mapped to hash
values for all of the hash values and tiles we cache internally.

Change-Id: Ibcb25817bab0f453e93d52a6f99d3ff65059e47d
2017-06-20 21:49:44 +01:00
Michael Meeks
8fb48811ec Protocol - only match complete token names.
Change-Id: I027e29da8cc6c48a0d896fa41516934a3ff71b43
2017-06-20 21:49:44 +01:00
Michael Meeks
0eaef6c896 config.h - get includes right: must always be the first include. 2017-03-10 10:47:43 +01:00
Ashod Nakashian
cd85d8a7f1 wsd: improved protocol helpers
Change-Id: I434fd9d6bb3248a8b9c27bb6c8565369c95786b5
Reviewed-on: https://gerrit.libreoffice.org/33860
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:07:38 +00:00
Tor Lillqvist
04bdf8d623 Bin unused code
Change-Id: I71b7a5f8d769e033b489ae5ea0fbd4425db2184e
2017-01-13 14:14:36 +02:00
Tor Lillqvist
bc19f90dd4 Don't send a tile that hasn't changed even if client asks for it
The server tells the client the hash of each tile it sends (calculated
from the contents of the tile, not its PNG encoding). When the client
asks for a tile to be refreshed, it tells the server what the hash of
the existing tile is. If the server notices that the tile contents
hasn't actually changed, it doesn't PNG encode it and doesn't send it
to the client.

The intent is that this will reduce load on the server and also avoid
unnecessary tile traffic.

Change-Id: Ia06ca68655ea984ed4319f24f4470afda322eccf
2017-01-11 23:25:21 +02:00
Ashod Nakashian
86b38a29de loolwsd: fast in-place getTokenStringFromMessage
Change-Id: I5a7a7402c9394ac72aca907fc8b1072f6d2df5ad
Reviewed-on: https://gerrit.libreoffice.org/31284
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:50:57 +00:00
Michael Meeks
c1a398977f Adapt makefiles, includes etc. to new locations. 2016-11-25 09:58:57 +00:00
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00
Renamed from loolwsd/LOOLProtocol.cpp (Browse further)