Commit graph

1967 commits

Author SHA1 Message Date
Ashod Nakashian
b3acb4001d loolwsd: add tests to validate Impress page changes
Validate the pages before/after insert/delete and
undo/redo operations.

Change-Id: I16aa14f022a8bb0a4b126ea9bc222b788dc7d2dc
Reviewed-on: https://gerrit.libreoffice.org/24747
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:33:27 +00:00
Ashod Nakashian
710134e1be loolwsd: cleanup Impress InsertDelete test
Change-Id: I9dfc5ee36797d0b6a8bff7b5c7e54007c6115bb0
Reviewed-on: https://gerrit.libreoffice.org/24746
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:32:34 +00:00
Ashod Nakashian
d2f4a516a6 loolwsd: spawn ForKit process after initializing server
WSD server must be up and listening to incoming
connections before firing up ForKit and spawning
children.

Having the order reversed caused tests to fail
randomly when WSD was slow to listen to incoming
connections from children already initialized.

Change-Id: I4eaf4a658c65da024101efc096c39222ebfa3c00
Reviewed-on: https://gerrit.libreoffice.org/24745
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:31:44 +00:00
Ashod Nakashian
1a896de0a7 loolwsd: getStatus and status formatting cleanup
Change-Id: Ifd842d7ded1be1f4c89d8371790f19a3909c9729
Reviewed-on: https://gerrit.libreoffice.org/24744
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:28:18 +00:00
Ashod Nakashian
f02deef936 loolwsd: proper logging in Prefork Unit and other cleanups
Change-Id: I23017d3d34edb3608cfe8bc0b5c5eaa340231033
Reviewed-on: https://gerrit.libreoffice.org/24743
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:27:09 +00:00
Ashod Nakashian
641038ef47 loolwsd: noisy failure when test can't collect stats
Change-Id: I6a1693954d84d175478b08f3a49e07e9447e1517
Reviewed-on: https://gerrit.libreoffice.org/24742
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:26:36 +00:00
Ashod Nakashian
5c47a42fea loolwsd: handle socket errors in Prefork Unit
Change-Id: Idc5a2ea776e0b8f0cde43526d690468e1969e611
Reviewed-on: https://gerrit.libreoffice.org/24741
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:26:00 +00:00
Ashod Nakashian
21bf2ff129 loolwsd: give children time to settle after forking before checking
Change-Id: If29d564f16a29f94791c28f5cb03be2ebf7219f3
Reviewed-on: https://gerrit.libreoffice.org/24740
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:24:51 +00:00
Ashod Nakashian
6f39c0f282 loolwsd: state the child PID which has no DocumentBroker
Change-Id: Ifa679ac67cc0a1d12bba4a44f24831e7a291d97d
Reviewed-on: https://gerrit.libreoffice.org/24739
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:21:41 +00:00
Ashod Nakashian
4369cb1ff3 loolwsd: UnitPrefork times out while waiting on child to respond
This prevents deadlocking in case of test failure.

Change-Id: I3026311e9a67543a26acb0316546e6b5aacf61dc
Reviewed-on: https://gerrit.libreoffice.org/24738
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:18:36 +00:00
Ashod Nakashian
9e7b086587 loolwsd: refactored new child addition
Change-Id: I5f554dd0c2d37be3f90059bc8a943cbbe7ac094b
Reviewed-on: https://gerrit.libreoffice.org/24737
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:17:06 +00:00
Ashod Nakashian
8e480d7ac1 loolwsd: use paintPartTile and remove workarounds
Change-Id: Ice59004a23919c7a77a00782f7210a83bc1464e7
Reviewed-on: https://gerrit.libreoffice.org/24703
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-06 15:06:37 +00:00
Pranav Kant
27497ba4dc loolwsd: Fix tile previews for viewing sessions
Also, don't let these tile previews change part of the document
permanently. This is a temporary solution till we have some
better API from LOKit to deal with such a situation.

Change-Id: I8dfefd2b7ad8cf3e7a57afb95b57994ef0bb3b6c
2016-05-06 16:20:27 +05:30
Pranav Kant
1f990d3fc2 loolwsd: Fix incorrect position of id=, editlock= params
editlock= is always the last parameter. This fixes the slide
previews in impress documents for editing session.

Change-Id: I3531c7f52e09e655524fa0afd6fe66da504b5d70
2016-05-06 14:44:03 +05:30
Henry Castro
e03d4f7b77 loolwsd: fix -Werror=shadow 2016-05-05 14:53:34 -04:00
Ashod Nakashian
1643938a8e loolwsd: support the tile id param when broadcasting tiles to subscribers
Obviously this is dangerous, since the id is not part of the
subscription key (the filename) so different clients could
have different ids on the same part, but in practice I
expect this not to happen. Though that clearly depends on
how clients use the id.

Change-Id: I52a0b043c9b5e5ad1111b692e4216cc9ffec5b2b
Reviewed-on: https://gerrit.libreoffice.org/24680
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-05 14:23:22 +00:00
Ashod Nakashian
346a063d0a loolwsd: fix regression to handling tile command
Change-Id: Idedf25f3756ea1e04daf17540b1a57e1e7af8448
Reviewed-on: https://gerrit.libreoffice.org/24679
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-05 14:22:53 +00:00
Ashod Nakashian
83307291ec Document id argument of tile and tilecombine
Change-Id: Ia43ceae31936f68d2bed04b5291a25eeffc637b3
Reviewed-on: https://gerrit.libreoffice.org/24676
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-05 11:37:24 +00:00
Pranav Kant
7734f2557a loolwsd: Do not allow viewing sessions to change parts
bccu#1433, bccu#1757 related.

Piggyback editlock information to tile messages so that kit can
use that information to allow changing parts only for messages
with editlock.

... and decline tile render request for tile messages without editlock
information

Change-Id: I9cedb870cd977741375665cb258d04c818481a14
2016-05-05 14:28:03 +05:30
Ashod Nakashian
909c996a6d bccu#1774: poor API never fails to frustrate
The tile and tilecombine messages apparently have optional
appendages at their rear ends. Not one, but two (at least).

