Commit graph

784 commits

Author SHA1 Message Date
Ashod Nakashian
ae71f8be82 wsd: test: filterSendMessage -> filterSendWebSocketMessage
Change-Id: I0254c05e12cde676de8fde99e16f7eface09dceb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-27 14:07:08 +01:00
Michael Meeks
91b20f6448 delta: include canonical-view-id into the TileLocation.
This avoids problems with watermarking cross-talking betwene view.

Change-Id: Ifecf098423451bf7de3827dfdf9fdc078a06c5c9
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-22 09:16:45 +01:00
Michael Meeks
88f84a6e2d re-factor TileLocation into its own struct.
Change-Id: Iaef52359114c14dbfbca683393ea91d09635be72
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-22 09:16:45 +01:00
Michael Meeks
bef4b1ec5a delta: have own delta cache mutex, and size cache for session count.
Change-Id: I1f970a5f9045df11444f6fec8ce7e8eeb0a71bf5
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-16 10:48:55 +01:00
Pranam Lashkari
e9d441c490 introduce unconditional logging method
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I590ade9d6687a8b0d364a257f107559db4d81b03
2022-06-16 09:39:14 +01:00
Michael Meeks
25de4d898a Elide duplicate tiles in tilecombine at the perimiter of coolwsd.
Needs a run-time check to avoid breaking concurrency assumption
during compression.

Change-Id: Icc959693e19b3506497eb1aa198477445085aeb8
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-15 18:34:58 +01:00
Rash419
45891d0ded wsd: alias: handle a case when regex is added in host tag of alias_group
if host has regex and group has no aliases, when we receive first request from host pattern we considered it as original host and all the host following first request which matches the pattern are considered as aliases
for example:
<group>
	<host>https://.*:80</host>
</group>
if we receives first request from asustuf then behaviour will similar to the following config:
<group>
	<host>https://asustuf:80</host>
	<alias>https://.*:80</alias>
</group>

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I70fb91a4bb7bf38ed79db9efd9fe4bc46db325e1
2022-06-15 11:04:36 +05:30
Ashod Nakashian
ecda47edd9 wsd: test: handle save notifications in tests
Change-Id: Ic6b0abcd2ad2f2a895ff81acaf875147d9990c8b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-10 13:14:35 +01:00
Michael Meeks
0ae5a8ae5e MessageQueue: don't insert duplicates of tiles into TileCombined.
Apparently for some subset of messages (presumably on busy queues)
we have been double compressing the same tiles ...

Change-Id: I79aea4f2162caa8a5b5660c13ae2cae855d90755
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-10 10:10:05 +01:00
Michael Meeks
4478d2b083 Delta: add checks for bad memory usage across threads.
Change-Id: I09f5ad5b0af44399f92ccc0b62056172f1a0b220
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-10 10:10:05 +01:00
Ashod Nakashian
64db149382 wsd: consistent logging of session name
Change-Id: I1f41fb33d5f550da52d43267a8387577acaeaa59
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-07 09:09:00 +01:00
Ashod Nakashian
84f2e65d50 wsd: cleanup log initialization
Change-Id: I7d38459281acb5924809225eea4210286c62e05d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-07 09:09:00 +01:00
Ashod Nakashian
6259be6fbe wsd: better logging of unix socket binding
No need to complain when bind() didn't fail.

And assert when/if we are going to overflow.

Change-Id: I66f5ff1963c0afc6652afb5a7d017e197d945736
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-07 09:09:00 +01:00
Ashod Nakashian
5bdd977410 wsd: simplify socket read logging
Change-Id: I083b86d6c8e6e2b3dc7b14836409281792d7b0bf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-07 09:09:00 +01:00
Michael Meeks
39de4fcc8a perf: collect unusual logging code-paths somewhere else.
Change-Id: Ifa121bdcd054544a53934e41d7ea42a67bbc8a66
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-30 12:32:14 +01:00
Michael Meeks
92d3435dd1 Admin: improve smaps parsing performance.
We have around ~8k smaps lines for each process, polled regularly.

Change-Id: I7e78b17e52aeaec55fa17c5192a940aa9e44b045
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-26 19:53:11 -04:00
Michael Meeks
c130231379 deltas: track, transmit and cache deltas (disabled for now)
Squashed from feature/deltas-expanded.

TileCache changes:
    + add montonic sequence (wid) numbers to TileData
    + account for sizes of TileData with multiple blobs
    + simplify saving and notifying of tiles

Sends updates (via appendChanges) based on the sequence the
right mix of keyframes and/or deltas required as a single
message, and parse and apply those on the JS side.

We continue to use PNG for slide previews and dialogs,
but remove PngCache - used by document tiles only.

Annotates delta: properly as a binary package for the websocket.

Distinguishes between deltas and keyframes we get from
the Kit based on an initial un-compressed prefix
character which we then discard.

kit can be forced to render a keyframe by oldWid=0

Track invalidity on tiles themselves - to keep the keyframe around.

    We need to be able to track that a tile is invalid, and so subscribe
    to the updated version as/when it is ready - but we also want to
    store the keyframe underneath any deltas.

force rendering of a keyframe for an empty slot in the TileCache.

force tile sequence to be zero for combinedtiles - so the client can
always request standalone tiles with explicit combinedtiles, or tile
requests.

move Blob to Common.hpp

use zero size for un-changed tiles.

remove obsolete render-id, and color deltas in debug mode.

cleanup unit tests for non-png tile results.

Change-Id: I987f84ac4e58004758a243c233b19a6f0d60f8c2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-24 22:16:58 +01:00
Michael Meeks
1eb03824e2 delta: disable PngCache for deltas.
Change-Id: I5019b645ccdc02ab813db5e3e421f920681f05e5
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 11:48:33 +01:00
Michael Meeks
1d3142feac Session: remove un-used headers.
Change-Id: Icd0d7c1a6abce9157fd23f0c347866a58033e48c
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 11:48:33 +01:00
Michael Meeks
d8dff82f24 Don't re-use old wire-ids, we want to monotonically increase.
Change-Id: Ie819b73edba175749ed6edf170af326b7b825bac
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 09:35:47 +01:00
Michael Meeks
f76522c86a Compress raw images too directly with zlib.
Change-Id: Idb54db1c3a3d6970db0782b2a7a2eebbad27f153
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 09:35:47 +01:00
Michael Meeks
0df3e41879 deltas: make delta creation & caching thread-safe.
Change-Id: If134ac6212850beadb262a4b8f4c084c78d8a44e
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 09:35:47 +01:00
Michael Meeks
bfc4699ffb deltas: enable monotonic wid incrementing, build deltas based on pos.
We want to always generate a delta vs. the last state we have so we
move linearly forward into the future.

Change-Id: I730d1dfb125a19e2c48b8f84ad5563664d196ab0
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 09:35:47 +01:00
Michael Meeks
8eebe1e345 Tile-deltas, expose TileData to unit tests.
Change-Id: I5f33a56009927187b460775129f0818f47843368
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 09:35:47 +01:00
Henry Castro
a56cefc56f common: move "hashSubBuffer" function
Change-Id: If171b7cf4e636e24cb7f757d893136927e8373aa
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-05-09 16:40:57 +01:00
Michael Meeks
414c36c6f5 Add conditional delta creation back.
Change-Id: I374e4fd0404ee8caa0f81d6de24a55220ae23c91
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-09 16:40:57 +01:00
Ashod Nakashian
4bf085f195 wsd: correctly set termination and shutdown flag
We should always set the shutdown flag first.
Otherwise, we run afoul of a race condition.

Change-Id: Ic99793d68b3b943496ff932b4bdafd336fef7f82
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-05-06 14:45:34 +01:00
Ashod Nakashian
757529aad2 wsd: cosmetics
Change-Id: I85773b4c06c051ee8c52c353e26dd6149c7843de
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-05-06 14:45:34 +01:00
Ashod Nakashian
c6561a99d8 wsd: test: correctly stop SocketPoll in UnitTimeout
Change-Id: I97317e8155e5c65d12e985cc837f07bfcf6a56d6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-05-06 14:45:34 +01:00
Ashod Nakashian
9a69adf766 wsd: test: always set the test name
Change-Id: Ibce5cf049ad1a1df7b11412ed7160d280ece60f3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-05-06 14:45:34 +01:00
Ashod Nakashian
40839e8019 wsd: browser: Reset_Access_Token API to update access-tokens
Change-Id: I92cc424c30824232eaf156ddfe49104932b2ba81
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-05-06 11:13:35 +01:00
Rash419
2163e2f043 wsd: cleanup setting firsthost code
we added AllHosts to give admin the err log that host is not in alias_groups but now as we removed the host list entries from configuration we don't need that log

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8b5e9e6b7df7df59befb496c12966c7ddc60c707
2022-05-05 11:04:22 +05:30
Ashod Nakashian
fac6c01725 wsd: replace strrchr with constexpr
This avoids the runtime overhead of strrchr used
in logged filenames on iOS, which is unnecessary
on string literals, and adds unit-tests.