While the first (timestamp) seems to be truely optional
(in the sense that leaving it out doesn't break anything,)
the same can't be said of the second (id).

For Impress slides this id is used to identify the slide
to which the tile belongs. Or rather the slide being
rendered, as it seems meaningful only for the slide
thumbnails.

Previously the complete arguments of tile were copied
verbatim from the input to the output (i.e. back to the
client) and so any extra payload was also echoed back.

But when id is missing (when expected) loleaflet not
only fails to show these tiles (understandably,) but
it also fails to show the scrollbar for said slide
thumbnails altogether!

With the new logic to move the tile communication to
the child socket instead of the clients, the arguments
are parsed and then serialized back in the response.
So all fields must be explicitly known in advance.

This change is necessary because tilecombine is broken
to tile commands and so both share common code. This
means that echoing back the request verbatim will
break loleaflet since tilecombine arguments (which
is a list) is not a valid response (which has the
format of tile). So the internal representation
has to be something neutral/common.

The fix is to parse the timestamp and id only when
provided and to echo back the id only in that case.

Change-Id: Ic97cf0de4083d412a4b3543e8b9a8713ac27a27c
Reviewed-on: https://gerrit.libreoffice.org/24669
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-05 02:41:59 +00:00
Ashod Nakashian
cd8d48e6bb loolwsd: tile logs
Change-Id: Id5c8b688c36038dc6f02ad95ad1c43412dcd2c31
Reviewed-on: https://gerrit.libreoffice.org/24668
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-05 02:34:13 +00:00
Ashod Nakashian
fedb3f520a loolwsd: factored out common tile message
Change-Id: I39600821e3c9c40f3a63343b167cddb3e42b7072
Reviewed-on: https://gerrit.libreoffice.org/24667
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-05 02:33:52 +00:00
Henry Castro
4d52c200c5 loolwsd: test: add testSlideShow 2016-05-04 16:19:47 -04:00
Henry Castro
ae80052e80 loolwsd: add mime type svg 2016-05-04 16:17:29 -04:00
Andras Timar
627cbb73de admincreds' argument is not directory 2016-05-04 20:33:13 +02:00
Ashod Nakashian
25c550ff8e loolwsd: test that slow/hung clients don't block others
Change-Id: I16697ab3afd1d209a77d48506604ec7babc1bfff
Reviewed-on: https://gerrit.libreoffice.org/24655
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 12:38:09 +00:00
Jan Holesovsky
68ed15628d Another place that hardcodes the URI. 2016-05-04 13:56:39 +02:00
Jan Holesovsky
f40167cd6e Initialize the _url correctly. 2016-05-04 13:39:32 +02:00
Jan Holesovsky
191ee00f2c Run the tests on ports that do not conflict with a 'normal' loolwsd.
For the moment, it will allow running 'make check' that does not conflict with
an already running loolwsd (eg. from 'make run').  Later we can consider
running more tests in parallel.
2016-05-04 13:39:32 +02:00
Jan Holesovsky
f6f4681556 Use a separate client port for running the tests.
So that they can run in parallel to a 'production' loolwsd (like one from
'make run' or so) in the future; for the moment it is not possible, as the
MASTER_PORT is hardcoded.
2016-05-04 13:39:32 +02:00
Jan Holesovsky
4935bf14b4 LOOL_TEST_CLIENT_PORT env. var for overriding the client port in the tests.
And some further reduction of #ifdef ENABLE_SSL's...
2016-05-04 13:39:32 +02:00
Miklos Vajna
29f11ccab9 loolwsd: fix -Werror,-Wunused-function
Change-Id: Ifc58722337bdc62952082ddfb11ce90cd6fc21c2
2016-05-04 13:38:04 +02:00
Ashod Nakashian
92c068541a loolwsd: -Werror=shadow
Change-Id: Ifc3c065fd7b6d20f8bad5f5a6a1b48c47bc8f1e0
Reviewed-on: https://gerrit.libreoffice.org/24649
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 11:19:38 +00:00
Ashod Nakashian
82333e06fa loolwsd: add explanation as to why code is commented out
Change-Id: I3478d6c84cd960c4a7317ee5adc75db8c13aeaef
Reviewed-on: https://gerrit.libreoffice.org/24647
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:56:41 +00:00
Ashod Nakashian
bc58536113 loolwsd: new tiles unittest
Change-Id: Id63f1ae03c1d33dec666c43d64042838df10c29d
Reviewed-on: https://gerrit.libreoffice.org/24646
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:38:27 +00:00
Ashod Nakashian
2b02caa0b5 loolwsd: getResponseMessage that can return large binary payloads
Change-Id: Ie2cd3db5abdf00a04a6970825359095608fdb660
Reviewed-on: https://gerrit.libreoffice.org/24645
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:37:59 +00:00
Ashod Nakashian
a760c71ed6 loolwsd: tests should print progress and errors to cerr
Change-Id: I07341ef26de877b01f6dff0d8df81be4e1b4bed2
Reviewed-on: https://gerrit.libreoffice.org/24644
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:37:42 +00:00
Ashod Nakashian
25a8b71dbb loolwsd: hoist invariant message out of loop
Change-Id: I9319518a4bbba9c24ba5c0132d89ad6a793247e8
Reviewed-on: https://gerrit.libreoffice.org/24643
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:37:24 +00:00
Ashod Nakashian
cdb5f9c2da loolwsd: moved tile tests to TileCacheTests.cpp
Change-Id: I6bc681772104615b79bbe3a21ccaead01abde4dd
Reviewed-on: https://gerrit.libreoffice.org/24642
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:37:10 +00:00
Ashod Nakashian
df67c4a31c loolwsd: move tilecombine handling into lokit
Change-Id: I32854769c5260444b0e97c112a141028f1cda179
Reviewed-on: https://gerrit.libreoffice.org/24641
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:36:38 +00:00
Ashod Nakashian
a240f2666f loolwsd: tile traffic is now completely centralized
WSD's DocumentBroker and Kit's Document now handle
the communication of tiles as well as all aspects
of rendering, caching, unifying requests and
distributing results etc.

Change-Id: Ie22fbaaae26b91185ee348ec7077f30430eec0f6
Reviewed-on: https://gerrit.libreoffice.org/24640
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:36:01 +00:00
Ashod Nakashian
ff0d4a3a91 Revert "Revert "loolwsd: establish communication with...
...child from DocumentBroker""

Restore the communication with child from DocumentBroker.

This reverts commit 20ab6e8ae7.

Change-Id: I248bededff7074d8fb482b2cdd172048f80c02b2
Reviewed-on: https://gerrit.libreoffice.org/24639
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:33:48 +00:00
Ashod Nakashian
ac4f9857ea loolwsd: getAbbreviatedMessage adds no brackets
Change-Id: Ic26feda6fa8e9e93548624f9d6b6fd84f085eb19
Reviewed-on: https://gerrit.libreoffice.org/24638
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:33:21 +00:00
Ashod Nakashian
8b18038718 loolwsd: prespawnChildren should be forgiving when lock is not available
Change-Id: Id84aa873113f7d3d575ad10504582d93eff51baa
Reviewed-on: https://gerrit.libreoffice.org/24637
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:33:06 +00:00
Ashod Nakashian
3b693ac735 loolwsd: use return value of std::max
Change-Id: Ifd4e06c1a646de8d3c2c67166b2e2c57fe2ab761
Reviewed-on: https://gerrit.libreoffice.org/24636
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:32:32 +00:00
Jan Holesovsky
b0af4bb3f9 Disable this test, it's unreliable.
For me, it is deadlocking - while we are waiting on the condition variable,
the tear down of the actual LOK / document is not progressing, because it is
waiting on something.

I was unable to get to the bottom of this in a reasonable time, so just
disabled the test for the moment; Ash is working on a similar problem I think,
so let's see if his solution helps here too (or can be applied the same way or
something).
2016-05-04 11:36:09 +02:00
Jan Holesovsky
c3ac6c8287 Better wording. 2016-05-04 11:30:41 +02:00
Andras Timar
dd21e402d4 Bump version to 1.6.4 2016-05-03 23:32:05 +02:00
Jan Holesovsky
030b59a5af Redirect stdout to the log too.
Without this, the unit-prefork gives unpredictable results depending on
whether the entire unit test run output is redirected to another logfile or
not (as then the stdout is inherited, and points to an unexpected place).

Maybe we should just exclude the fd 0, 1, 2 from the testing; but this is good
enough for now.
2016-05-03 14:51:40 +02:00
Pranav Kant
0559b58144 loolwsd: Use SocketProcessor from IoUtil in Admin
Change-Id: Ic89f04ee61f58ae13da9205e84d36ec06ed1d7ee
2016-05-03 12:59:02 +05:30
Tor Lillqvist
82f6a9a2ba Edit typo in comment to make it actually make sense 2016-05-03 09:56:33 +03:00
Tor Lillqvist
bfcf9756f5 Don't assert on PING frames that we send
UnitPrefork got what I assume is one of those PING frames that
ChildProcess::isAlive() sends before the actual reply when it sent the
"unit-memdump" message, and did not like it. Uncommenting the line
that outputs the "memory stats" message it expects showed:

Got memory stats 'PING'

Followed by:

Assertion `tokens.count() == 2' failed.

Fix by factoring out the handling of PING frames, PONG frames, and the
pseudo-PONG frames that we send ourselves in reply to PING frames into
a new function IoUtil::receiveFrame(). Use that in a couple of
places. (Probably should use in many more places.)

Getting past this then leads to later cppunit tests again being run,
and their failures then again showing up...
2016-05-03 09:50:38 +03:00
Tor Lillqvist
79968ccefb Clarify binary vs text frame non-distinction
Note that we currently have unit tests that incorrectly (IMHO) require
some frames sent by the server to indeed be 'text' ones from the
WebSocket perspective. That is an unnecessary restriction.
2016-05-03 08:23:06 +03:00
Tor Lillqvist
15e216ff7c Clarify that single-line don't need a newline terminator 2016-05-03 08:15:06 +03:00
Ashod Nakashian
431bab2824 loolwsd: fix autosave regression
Autosave should only save when the user has been idle
for a certain time, or the periodic autosave time elapses.

The document is considered for autosave only when it's modified.

Change-Id: Ia239173ff6636e52c1a2b7e1f6bf9bd6860175ed
Reviewed-on: https://gerrit.libreoffice.org/24602
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-03 03:05:44 +00:00
Ashod Nakashian
68f24e375a loolwsd: replenish the child reservoir and cleanup dead ones
Change-Id: I705ba01ca6254ff61ddd8ebc1248117b9fec7d20
Reviewed-on: https://gerrit.libreoffice.org/24601
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-03 03:05:29 +00:00
Ashod Nakashian
7d03ebdf85 loolwsd: corrections to terminate SocketProcessor
Change-Id: I3b08d1b2f734b8736ed35f667c1ca988490c4fa4
Reviewed-on: https://gerrit.libreoffice.org/24600
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-03 00:01:13 +00:00
Ashod Nakashian
6c57e9be4d loolwsd: helper to assert a lock is already taken
Change-Id: Id28f7a39a4d45ea6ad391015364467dc8ded3e66
Reviewed-on: https://gerrit.libreoffice.org/24599
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-03 00:00:13 +00:00
Ashod Nakashian
cf717152a7 loolwsd: bin_PROGRAMS -> noinst_PROGRAMS
Change-Id: Idfcfc9d21edafd094aa7c50b300b298e1ddfe6f5
Reviewed-on: https://gerrit.libreoffice.org/24598
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 23:54:50 +00:00
Jan Holesovsky
511b6c1039 Reduce #ifdef ENABLE_SSL's. 2016-05-02 18:41:57 +02:00
Jan Holesovsky
e2be97f14a Centralize the server URI. 2016-05-02 18:25:58 +02:00
Jan Holesovsky
c3cb14d258 Centralize the server URI. 2016-05-02 18:19:08 +02:00
Jan Holesovsky
a27a22b563 Add purpose comments. 2016-05-02 18:03:09 +02:00
Jan Holesovsky
b3dd2f31f9 Update the gdb command to match reality. 2016-05-02 15:03:16 +02:00
Jan Holesovsky
9df5ccc517 Make this unit test running without SSL too. 2016-05-02 15:03:16 +02:00
Andras Timar
faf7f5a167 redirect stderr to /dev/null (some search directories do not exist on all systems) 2016-05-02 13:17:13 +02:00
Jan Holesovsky
20ab6e8ae7 Revert "loolwsd: establish communication with child from DocumentBroker"
Unfortunately this causes a deadlock in the unit tests.

This reverts commit 10417c9447.
2016-05-02 11:49:58 +02:00
Michael Meeks
6b88e97b63 Add unit test hook for libreofficekit. 2016-05-02 05:40:24 +01:00
Ashod Nakashian
10417c9447 loolwsd: establish communication with child from DocumentBroker
The WebSocket that each child created with WSD is not used
except to request the child to load the document a client
requests. Beyond this point, it was not utilized for anything.

In fact, there are no handlers in WSD for messages coming
from the child; it is a one-way communication.

That is until now. With the move to unify communication
between WSD and each child, DocumentBroker can now
receive and handle messages from its ChildProcess.

Change-Id: Ie7f030a92db8303cd7087fff2325f136a49bc7fc
Reviewed-on: https://gerrit.libreoffice.org/24581
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:55:53 +00:00
Ashod Nakashian
c913e8e135 loolwsd: assert when we should be called with lock acquired
Change-Id: If784dbbfe6ca687fff181f623e413e9b86d51807
Reviewed-on: https://gerrit.libreoffice.org/24580
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:53:22 +00:00
Ashod Nakashian
1117be07c4 loolwsd: expose sending binary frame on Sessions
Change-Id: I5e81ced0511e44dc5f3445dae42f4354da164b3a
Reviewed-on: https://gerrit.libreoffice.org/24579
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:53:04 +00:00
Ashod Nakashian
c757253939 loolwsd: getAbbreviatedMessage from std::vector<char>
Change-Id: Ib901fb786839d48604a99a0eab0c7dd048e2004d
Reviewed-on: https://gerrit.libreoffice.org/24578
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:52:46 +00:00
Ashod Nakashian
3dc72cab18 loolwsd: ChildProcess cleanup
Change-Id: I1ae4911d3f5d527af86f39ed2723bbceef12cffe
Reviewed-on: https://gerrit.libreoffice.org/24577
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:52:28 +00:00
Ashod Nakashian
713cf3c067 loolwsd: return static data via static members
Change-Id: I083cdc921062ef518c9b39bae219caba6c99ee60
Reviewed-on: https://gerrit.libreoffice.org/24576
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:52:11 +00:00
Ashod Nakashian
516bad1942 loolwsd: TileCache whitebox tests
New unittests to verify TileCache logic on the unit level.

Change-Id: Ia36181e850b349abb88ba5f04f1e5244771bacc6
Reviewed-on: https://gerrit.libreoffice.org/24574
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:18:35 +00:00
Ashod Nakashian
b916543eef loolwsd: tests can be built with running using 'make'
Indeed, tests are built when invoking make in loolwsd
directory, thereby helping catch build errors in test
before committing.

Change-Id: I34cffcb5d0aed6485e578cf20f64217bee337d23
Reviewed-on: https://gerrit.libreoffice.org/24573
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:17:46 +00:00
Ashod Nakashian
a800d366ba loolwsd: missing header
Change-Id: Ib03f6fa048b0b38c0cba4216c4ca9b60f663f3f4
Reviewed-on: https://gerrit.libreoffice.org/24572
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:17:18 +00:00
Ashod Nakashian
461fd40b49 loolwsd: more support for TileCache unittest
Change-Id: I7b09fdde8179c855bbb1545f3a2188be1c929d20
Reviewed-on: https://gerrit.libreoffice.org/24571
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:17:05 +00:00
Ashod Nakashian
d16f44d7a2 loolwsd: TileCache unittest, hooks, and events
Change-Id: Id9e0539d2f920f15b0d0cb8e5924e480ed6d1e87
Reviewed-on: https://gerrit.libreoffice.org/24570
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:16:31 +00:00
Ashod Nakashian
b0eed75f05 loolwsd: differntiating Poco and std exceptions in logs adds little value
Change-Id: I1c571ef46d58b1f007cba58506a3fbfd460fb0f0
Reviewed-on: https://gerrit.libreoffice.org/24569
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 16:38:50 +00:00
Ashod Nakashian
e311e26641 loolwsd: private better than public
Change-Id: Ie4e9abf160a0a9d9c7de8e31358468ce154a30cd
Reviewed-on: https://gerrit.libreoffice.org/24568
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 16:38:31 +00:00
Michael Meeks
012593e375 Unit test cleanups. 2016-04-30 18:15:50 +01:00
Ashod Nakashian
8e31a512b1 loolwsd: fix a race between loading and setting part
Change-Id: Ib9a5b3dfe82ff5915208c420b8dc8124d08c5533
Reviewed-on: https://gerrit.libreoffice.org/24529
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:38:35 +00:00
Ashod Nakashian
59b475570d loolwsd: no need to sleep before running tests
Since lokit process counting waits until WSD
is ready (i.e. until it has created lokit processes,)
there is no need to sleep explicitly anymore.
Provided, of course, we always call the lokit
process counter before running any tests, which we
currently do.

Change-Id: Idf7ad925688251f1c81ef8628530714d2dc92d9c
Reviewed-on: https://gerrit.libreoffice.org/24528
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:37:36 +00:00
Ashod Nakashian
fd99834147 loolwsd: always run the lokit process count tests
Change-Id: I47365609850c23843624f714d6600f07629461ae
Reviewed-on: https://gerrit.libreoffice.org/24527
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:37:06 +00:00
Ashod Nakashian
5871ef32a9 loolwsd: log the pid in the backtrace
Change-Id: Ic0565f266f1ad56d855a76fb42fac8066066fd45
Reviewed-on: https://gerrit.libreoffice.org/24526
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:36:48 +00:00
Ashod Nakashian
bdfda58386 loolwsd: don't autosave when document not loaded
Change-Id: I44e9c2ad234ee05348b47415add3933c81fce968
Reviewed-on: https://gerrit.libreoffice.org/24525
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:36:28 +00:00
Ashod Nakashian
fc9df5db91 loolwsd: don't log memory usage if not changed
Change-Id: I98c43abb87e2291a304e77d6eb09ea1800545b72
Reviewed-on: https://gerrit.libreoffice.org/24524
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:36:02 +00:00
Ashod Nakashian
67fb02d277 loolwsd: formatting, logging, and comments
Change-Id: I0292c39b18d013829d20ef23afcf970eefbe7d42
Reviewed-on: https://gerrit.libreoffice.org/24523
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:35:38 +00:00
Ashod Nakashian
ce64895cee bccu#1751 deadlock during save
While there are two separate callbacks registered
(one with lokit and the other with lokitDocument,)
there is no reason why they should be handled
separately (and indeed differently).

The lokit callback only sends notifications on
status indicator (during loading and saving)
and document password type (if protected).

Due to the different callback handlers
the status indicator was only sent to the
first client, not all (as one expects).

Furthermore, because the lokit callback
was processed on the Core thread, it
was bound to cause performance and
thread-safety issues. Specifically it
deadlocked when another callback was
in flight when a save issued status
indicator callback.

By unifying the callbacks and putting
all callback messages on the message
queue we avoid all of the above and
simplify the code.

Change-Id: I5bd790b6ce88b7939186c1ec1dead7fb6cabf7e0
Reviewed-on: https://gerrit.libreoffice.org/24522
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:34:32 +00:00
Ashod Nakashian
4be73e5934 loolwsd: minor improvement to testing socket flags
Change-Id: I87d4d6a22fccef97bf69fce249ec0374db417714
Reviewed-on: https://gerrit.libreoffice.org/24502
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 21:20:11 +00:00
Ashod Nakashian
a007a7c1d4 loolwsd: improved LoKit process counting
Change-Id: I514ece4ce7f401a8996bc115ab00ddb7a8bec90d
Reviewed-on: https://gerrit.libreoffice.org/24501
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 21:19:46 +00:00
Jan Holesovsky
2b9295e8d7 countLoolKitProcesses() is more reliable here. 2016-04-29 22:02:21 +02:00
Jan Holesovsky
ce691601dd Need a longer default timeout for the httpwstest.cpp. 2016-04-29 22:02:21 +02:00
Jan Holesovsky
d906bba7d1 Added a FIXME explanatory comment. 2016-04-29 15:16:59 +02:00
Jan Holesovsky
9f5ca3f0ff Help the autodoc. 2016-04-29 13:42:01 +02:00
Ashod Nakashian
66392f4121 loolwsd: gitignore looltest
Change-Id: Icc90db9e98309db5348bf608662b5f34a1980a7e
Reviewed-on: https://gerrit.libreoffice.org/24492
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 11:31:55 +00:00
Ashod Nakashian
0e4c624f0b loolwsd: minor improvement to test assertions
Change-Id: I40da725919ae775d039217c258ecd28a743b5bc1
Reviewed-on: https://gerrit.libreoffice.org/24484
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:40:13 +00:00
Ashod Nakashian
afa3e7c4ed loolwsd: log error on failure, not success
Change-Id: Iac417c3779f3879697d056b5e402e91902bfd168
Reviewed-on: https://gerrit.libreoffice.org/24483
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:39:49 +00:00
Ashod Nakashian
42a88e2362 loolwsd: fix load test regression
Change-Id: Icadd22306f61338698aedb1b6b5d4e02246d9a4e
Reviewed-on: https://gerrit.libreoffice.org/24482
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:39:22 +00:00
Ashod Nakashian
472f959bec loolwsd: more sharing of common test code
Change-Id: Id49118eb38633127327fc16e5f49137255e78425
Reviewed-on: https://gerrit.libreoffice.org/24481
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:38:53 +00:00
Ashod Nakashian
c6380f5820 loolwsd: test logging cleanup
Change-Id: Ie2fa40eab6fec4cfe9819d75f1c35efd835b11b7
Reviewed-on: https://gerrit.libreoffice.org/24480
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:37:51 +00:00
Ashod Nakashian
7f17561f7a loolwsd: test SocketProcessor supports timeout
Change-Id: I1cf277c67840f35a0f79884c9b1c644b0769b5fd
Reviewed-on: https://gerrit.libreoffice.org/24479
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:37:20 +00:00
Ashod Nakashian
40d694d9ef loolwsd: moved loolkit process counting to own file and minimized wait
Change-Id: Ib7950fe7d97ca3484aadb1d7a7492ad1a88e375a
Reviewed-on: https://gerrit.libreoffice.org/24478
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:36:49 +00:00
Ashod Nakashian
c164096c53 loolwsd: factored out common test helpers
Change-Id: Iad2794f1b458f04bdd1fb9d3f965afd91adbade8
Reviewed-on: https://gerrit.libreoffice.org/24477
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:36:00 +00:00
Ashod Nakashian
575e093076 loolwsd: editlock and takeedit tests
Change-Id: Ie2458aed1da0624f1769b6b75f134cb0fed0db75
Reviewed-on: https://gerrit.libreoffice.org/24475
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 01:09:24 +00:00
Ashod Nakashian
e2cf1a5b52 loolwsd: always send status before other messages
Except for loading progress messages (statusindicator).

Change-Id: I42f79167c3ff953fc4e283854468cd7e8bd54bc3
Reviewed-on: https://gerrit.libreoffice.org/24474
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 01:08:08 +00:00
Ashod Nakashian
f44660aa99 loolwsd: unittest cleanups
Change-Id: Ib9b915c7ca2df03afba7f4e1fb37b8fff846a474
Reviewed-on: https://gerrit.libreoffice.org/24473
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 01:07:30 +00:00
Ashod Nakashian
2efaa6e06b loolwsd: save documents when timestamp is within 10 seconds
Due to filesystem timestamp precision and other factors
we assume a timestamp match within 10 seconds to mean
the document has been recently saved and store it.

A document has to have an older than 10 seconds
modified timestamp compared to our last timestamp
to be deemed unchanged in the interim and skipped
from storing again.

Change-Id: I39b4bf64b221ba30dc7b818a330e779a2d0ecbd4
Reviewed-on: https://gerrit.libreoffice.org/24472
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 01:06:57 +00:00
Ashod Nakashian
1dd88e68ea loolwsd: shortened some long identifiers
Change-Id: I87809f5ad2a6d8f546cf3abaf646672d2d8168dc
Reviewed-on: https://gerrit.libreoffice.org/24471
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 01:05:45 +00:00
Ashod Nakashian
7ff5be1f70 loolwsd: document rendering options should be set once
When loading a document first we set the rendering
options. Beyond that, the document is shared and
we shouldn't change the rendering options.

Change-Id: I0d2ac6fc43553b8395111ba2b8a3cc2796d2f0a4
Reviewed-on: https://gerrit.libreoffice.org/24470
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 01:04:43 +00:00
Ashod Nakashian
466ffc25db Use [] around messages as they are more readable than ''
Change-Id: Id172bb03e8fa9dd148612d756d4a74fc501ea95c
Reviewed-on: https://gerrit.libreoffice.org/24469
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-28 22:20:40 +00:00
Ashod Nakashian
cf54d0d87e loolwsd: test helpers and more code sharing
Change-Id: I87e4ad23f9c2761a7a2acab4139b458696e07e64
Reviewed-on: https://gerrit.libreoffice.org/24468
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-28 22:20:10 +00:00
Henry Castro
49e6eb287b loolwsd: test: fix wrong file name 2016-04-28 14:01:28 -04:00
Jan Holesovsky
407b41afb9 Decrease verbosity of this the http server test.
And also check that we've had a hit in loleaflet.html.
2016-04-28 18:35:22 +02:00
Jan Holesovsky
28b7aee356 No need for a standalone httptestutils.hpp any more. 2016-04-28 18:17:37 +02:00
Jan Holesovsky
8e266391f1 Merge the http get and post tests into one file, and reduce copy/paste. 2016-04-28 18:08:07 +02:00
Jan Holesovsky
f283b045a9 The http tests are actually integration tests, not unit tests. 2016-04-28 17:45:18 +02:00
Jan Holesovsky
7d2aaa8910 Log the exact test file that has been used. 2016-04-28 12:35:56 +02:00
Miklos Vajna
30d90d6b96 loolwsd: using range-based loops is more readable here
Change-Id: I9533c74dbcd6622a01b21096109edc3b27e797e3
2016-04-28 08:44:01 +02:00
Tor Lillqvist
2dde26c2ff Add rant 2016-04-28 09:28:54 +03:00
Henry Castro
6378016586 loolwsd: test: add testClientPartCalc 2016-04-27 16:48:30 -04:00
Andras Timar
2993db466c add all private IPv4 address ranges as allowed (for docker, for example) 2016-04-27 22:25:06 +02:00
Henry Castro
daa3d69f9e loolwsd: test: update 2016-04-27 14:30:19 -04:00
Henry Castro
33eff1fe31 loolwsd: test: add testClientPartImpress 2016-04-27 13:51:23 -04:00
Henry Castro
200c6a9281 loolwsd: rework setclientpart 2016-04-27 13:47:58 -04:00
Miklos Vajna
78308db763 loolwsd: remaining 'unnecessary copy' fixes
Change-Id: I138e8473a002a15aae7752136950bb905a21fb1f
2016-04-27 14:58:33 +02:00
Andras Timar
c11b4a2823 rpm spec file fixes (openSUSE dependencies, add 'lool' user in %pre) 2016-04-27 14:32:37 +02:00
Tor Lillqvist
ee7f8c158a Actually we want to check only for it starting with the expected string
As this assert fails at the moment (it did even before my previous
commit), I can't be 100% sure it is correct now. So sue me. Or revert
both my changes.
2016-04-27 14:19:01 +03:00
Tor Lillqvist
8480cad8ee Use CPPUNIT_ASSERT_EQUAL
It is useful to see the expected and actual values when the assertion
fails.
2016-04-27 14:08:34 +03:00
Tor Lillqvist
2743ce5f7c Revert "I don't think we want the hello-world.odt to be modified without noticing"
Ah, I was confused.

This reverts commit f6d0730379.
2016-04-27 09:53:31 +03:00
Tor Lillqvist
0d198eb0ec The loadtest program went away a while ago already 2016-04-27 09:51:31 +03:00
Tor Lillqvist
f6d0730379 I don't think we want the hello-world.odt to be modified without noticing 2016-04-27 09:51:04 +03:00
Ashod Nakashian
ffc873895d loolwsd: logs
Change-Id: Ic7632824c32d66eaf7d496e0824a57ebbef986f5
Reviewed-on: https://gerrit.libreoffice.org/24421
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-27 03:50:56 +00:00
Ashod Nakashian
e6a6b296ea loolwsd: avoid communicating with clients under shared lock
DocumentBroker is a central document management object.
Using it to communicate with clients leaves it open
to the whims of slow connections. When its lock
is help for a long time, all clients stall, giving
users a very poor experience.

The culprit in this case was takeEditLock, which
sent to all clients the new edit lock state.
To avoid this, DocumentBroker now sends this
state to the children (via a loopback socket,)
which process messages in a separate process and
each on its own queue thread. The children then
in turn echo this edit lock state back to the
clients. This communication back is done on the
prisoner socket thread, which doesn't lock or
stall any shared objects or threads.

Change-Id: I475f6b3ecac9ae2a689bd30f43d416871aa0e384
Reviewed-on: https://gerrit.libreoffice.org/24420
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-27 03:50:22 +00:00
Ashod Nakashian
5cfc7b6580 loolwsd: logging and cosmetics
Change-Id: Idb2cdc22555d237a162b58cacbfd1986f8bc7656
Reviewed-on: https://gerrit.libreoffice.org/24383
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-26 10:41:41 +00:00
Ashod Nakashian
d07a582469 loolwsd: merged autoSave and waitSave
This makes for amore compact API and avoids
a race between issuing the save and waiting for it.

Also added force flag and autoSave now checks the
modified state of the document. If a document is
not modified, nor save forced, autoSave checks
the last activity on the document and only
if there is any since last save does it issue
a save command.

Change-Id: I962e36df18d7edf5f658992e97b5def5f6247dc3
Reviewed-on: https://gerrit.libreoffice.org/24382
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-26 10:40:35 +00:00
Ashod Nakashian
d4aa547d3c loolwsd: avoid persisting excessively
When multiple users have a document open,
save notficiations are broadcast to all.
Each session then tries to store the document
to the Storage when only the first should suffice.

A new file modified-time member tracks the file's
timestamp and only persists when it changes,
thereby avoid excessive stores.

Change-Id: I138f1aa812963a2120a1fcac763dfacccc542c1a
Reviewed-on: https://gerrit.libreoffice.org/24381
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-26 10:40:07 +00:00
Jan Holesovsky
f5abfcde68 Improve test to be able to see the message directly.
The test was unreliable, but any change there made it reliable, so not sure
yet what was the root cause - but at least this should help seeing the
brokeness once it appears again.
2016-04-26 11:54:20 +02:00
Jan Holesovsky
2f561802b3 The branding files do not have to be present, skip them.
Clean up tons of copy'n'paste when at that...
2016-04-26 11:32:01 +02:00
Andras Timar
5dec73b182 fix more package names on SUSE 2016-04-26 10:16:19 +02:00
Andras Timar
97453617e8 fix libatk package name 2016-04-26 10:01:08 +02:00
Miklos Vajna
25fa9653b8 Storage: avoid unnecessary copy-construct
Change-Id: I592adb26590f8957e01ed55a4ba9a976a3aac246
2016-04-26 09:35:01 +02:00
Tor Lillqvist
42dcd6ea99 Why log a string that we even expect to be junk?
WebSocket::receiveFrame() does not null-terminate the buffer even when
it successfully reads something into it, even less when it
doesn't. (Why would it, as it is perferctly fine to transmit WebSocket
(binary) frames that contain zero bytes.) So the 'received' string was
always full of random bytes.
2016-04-26 08:20:59 +03:00
Henry Castro
47917fb8c9 loolwsd: test: add testLinks 2016-04-25 21:40:24 -04:00
Henry Castro
7317345a2b loolwsd: test: add testScripts 2016-04-25 21:01:46 -04:00
Henry Castro
8ea127407b loolwsd: test: replace std::regex 2016-04-25 18:07:55 -04:00
Michael Meeks
dc035c83b7 Unit test to catch / avoid unexpected inherited sockets. 2016-04-25 21:09:57 +01:00
Michael Meeks
3e151af9f6 Typo fix, and atomic markToDestroy. 2016-04-25 10:21:54 +01:00
Michael Meeks
e64bc95044 Further TileBeingRendered cleanup & re-factor.
Turn TileBeingRendered into an internal implementation detail.
2016-04-25 10:11:36 +01:00
Andras Timar
603b231937 put %{dist} after release number 2016-04-25 11:00:46 +02:00
Andras Timar
d7d373144d Bump version to 1.6.2 2016-04-25 11:00:46 +02:00
Tor Lillqvist
a25b7ad712 Bin unused Util::createRandomFile() 2016-04-25 11:23:08 +03:00
Tor Lillqvist
581037d45e There is no Util::hasCorrectUID() 2016-04-25 11:18:35 +03:00
Miklos Vajna
9ea85e8d1a httpwstest: fix -Werror,-Wshadow
Change-Id: I64482d921409e291f6f60bf7d963a516ba4e7550
2016-04-25 09:22:41 +02:00
Miklos Vajna
f99e2146bc TileCache: loop variable is copied but only used as const reference
Change-Id: I2f4ec5dad91abd6776095962070bd5b12021c24f
2016-04-25 09:11:59 +02:00
Tor Lillqvist
246e341c66 There is a kill() system call 2016-04-25 09:25:23 +03:00
Tor Lillqvist
ada503d91e Bin unused variable 2016-04-25 09:15:25 +03:00
Tor Lillqvist
dcbb5eab33 Hmm, probably should remove all those commmented-out lines for consistency then
If there in fact was some good reason to have them, it is trivial to
add them back (with a comment telling why they are useful, thanks).
2016-04-25 08:25:32 +03:00
Tor Lillqvist
53de1935e3 Remove accidentally (?) committed commented-out line 2016-04-25 08:13:48 +03:00
Ashod Nakashian
4f7b911066 loolwsd: simplified the bridging between client and prisoner sessions
Change-Id: I1335060963eda3356312f42060da229f43d239d8
Reviewed-on: https://gerrit.libreoffice.org/24358
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-25 02:16:16 +00:00
Ashod Nakashian
afc152b0ce loolwsd: compiler fixes in the tests
GCC 5.x doesn't allow temporary strings in regex_match.

Change-Id: I4c62872661d6b78ce7e949cf524c7b2b36fb0197
Reviewed-on: https://gerrit.libreoffice.org/24357
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-25 02:14:30 +00:00
Ashod Nakashian
724911f522 loolwsd: let the exception bubble up instead of assertion
Change-Id: I471e017e486c2d7d7dcbf3cebd96d61eabfd54da
Reviewed-on: https://gerrit.libreoffice.org/24356
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-25 02:12:52 +00:00
Henry Castro
9720ea3781 loolwsd: test: add testParams 2016-04-24 21:00:44 -04:00
Henry Castro
e06cf8ac16 loolwsd: test: add testLOleaflet 2016-04-24 16:41:51 -04:00
Henry Castro
05d9e5ae0c loolwsd: test: update testInsertDelete 2016-04-24 15:00:21 -04:00
Ashod Nakashian
6b1a3115b2 loolwsd: request new session from child before storing session
Change-Id: Iadf8a4d30aaab276c55b3bb28c684df0004f8f3c
Reviewed-on: https://gerrit.libreoffice.org/24339
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:10:50 +00:00
Ashod Nakashian
74cb8d84d2 loolwsd: exception-safe session and document management
Sessions are referrenced in DocumentBroker instances,
which themselves are referrenced in a container.

When exceptions are thrown either while creating a new
session, or during the lifetime of one, these references
must be correctly cleaned up, otherwise we introduce
internal instability in addition to stalling the client.

Change-Id: I3177e45564860897528da6d7fbcbe346d3bd1c75
Reviewed-on: https://gerrit.libreoffice.org/24338
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:10:04 +00:00
Ashod Nakashian
56cf69c47f loolwsd: unittest to kill all children before loading
Change-Id: I90f28b792c56b9659c04bcc89042455a8a37b8fa
Reviewed-on: https://gerrit.libreoffice.org/24337
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:01:44 +00:00
Ashod Nakashian
bb8beee8e9 loolwsd: refactored killing of LoKit processes in unittests
Change-Id: Ia41adc977252049b1cd7d8936f0c4c8380516030
Reviewed-on: https://gerrit.libreoffice.org/24336
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:00:40 +00:00
Ashod Nakashian
2b5ecbd945 loolwsd: validate child and spawn new ones before using
Change-Id: Icf7c8a2c0fa6c455cea4a65207f1727638169a28
Reviewed-on: https://gerrit.libreoffice.org/24335
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:00:19 +00:00
Ashod Nakashian
08222c791f loolwsd: cosmetics
Change-Id: Ic5398c2ccacad24bef898ba502e5bd1bb0f26c00
Reviewed-on: https://gerrit.libreoffice.org/24334
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 16:57:10 +00:00
Ashod Nakashian
48bdc1e97a loolwsd: silence unused-result gcc error
Change-Id: Ide71b0b585a2b822cedc93e0b4aae11ab4aa1b34
Reviewed-on: https://gerrit.libreoffice.org/24333
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 16:55:29 +00:00
Ashod Nakashian
08b31ac3f5 loolwsd: simplified and improved synching re-activating clients
Change-Id: Idc07aecb33b350a0434c4310a0991a9b2ff1d738
Reviewed-on: https://gerrit.libreoffice.org/24323
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-23 18:12:58 +00:00
Michael Meeks
8f7eed639c Re-factor tile subscription logic.
Move the logic into the TileCache, simplify the API, and
internalize the lock. This should be a plain re-factor.
2016-04-23 18:03:42 +01:00
Michael Meeks
2c2504a073 Time stamp subscriptions to tile rendering. 2016-04-23 18:03:42 +01:00
Henry Castro
3d8285976d loolwsd: send part hash codes to the client 2016-04-23 11:42:12 -04:00
Henry Castro
415b265b6b loolwsd: update bundled headers 2016-04-23 11:38:49 -04:00
Ashod Nakashian
6789550cd9 No need to send invalidatetiles to the client on becoming active
The invalidatetiles is normally a notification coming from
LOK and it signifies that the tiles in quesion need
rendering anew. Issuing this internally from the Kit
removes TileCache images unnecessarily.

Furthermore, since this message is always sent in response
useractive message, there is no need in issuing it from
WSD when loleaflet is perfectly capable of issuing it
itself (internally).

Change-Id: Ia97de6d803745dca3f6e73100f2d921dbbdf76f6
Reviewed-on: https://gerrit.libreoffice.org/24316
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-23 13:29:07 +00:00
Tor Lillqvist
f46855eb25 It is not a cause for warning if we are removing a file
Use info() instead. Also, only log the info if the file actually
existed and was removed. We don't want misleading noise logging about
removing files that were not there. Use std::remove() directly to
avoid unnecessary layers that just make it harder to know whether the
removal worked or not.
2016-04-22 17:50:25 +03:00
Tor Lillqvist
c80b7388ed The JS client never sends any 'invalidatetiles' 2016-04-22 17:50:25 +03:00
Tor Lillqvist
7d2a1d9048 I always keep doing 'make cache-clean' 2016-04-22 17:50:25 +03:00
Tor Lillqvist
bff5748cd9 No need to have separate "editing" and "persistent" tile caches
All changes are supposed to be persistent. This simplifies the tile
caching code quite a lot.

The TileCache object no longer needs to keep any state whether the
document is being edited or whether it has been modified without
saving etc.

Update the modtime.txt file after saving the document. Otherwise the
tile cache would wrongly be considered invalid next time.

As a sanity check, we put a flag file 'unsaved.txt' into the cache
directory whenever we get a callback that indicates the document has
been modified, and remove it when the document is saved. If the flag
file is present when we take an existing tile cache into use, we can't
trust it.

Even after these changes, we still don't use an existing tile cache as
much (or at all?) as we could, though. The INVALIDATE_TILES EMPTY
callback that LO does early on in a conection causes us to remove all
cached tiles...
2016-04-22 17:49:39 +03:00
Tor Lillqvist
b0cfa35018 Remove accidental superfluous indentation 2016-04-22 13:26:32 +03:00
Tor Lillqvist
4aaf70bf8e The logging goes to stderr, not stdout
Check whether stderr goes to a terminal, not whether stdout does.
2016-04-22 13:24:35 +03:00
Michael Meeks
60ffc8aa6b Avoid tile subscription loop, and elide redundant tile subscriptions. 2016-04-22 07:58:31 +01:00
Miklos Vajna
0833a99b37 TileCache: avoid copying these for each invocation
Change-Id: Icaf84699d7f54f2f977162a040aed1f4090f680d
2016-04-22 08:39:16 +02:00
Ashod Nakashian
3a4c02b71d loolwsd: track important notifications not sent to inactive clients
These notifications are important to be sent once the user
becomes active again to sync their view with the latest.

Change-Id: Id8f9fff83eea888cdcc8d6ed1d4f12111de39a6e
Reviewed-on: https://gerrit.libreoffice.org/24288
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-22 04:36:51 +00:00
Ashod Nakashian
bde67c9934 loolwsd: track document modified state to avoid unnecessary auto-saving
This also avoids the feedback loop that results from the kit
thinking the previously inactive client is now active and
sending commands (.uno:Save).

Change-Id: I47074b35a922da15592d550032d494ba1efab83e
Reviewed-on: https://gerrit.libreoffice.org/24287
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-22 04:36:02 +00:00
Ashod Nakashian
f83cc22db9 Documentation update for 'useractive' and 'userinactive'.
Change-Id: I4e2f0923aa5d0f35c29c752b144e23b365e73bb0
Reviewed-on: https://gerrit.libreoffice.org/24279
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-21 13:03:06 +00:00
Tor Lillqvist
232499f542 Add test that simultaneously requested tiles indeed were rendered just once
This test requires the renderid parameter to be present in the 'tile:'
response messages, and that is the case only when ENABLE_DEBUG, so we
can run the test only in a debug build.
2016-04-21 12:50:24 +03:00
Tor Lillqvist
95278b8643 Don't just re-use the 'tile:' response as a 'tile' request
In a debug build it contains also the parameter renderid. (And in the
future, might be extended in other ways, too.) Construct a new request
message that has exactly and only the parameters we want.
2016-04-21 12:42:53 +03:00
Tor Lillqvist
d446822fb3 Add some more logging for tile cache management 2016-04-21 12:42:53 +03:00
Jan Holesovsky
06366c2e4c Fix build. 2016-04-21 11:36:47 +02:00
Andras Timar
a6969c8827 document --admincreds and --allowlocalstorage in loolwsd.service 2016-04-21 11:22:22 +02:00
Andras Timar
745edddbe8 spec file extended for Fedora/CentOS 2016-04-21 10:14:29 +02:00
Miklos Vajna
9059774e64 LOOLTool: fix potential memory leak
Change-Id: Ib1c9bb5cbbef709882580de40500c1a9c8f70e4a
2016-04-21 08:37:27 +02:00
Ashod Nakashian
5fbaa8f3d2 loolwsd: useractive and userinactive command support
loleaflet can now send userinactive when the user
has switched tabs or the browser window loses
focus. Similarly, it can send useractive when
focus is regained.

Change-Id: Id3186949b10a8263e29ada1a790d3123a79e8f08
Reviewed-on: https://gerrit.libreoffice.org/24272
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-21 05:31:18 +00:00
Henry Castro
40daf0185a loolwsd: test: discovery 2016-04-20 23:09:04 -04:00
Henry Castro
11fbb33b56 loolwsd: test: simulate lokit crash test 2016-04-20 21:14:51 -04:00
Michael Meeks
9d913f986b Use size_t for iterating tokens. 2016-04-20 20:47:00 +01:00
Tor Lillqvist
5a509f9211 In a debug build, say in the tile: reponse also whether it was found in cache
Also, do the construction of the response string in
MasterProcessSession::sendTile() only when it is actually going to be
used.
2016-04-20 18:54:18 +03:00
Tor Lillqvist
842525c25c Guard against mixing up cout output from separate threads 2016-04-20 18:54:18 +03:00
Tor Lillqvist
77a91c4b2e In debug builds append a renderid=<unique-id> token to tile: responses
Will be used in unit test to verify that several clients of the same
document asking for the same tile simultaneously indeed do cause just
one tile rendering to take place.
2016-04-20 18:54:17 +03:00
Tor Lillqvist
7b47548020 Add getToken* variants that iterate over a StringTokenizer
If any of the tokens in the string matches name=<value> for the name
in question, store that value and return true. Otherwise return false.
2016-04-20 18:54:17 +03:00
Tor Lillqvist
d423f7c2fd Add Util::UniqueId() to get a string id that is unique across processes and calls 2016-04-20 18:54:17 +03:00
Tor Lillqvist
e94e8344ad IIUC, the 'tile' and 'tile:' messages have an optional timestamp parameter 2016-04-20 18:54:17 +03:00
Tor Lillqvist
9499071707 Change comment to make sense 2016-04-20 18:54:17 +03:00
Andras Timar
028becc511 error: unused parameter ‘part’ [-Werror=unused-parameter] 2016-04-20 13:00:43 +02:00
Jan Holesovsky
97342a2817 bccu#1653: Make the .html's, .css's and .js's versioned.
It is still possible to access them directly via loleaflet/dist/<something>,
but such use can lead to unexpected behaviour due to various caching in the
browsers etc.
2016-04-20 12:58:10 +02:00
Michael Meeks
a47355db2f Expand use of the TileBeingRendered structure.
Implement this for tilecombine, and do tile writes in each client's
thread separately. Add env-var. to trigger sleep, and tune it to 1
second; easily long enough to exercise this code-path.
2016-04-20 11:14:18 +01:00
Andras Timar
14458095ad README: loolwsd's --test option was binned 2016-04-20 12:00:46 +02:00
Andras Timar
59aa99d08d typo: consistenly -> consistently 2016-04-20 11:51:28 +02:00
Andras Timar
f0549f8ba1 document --disable-ssl and related stuff 2016-04-20 11:48:12 +02:00
Tor Lillqvist
2d74d65578 Rant about the duplicate specification of document URI, GET and 'load' 2016-04-20 10:35:38 +03:00
Miklos Vajna
5e2937bf79 Log: strcpy -> strncpy
Change-Id: I2929ad46b422e6e55e198064c2930028df844630
2016-04-20 09:10:30 +02:00
Andras Timar
090c246be4 bccu#1696 - enable WOPI connection from the same host (by IP address) by default 2016-04-19 15:32:34 +02:00
Tor Lillqvist
f825fea9db operator '?:' has lower precedence than '+'; '+' will be evaluated first 2016-04-19 16:21:55 +03:00
Tor Lillqvist
bf6dd4e291 Typo 2016-04-19 16:17:58 +03:00
Pranav Kant
79b21598d5 admin console: Handle spaces in filenames
Change-Id: Id63189e5a58e023669304438784d30c6ec48a1c2
2016-04-19 16:38:08 +05:30
Tor Lillqvist
d5bb373447 Improve efficiency when multiple clients of same doc ask for same tile(s)
Keep track of tiles being rendered in TileCache, and when asked to
render the same tile as is already being rendered, just "subscribe" to
the existing ongoing rendering. When a tile has been rendered and is
being sent out to clients, check if there are "subscriptions" and send
it to them, too.

One problem is that if the client that caused a tile rendering to be
initiated goes away before the rendering has completed, it will never
complete, and the subscribers are left without the tile.

Change-Id: Icca237876a0f466c29eb5bf60ffd4da3d9d68600
Reviewed-on: https://gerrit.libreoffice.org/24228
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 10:51:45 +00:00
Andras Timar
fb7de5df8e we need key.pem for admin console in http-only case too 2016-04-19 12:11:37 +02:00
Andras Timar
4864fac25a enable default admin/admin optionally (e.g. for CODE VM) 2016-04-19 12:11:37 +02:00
Pranav Kant
3e93a212f0 loolwsd: Admin console unit tests
Change-Id: Id0baa51c2adb14b77080b5acd2abf0658ee54b2b
2016-04-19 14:40:03 +05:30
Pranav Kant
3111c5c6d1 loolwsd: Use common method to send websocket messages
Will help in placing unit test hooks to better test the admin
console

Change-Id: Ic4daae685a8fe493a0395d94e40112bf119c93e3
2016-04-19 14:39:50 +05:30
Pranav Kant
56d18909d5 loolwsd: Remove unused code
Change-Id: I7edf6b8d4f83f2cf9f85a2075d1dca216cda3d34
2016-04-19 14:39:50 +05:30
Andras Timar
69c156e6dd bccu#1696 enable WOPI connection from the same host by default 2016-04-19 10:17:50 +02:00
Miklos Vajna
55f18b4038 loolwsd: fix -Werror=shadow 2016-04-19 09:35:36 +02:00
Miklos Vajna
17de53981e Storage: fix missing underscore for non-static members
Change-Id: Ibde55358c9640344e8bb4e6e24b287b1e7d8c6b5
2016-04-19 09:10:28 +02:00
Ashod Nakashian
f62f336d5c loolwsd: fix typo in config
Change-Id: I27618137bb0b6a7162c1a03806942ee0033be74e
Reviewed-on: https://gerrit.libreoffice.org/24234
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 01:44:15 +00:00
Ashod Nakashian
23003c455c bccu#1696 - enable WOPI connection from the same host by default
Since auto-discovery is problematic, this patch implements
support for both regex patterned hostnames/IPs to allow,
and those to block/deny.

A hostname/IP must be both allowed, and not denied, to
be accepted.

By setting ranges of allowed hostnames/IPs, and others
to block/deny, an admin can configure Online with
great flexibility.

Defaults updated with same values, but not exhaustive.

Change-Id: Iedfcafe41d07d905b549fb450c3fe625ad44599e
Reviewed-on: https://gerrit.libreoffice.org/24233
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 01:41:51 +00:00
Ashod Nakashian
3878f3b515 loolwsd: initialization and resetting support in RegexListMatcher
Change-Id: Ic262cf9e4a21d30b6dfd9d9fc0d895f89d7d8e7b
Reviewed-on: https://gerrit.libreoffice.org/24232
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 01:41:00 +00:00
Ashod Nakashian
7d65e30595 loolwsd: regex matching class against whitelist/blacklist
With unittests.

Change-Id: Ibb14c493cc6de61b6497ab84e34e105481afe464
Reviewed-on: https://gerrit.libreoffice.org/24231
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 01:40:37 +00:00
Henry Castro
c29944a386 loolwsd: fix close after close
The closing handshake.
Either peer can send a control frame with data containing
a specified control sequence to begin the closing handshake.

Upon receiving such a frame, the other peer sends a
Close frame in response, if it hasn't already sent one.
2016-04-18 20:27:27 -04:00
Tor Lillqvist
5c0788254b Add "exit" command and comment syntax to input files for the 'connect' program 2016-04-18 21:31:57 +03:00
Tor Lillqvist
bbcc70c69f Add debug hack to intentionally slow down tile rendering
When compiled with --enable-debug, when requesting a tile for part=42,
actually use part=0, and sleep five seconds before passing the
rendered tile back up. This makes it easier to debug handling of
simultaneous requests for the same tile from multiple clients.
2016-04-18 18:29:47 +03:00
Tor Lillqvist
d012075dc8 Sanity check 2016-04-18 16:40:28 +03:00
Andras Timar
59944636b0 allow="true" attribute has to be written out 2016-04-18 15:37:30 +02:00
Tor Lillqvist
f769474d25 The "unload" message is not implemented and likely won't be 2016-04-18 15:39:51 +03:00
Tor Lillqvist
a08b2a0e0b Just use "/" instead of Poco::Path::separator() 2016-04-18 15:34:34 +03:00
Tor Lillqvist
311a748d45 Clean up jails of exited loolkit processes sooner
In loolforkit, whenever we have forked a new loolkit, also check if
any previously forked children have exited. Remove the jails of
those. (The loolkit process itself does not even try to remove all of
its jail, see 3aadd910c6e32c0e557671effa5a4c606cd6e8bf.)

In order to be able to notice exited child processes in loolforkit, we
no longer can set the action for SIGCHLD to SIG_IGN. That means that
exiting loolkit processes will be in the zombie state until loolforkit
picks up their exit status. As loolforkit does this check only in
connection with forking a new child, zombie loolkit processes will
hang around for some time, until the next loolkit process is
forked. Not sure if this is a problem.

countLoolKitProcesses() in httpwstest now needs to skip zombies.

Loolwsd still takes care of removing whatever jails are left when it
finishes.
2016-04-18 14:30:09 +03:00
Tor Lillqvist
3aadd910c6 We can't remove jailPath when inside the chroot as it does not exist there
When inside the chroot, what we would need to do is remove everything
below / . But doing that is a bit too risky, in case some developer
screws up some detail and that code happens to run outside the chroot
after all, and the developer's machine gets trashed. So just remove
paths we can reasonably assume won't exist as global pathnames on a
developer machine: loSubPath and JAILED_DOCUMENT_ROOT.

Currently the actual complete cleanup of loolkit jails happens in
loolwsd when it is exiting. That is a bug and will have to be
fixed. It should be done in loolforkit as soon as possible after the
loolkit process has exited.
2016-04-18 13:18:39 +03:00
Andras Timar
6eaece12e1 package looltool 2016-04-18 10:31:31 +02:00
Andras Timar
4fd2354bc0 Add missing headers to dist tarball 2016-04-18 10:30:32 +02:00
Tor Lillqvist
996898f9ce The default number of preforked loolkit processes is actually just one
At least, that is the value of the num_prespawn_children element in
the loolwsd.xml as shipped. But maybe that is not what is meant with
"default"? It is unclear to me what the "default" attribute means.
2016-04-18 09:52:25 +03:00
Tor Lillqvist
70c7ca5a57 The --nocaps option does not take an argument 2016-04-18 09:49:21 +03:00
Tor Lillqvist
16e4ad5fc5 The 'loadtest' programs can surely die 2016-04-18 09:43:39 +03:00
Tor Lillqvist
c6941c71c6 Bin a few unneeded #includes and usings 2016-04-18 09:43:39 +03:00
Miklos Vajna
0f82a3a6ae loolwsd: fix -Werror,-Wshadow
Change-Id: I33095de03e5f3df3ed8919121f6a078f80c26ae9
2016-04-18 08:41:19 +02:00
Miklos Vajna
b1b947cfb3 loolwsd: fix -Werror,-Wlogical-not-parentheses
Change-Id: I035347339cf789e49994640b03f239a3e161f9b7
2016-04-18 08:40:03 +02:00
Ashod Nakashian
385359824a loolwsd: unittest to validate correct doc reloading while unloading
Change-Id: Id956fc9e243c44ecd3914b448ab92f87e011d3ee
Reviewed-on: https://gerrit.libreoffice.org/24185
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:37:54 +00:00
Ashod Nakashian
b933988a59 loolwsd: flag and wait if document is unloading before relaoding
When a new view is created on a document that is
in the process of unloading, all sorts of things
can go wrong. This is especially problematic when
the document needs to be saved before unloading,
which takes significantly longer than otherwise.

Change-Id: Ib33a18cafa9d5a3a17f6bd8c6145f9331ae54044
Reviewed-on: https://gerrit.libreoffice.org/24184
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:36:45 +00:00
Ashod Nakashian
892358e5cb loolwsd: new Admin API to remove documents
Normally, when each client view closes, the
session count is decremented until the last
view is closed. However this doesn't work
when the kit child process terminates.

Due to a race condition between the last
client disconnecting, and the internal
structure destructing, and the next
client connecting (on the same doc),
the Admin loses track of the doc and pid.

This is an issue of assuming a document
and its pid are unique and will always
remain unchanged.

This patch adds a new API to remove a
doc and all its views unconditionally
to try to avoid the above issues.

Change-Id: I0c181260679875b0464dd9b6548b29b8d6a361f7
Reviewed-on: https://gerrit.libreoffice.org/24183
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:35:29 +00:00
Ashod Nakashian
52959b7289 loolwsd: admin cleanups
Change-Id: Ib8a488ef08d345f768323e1303f7a053e54464d5
Reviewed-on: https://gerrit.libreoffice.org/24182
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:34:54 +00:00
Ashod Nakashian
53a2e3ba42 loolwsd: save on disconnection test enabled and functional
Change-Id: I604b0826674e981136ca7f8a9169a20eed9597d3
Reviewed-on: https://gerrit.libreoffice.org/24181
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:34:10 +00:00
Ashod Nakashian
2ee7d35fb8 loolwsd: reload test now actually reloads same document
Change-Id: I2ff724d3a3566f5fcb010ce46a6749e517afccd2
Reviewed-on: https://gerrit.libreoffice.org/24180
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:33:41 +00:00
Ashod Nakashian
7399f82b4e loolwsd: std::exit -> std::_Exit in forkit
Change-Id: I68af331440d95811f1d50c95de470350c0b6a4a3
Reviewed-on: https://gerrit.libreoffice.org/24179
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:33:12 +00:00
Ashod Nakashian
8af52337a5 loolwsd: clean and quick shutdown
Change-Id: Idfac3a27d19dd0a1b141d95a62c9e3453bd399a1
Reviewed-on: https://gerrit.libreoffice.org/24166
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 16:13:18 +00:00
Ashod Nakashian
a000a1e274 loolwsd: forkit exits without cleanup to avoid LO Core assertions
Change-Id: Ic9033b7d33f2ef114615950f01eab5904faa2ca7
Reviewed-on: https://gerrit.libreoffice.org/24165
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 16:12:49 +00:00
Ashod Nakashian
882ffafb16 loolwsd: simplified ChildDispatcher
Change-Id: I5b61678a01f4491ca06a25dd969f7538b4c8445d
Reviewed-on: https://gerrit.libreoffice.org/24164
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 16:12:30 +00:00
Ashod Nakashian
b420b70154 loolwsd: gitignore loolforkit-nocaps
Change-Id: Ide73478726c0341d2679053650b3c89ec7c8dc94
Reviewed-on: https://gerrit.libreoffice.org/24163
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:27:13 +00:00
Ashod Nakashian
8b5d702acb loolwsd: testBadRequest actually provokes connection error
Change-Id: Ibf12b6b45d6eb34e031ab689983ab3599a58caef
Reviewed-on: https://gerrit.libreoffice.org/24162
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:27:00 +00:00
Ashod Nakashian
ea223f14d2 loolwsd: storage validation should throw BadRequest on failure
Change-Id: I8e9eca96e3e9cef7391a74d72db806e6d1085b01
Reviewed-on: https://gerrit.libreoffice.org/24161
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:26:38 +00:00
Ashod Nakashian
a70c5300b1 loolwsd: childConnected event added to UnitWSD
Change-Id: I3d19465229b434d07f50290f08462e9c9c66a6ca
Reviewed-on: https://gerrit.libreoffice.org/24160
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:26:09 +00:00
Ashod Nakashian
b50a7d507c loolwsd: wopi trusted hosts are stored in set to warn about conflicting config
Change-Id: If27e173ffee753e655057d8516f4f3b3ecda5d3b
Reviewed-on: https://gerrit.libreoffice.org/24159
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:24:58 +00:00
Ashod Nakashian
372baaf427 loolwsd: cleanup of DocumentBroker session management
Improved session add/remove API.
Reduced mutex count.
Renamed members and variables.
Added documentation.

Change-Id: If15991971484d4d508714c9436a51b291f42079f
Reviewed-on: https://gerrit.libreoffice.org/24158
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:23:53 +00:00
Ashod Nakashian
0cf179ba57 loolwsd: run_unit.sh now finds abs_top_builddir and executes using bash
Change-Id: I3a341f5508ecf4cda51cc526d38d09cdbcaf09ff
Reviewed-on: https://gerrit.libreoffice.org/24157
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:20:43 +00:00
Ashod Nakashian
ea83ed2374 loolwsd: configuration manipulation UT hook added
Change-Id: If5ab75ee3630e629179dfc8d3c3374795bd2a221
Reviewed-on: https://gerrit.libreoffice.org/24156
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:20:14 +00:00
Henry Castro
0a92e02339 loolwsd: test: update changes to WebSocketErrorMessageException 2016-04-17 08:42:07 -04:00
Michael Meeks
6388298a04 Attempt at a --nocaps argument to run with no caps, ie. under valgrind. 2016-04-16 20:47:55 +01:00
Ashod Nakashian
a76e9a2b21 loolwsd: check WOPI host against configured whitelist and cleanup factory
Change-Id: I1dd45a9b1332754a33b2f190b7f6244e8e3b1dff
Reviewed-on: https://gerrit.libreoffice.org/24136
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:58:18 +00:00
Ashod Nakashian
115e654d63 bccu#1648: Limit trusted WOPI hosts
Control allowed/trusted wopi hosts from config.

Change-Id: I730b4be8ef0d47bdb5e490926486184777de4eb0
Reviewed-on: https://gerrit.libreoffice.org/24135
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:58:01 +00:00
Ashod Nakashian
a9f58e2657 loolwsd: log Storage construction to identify concrete backend
Change-Id: I0bcb0d08bccd1551abc7c2ffdf79d8f6154dc880
Reviewed-on: https://gerrit.libreoffice.org/24134
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:57:14 +00:00
Ashod Nakashian
33854ec4ac loolwsd: cleanup and improve WSD request handlers
Standardized error handling in request-handlers.

There is a new family of internal exeptions designed
to signify the type of error and how to handle it.
All handlers must throw one of those errors
and they will be translated to the correct HTTP
response when caught.

Since some requests send a response as part of their
handling (convert-to, for example) those handlers
must return a flag signlaning whether or not they
sent a response. If not, HTTP OK response is sent
at the end of the handler.

To complicate things, some requests upgrade the
connection to WebSocket. In those cases errors
must be sent via the WebSocket and not as an
HTTP response. The error message sent can (and
in most cases should) be displayed to the end-user.

A new file, UserMessages.hpp, has been added to
hold user-visible messages that can be
reviewed and translated.

Change-Id: Icc725f3313446d4514cf6d092635158ee7171f5d
Reviewed-on: https://gerrit.libreoffice.org/24133
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:56:55 +00:00
Henry Castro
a66e73aeb0 loolwsd: fail when document broker cannot get a child 2016-04-16 13:32:44 -04:00
Ashod Nakashian
4254ddad77 loolwsd: consistently set HTTP status and reason everywhere
Change-Id: Ie538e4907e3a3a514918000bb585d2aaf182e468
Reviewed-on: https://gerrit.libreoffice.org/24132
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:29:35 +00:00
Ashod Nakashian
fe952794f0 loolwsd: don't expose private members
Change-Id: I049c92d0ddb296058fad283fffc291348b4608b1
Reviewed-on: https://gerrit.libreoffice.org/24131
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:29:11 +00:00
Ashod Nakashian
93d3f806e1 loolwsd: logging and cosmetics
Change-Id: I413a2e40f480ba41e37c7442724c3f037528f89b
Reviewed-on: https://gerrit.libreoffice.org/24130
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:28:45 +00:00
Ashod Nakashian
c2560725db loolwsd: admin uses config for ssl key
Change-Id: I38b0f59c158698a6eb89d4b671001e1d8cb61673
Reviewed-on: https://gerrit.libreoffice.org/24129
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:27:43 +00:00
Michael Meeks
69816395d5 Re-enable verbose tracing during unit testing. 2016-04-15 22:04:15 +01:00
Michael Meeks
448e25f6d8 Make logging signal safe again. snprintf: simpler, safer, faster. 2016-04-15 21:53:10 +01:00
Michael Meeks
65ee749ce1 Move new unit tests to custom test driver.
Cleaner, and avoids bogus warnings during compile.
Merge run_test.sh.in into a mode of run_unit.sh - gives the
chance for nice debug output etc.
2016-04-15 21:52:39 +01:00
Michael Meeks
ebfa339da0 Cleanup symlinking and add realpath symlink if necessary. 2016-04-15 16:17:04 +01:00
Tor Lillqvist
b1aa059bc3 I don't have any ~/.fonts 2016-04-15 17:19:04 +03:00
Tor Lillqvist
947f8bcf13 Test number of loolkit processes also before and after the HTTPPostTest suite 2016-04-15 17:13:47 +03:00
Michael Meeks
a49f642801 Tolerate --version, and add git hash version, print on default start.
Should help diagnosing issues - to have this in our logs.
2016-04-15 15:07:24 +01:00
Michael Meeks
7376b7475e Font bits: create symlink in jail at OS instdir path, to point at /lo
This ensures that bundled fonts in instdir/share end up resolved to
the same path that they were in when the forkit font config was setup.

It may also help locate other pre-inited resources.

Also copy in ~/.fonts in debug mode - can't hurt.
2016-04-15 14:35:57 +01:00
Michael Meeks
ab6cc4135b Copy fonts into systemplate from libreoffice install. 2016-04-15 14:23:44 +01:00
Michael Meeks
b5e37448a8 looltool: get argument array copyies right. 2016-04-15 13:55:34 +01:00
Ashod Nakashian
7df929cb77 loolwsd: use SocketProcessor in kit
SocketProcessor doesn't need to take response
instance, since by the time it is called we
are already upgraded to WebSocket and it's
too late to set a request-level status.

Change-Id: Id95087e60354a50148c88427130613356679cf82
Reviewed-on: https://gerrit.libreoffice.org/24110
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 11:54:30 +00:00
Ashod Nakashian
df47ff1b2f loolwsd: .gitignore updated
Change-Id: Ica74b3f6f2fd9e3f9d75f41f2f780010b9b9bc55
Reviewed-on: https://gerrit.libreoffice.org/24109
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 11:53:57 +00:00
Ashod Nakashian
cf85f51850 loolwsd: tabs -> spaces
Change-Id: I581346970321446378ff135e0227e06a2092b39f
Reviewed-on: https://gerrit.libreoffice.org/24108
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 11:53:42 +00:00
Tor Lillqvist
5782e0b04c TileCache::lookupTile() already returns non-null only if the stream is open
No need to test at call sites. We can assert() as a sanity check
though.
2016-04-15 14:12:35 +03:00
Tor Lillqvist
ecaaab6e90 Default values for bool parameters make the code harder to read
In this case we always passed the parameter anyway.
2016-04-15 13:17:20 +03:00
Pranav Kant
cca858732a loolwsd: Allow admin console to kill documents (again)
Change-Id: I30405854e9ebdc56ab3477758e9008963d4b8efa
2016-04-15 15:25:01 +05:30
Tor Lillqvist
6ca6bf0da6 Rant about over-use of variables where literals would work 2016-04-15 12:26:56 +03:00
Pranav Kant
382da839e0 Add documentation about takeedit
Change-Id: I600046111d2478f1c02552d3caa60d2a50fa7c98
2016-04-15 14:48:58 +05:30
Pranav Kant
91c6154fc0 loolwsd: Use docKey as key for Admin instead of PID
Also change some variable names to be consistent with rest of the
coding style.

Change-Id: Icca9a9aec9bfb34c1edd5b6533d7646b05fe814f
2016-04-15 14:42:14 +05:30
Pranav Kant
7bf5e84a90 loolwsd: Make admin console work (again)
Change-Id: Ib51f33c60b5e42e154795357a7a787cb8691ad51
2016-04-15 13:28:42 +05:30
Pranav Kant
4f9eef9324 loolwsd: Be consistent, and use unique_lock
Change-Id: Idfc14bb7dd82827493865241f6d04cf9ae4a88fc
2016-04-15 13:28:42 +05:30