We also strip leading './' and '../' in other builds.

Change-Id: I56ec722d1400fad9165eb046d1bd8d4438241ca3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-26 11:13:44 +03:00
Ashod Nakashian
14d96957cd wsd: log macro cleanup
* Simplify log macros.
* Reduce expanded lines (faster compilation).
* Avoid flushing (since we always use ostringstream).

Change-Id: Id10c1a75b5af5d8cdba62d768192ab0a6a9e0aca
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-26 11:13:44 +03:00
Ashod Nakashian
777463d9c5 wsd: automatically include a log prefix if provided
Change-Id: Ic542ec83ffa9c76478a4f1121caf3edf078f40a7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-26 11:13:44 +03:00
Ashod Nakashian
b4e8975fbe wsd: minor cleanup of send-frame members
Change-Id: Ic2268780ea815611bf978c0c779ef737facc73fb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-20 08:34:59 -04: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
Ashod Nakashian
264bdec250 wsd: test: move Authorization tests to RequestDetailsTests
And cleanup includes to reduce build time.

Change-Id: If2e242e6688b788b91d62351ef555b31aad1ecde
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Ashod Nakashian
4bec395c39 wsd: support serializing STATE_ENUM to ostream
Change-Id: I460e28488184f4f946eec9f5ae4f220af98cca56
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
f5c936ee63 wsd: add LOG_ASSERT to replace assert with extra logging
In NDEBUG builds, where there is no assert macro,
we log at debug level to still find issues without
adding noise to the logs.

However, in ENABLE_DEBUG builds not only do we assert
but we also log at error level.

Change-Id: I773dbf7bb2b459e505e73d91505b13d8ed2ed6d8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
d8745f288d wsd: logging and minor cosmetics
Change-Id: Ia6ba5b333c8caf742de27be46faf7265a1a777a5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
1d37371944 wsd: minor improvements to logging and macros
This primarily combines the string-literals
that form the filename and line number to
reduce four calls to operator<< to only one.

Also fix LOK_ASSERT_STATE to use its argument.

Change-Id: I5e8eeb4f862fe8679b1e1f7a57412dc84dc30e92
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
b34de7fad1 wsd: move STATE_ENUM to common/StateEnum.hpp
With some minor modifications.

Change-Id: I5bc06bd96bbf201ccaee87170d052b4ad2a6c778
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Miklos Vajna
212e3c0818 common: isValidUtf8: ensure chunk len is 4 at max
UTF-8 is expected to encode a code point using 1 to 4 bytes.

Also check that the promised chunks are there before accessing them.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I9b4f346738865fc18242e51a33c97e5b38ee90d8
2022-04-06 10:26:24 +02:00
Rash419
c2be0b3a48 wsd: add: support to define multiple domain with '|'
fix: in regex, escaping special character fails to find host of the alias

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I19bfacc5e45af26832cb8c6a7d249e0c7de56624
2022-04-05 13:47:57 +02:00
Michael Meeks
db63703d0c Validate as utf-8 all Websocket text messages in debug mode.
Ensure that rendersearchresult: is terminated, and identified as binary.

Change-Id: I84e83c63351cd0aac0923bf7c833b14c1be2c051
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-04-04 20:46:11 +01:00
Ashod Nakashian
11f31b0ba4 wsd: test SSL hostname
Change-Id: I0895d90d2c9be8a76afd209446ae39cd33fa5d2e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-01 10:33:55 +01:00
Ashod Nakashian
099246d67a wsd: unload when no Kit and nothing to upload
When the Kit dies and there is no data saved to
disk to upload, there is nothing to do but unload
DocBroker and log the fact.

With unit-test that simulates the situation by
killing the Kit of a modified document.

Change-Id: I7dcc0583c053d7166935d15d045fcf6624e43b4e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-30 23:18:57 -04:00
Pranam Lashkari
f0026accbf l10n: if English variant is not specified then choose US as default
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Iba4f96c75d69e52044f6460c4e26d0ab1d187d3c
2022-03-30 16:51:56 +05:30
Rash419
31d8822758 wsd: cleanup: moved all parsing related static methods and containers to HostUtil.cpp
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8555522c6216f893b90ba4c27747314830f7abd2
2022-03-29 12:18:31 +02:00