Commit graph

1802 commits

Author SHA1 Message Date
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
Pranav Kant
9669470d09 loolwsd: Admin doesn't need its own thread now
The timers are cancelled upon destruction of the static Admin
instance.

Change-Id: Ie43dc9d3ec96b002e12685ec997ad83c29b684d0
2016-04-15 13:28:42 +05:30
Tor Lillqvist
5c41d4c5ed -Werror=maybe-uninitialized 2016-04-15 10:53:06 +03:00
Miklos Vajna
0a92e811dc Storage: const auto -> const auto& where it would create a tmp copy
Change-Id: I0ec42200e19654ee2e1c9b0fc293668847a5b965
2016-04-15 08:49:35 +02:00
Henry Castro
39180a0e22 loolwsd: test: add connectLOKit
Connecting to a Kit process is managed by document broker, that it does several
jobs to establish the bridge connection between the Client and Kit process,
The result, it is mostly time outs to get messages in the unit test and it could fail.
connectLOKit ensures the websocket is connected to a kit process.
2016-04-14 21:54:36 -04:00
Ashod Nakashian
0b4b3c73d5 loolwsd: tile cache cleanup
Change-Id: Ib2abec83fd4866c09b30507c11a809d682c2f819
Reviewed-on: https://gerrit.libreoffice.org/24100
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 01:08:37 +00:00
Ashod Nakashian
322a3c1afe loolwsd: logging moved to own files
Change-Id: Idf1dd91cf37675e1bea8aeb5d9e8cf6d2ac9a725
Reviewed-on: https://gerrit.libreoffice.org/24099
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 01:07:13 +00:00
Ashod Nakashian
e5595509fd loolwsd: cosmetic cleanup
Change-Id: I02f3ab1778db462376b7563e7e8b0abeebd2e8a1
Reviewed-on: https://gerrit.libreoffice.org/24098
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 01:04:47 +00:00
Michael Meeks
fe684cc71d looltool: implement destdir, and fix parallelism. 2016-04-14 21:41:09 +01:00
Michael Meeks
444adc976d looltool cleanup add --no-check-certificate option too. 2016-04-14 20:44:02 +01:00
Michael Meeks
53c60b2842 Magic to cleanup autotools module linking of unit tests. 2016-04-14 18:58:18 +01:00
Michael Meeks
688d1ab6e6 Remove confusing ChildProcessSession include on LOOLWSD.
Move the ClientPortNumber into both Kit and WSD.
2016-04-14 18:58:18 +01:00
Michael Meeks
d817fc2c69 Simple command-line tool for file format conversion. 2016-04-14 18:58:18 +01:00
Andras Timar
1f7da1f5a2 loolwsd: install and package SSL key and certs if SSL is enabled 2016-04-14 18:47:50 +02:00
Henry Castro
bea5963aa7 loolwsd: avoid time out exception 2016-04-14 12:00:32 -04:00
Henry Castro
d11bd69c26 loolwsd: wait prison session until the peer is assigned
Some messages are not forwarded to the client session, this is caused
by the time the client session is assigned, the prison session,
it is already forwarding to not assigned peer session.
2016-04-14 11:41:15 -04:00
Andras Timar
8f93a5f526 merge loleaflet and loolwsd rpm packages 2016-04-14 17:08:52 +02:00
Tor Lillqvist
fe5f238c08 Exit when receiving an *unexpected* CLOSE frame
Otherwise we will just keep waiting for a line on input from stdin,
which is unhelpful.
2016-04-14 17:45:51 +03:00
Tor Lillqvist
066b48688a Use the 'expected' and 'actual' parameters of CPPUNIT_ASSERT_EQUAL() correctly 2016-04-14 17:07:55 +03:00
Tor Lillqvist
2edf15a18b Use CPPUNIT_ASSERT_EQUAL() to get expected and actual values into output 2016-04-14 17:05:09 +03:00
Andras Timar
2e0d895485 loolwsd: define sysconfdir for deb package 2016-04-14 15:26:51 +02:00
Andras Timar
ea94e957c1 loolwsd: rpm install of config files 2016-04-14 15:14:59 +02:00
Andras Timar
a8601804ac loolwsd: process loolwsd.xml.in 2016-04-14 15:06:49 +02:00
Andras Timar
a9fb211118 loolwsd: move loolwsd.xml to loolwsd.xml.in 2016-04-14 14:59:27 +02:00
Andras Timar
ec9aa4a50f loolwsd: fix SSL certs/key install 2016-04-14 14:50:48 +02:00
Andras Timar
1f560af63a loolwsd: discovery.xml to datadir 2016-04-14 14:43:31 +02:00
Andras Timar
b3e610eba0 loolwsd: do not install unit test shared libs 2016-04-14 14:43:31 +02:00
Tor Lillqvist
0140b1cd43 Always define ENABLE_DEBUG and _SSL in config.h, as 1 or 0
Correspondingly always use #if, not #ifdef, to test.
2016-04-14 13:43:31 +03:00
Andras Timar
60c969cd77 add security.h to tarball 2016-04-14 12:35:50 +02:00
Andras Timar
24bc458741 define LOOLWSD_CONFIGDIR and LOOLWSD_DATADIR 2016-04-14 12:34:11 +02:00
Jan Holesovsky
1e58864230 Revert unwanted change of hello.odt, and prevent that from happening again. 2016-04-14 11:40:17 +02:00
Pranav Kant
5d8e627ca4 loolwsd: Allow 'downloadas' for all kinds of views
... irrespective of whether the editlock is taken or not.

Change-Id: I159f78fb4c58c973458ae2c5bc53e844de689e14
2016-04-14 15:08:01 +05:30
Jan Holesovsky
7d64501479 Allow setting the server name and port in loolwsd.xml. 2016-04-14 11:13:55 +02:00
Tor Lillqvist
1bd6cdde3b Util::getSignalStatus() is unused
Good, its semantics was a bit odd anyway.
2016-04-14 11:39:42 +03:00
Michael Meeks
b3f17462eb Fix ENABLE_SSL AC_SUBST. 2016-04-14 09:34:52 +01:00
Michael Meeks
35b27b352c Initial font unit test. 2016-04-14 09:34:52 +01:00
Tor Lillqvist
c7d0067969 Util::getChildStatus() is unused
Good, now the odd LOOLExitCode can go away, too.
2016-04-14 11:30:28 +03:00
Miklos Vajna
63d9112977 MasterProcessSession: const auto -> const auto& where it would create a tmp copy
Change-Id: I5bbffb9be562b52f868bfca3f825e8d81dae4eef
2016-04-14 08:36:56 +02:00
Henry Castro
096f7db6d0 loolwsd: report indicator status before websocket is ready 2016-04-13 14:42:46 -04:00
Jan Holesovsky
efb67d68fd The host= parameter for loleaflet.html does not exist any more.
Now loolwsd fills that in directly.

Also show http:// or https:// in 'make run' according to the configuration.
2016-04-13 18:42:07 +02:00
Jan Holesovsky
b09b6eab89 Only the access_token (and _ttl) is supposed to be passed via the form post. 2016-04-13 18:32:00 +02:00
Michael Meeks
1eb92c0dc9 Cleanup and aggregate memory stats. 2016-04-13 14:35:30 +01:00
Tor Lillqvist
8d69c09dbc Expand on the 'busy wait' issue 2016-04-13 16:12:53 +03:00
Tor Lillqvist
4087ac8089 With "disconnect" messages gone, no need for a 'reason' to disconnect()
YAGNI.
2016-04-13 15:56:23 +03:00
Tor Lillqvist
c9796255ae Don't check for undocumented "eof" frames read from a websocket either
Now with "disconnect" frames gone, surely checks for "eof" ones can go
away too, whatever they were.
2016-04-13 15:50:09 +03:00
Tor Lillqvist
e5de11113b Don't check for or send "disconnect" frames anywhere and don't document them
Follow-up to 68b3a2c81e.
2016-04-13 15:49:10 +03:00
Tor Lillqvist
db14143d72 Make the loolkit process counting more reliable
Sleep in both places before counting them, and catch Poco exceptions
while counting (can happen for instance when a /proc entry goes away
while we are looking for its 'comm' file).
2016-04-13 15:33:56 +03:00
Pranav Kant
68b3a2c81e Always save irrespective of nature of socket close
Do not distinguish between normal shutdown or abnormal shutdown.
Also remove 'disconnect' frame to indicate normal shutdown.

Change-Id: I98fd9f5a219feb1097c57302dba14e08ad9bf143
2016-04-13 17:35:10 +05:30
Ashod Nakashian
65ee0a1cdd loolwsd: corrected etc file copying
Change-Id: Ie920bbdee38d4b0a338753a6d483e274052939ce
Reviewed-on: https://gerrit.libreoffice.org/24053
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-13 11:49:31 +00:00
Jan Holesovsky
7e67b38832 Add some paranoia... 2016-04-13 13:44:18 +02:00
Jan Holesovsky
484335321f Introduce LOOLWSD::SSLEnabled for runtime, and allow non-SSL access via WOPI. 2016-04-13 13:11:06 +02:00
Tor Lillqvist
726fd1f66d The CPPUNIT_TESTs I added a moment ago should be first and last in the list 2016-04-13 13:22:35 +03:00
Tor Lillqvist
00660cfe3d Sort #includes 2016-04-13 13:19:26 +03:00
Tor Lillqvist
b4ae5192bb bccu#1678: Add cppunit test that no extra loolkit processes are left over
The number of loolkit processes after running the cppunit tests should
be the same as before running them. (At least, that is the intention
at the moment, I think. If/when this changes, the test will have to be
adapted, of course.)
2016-04-13 13:17:43 +03:00
Tor Lillqvist
0f3d98d2d1 Try to use consistent indentation for parameters to SocketProcessors()
But yeah, not sure why the blocks of the lambdas are de-indented like that.
2016-04-13 12:22:19 +03:00
Tor Lillqvist
c8a46e78a8 bccu#1678: Check whether document can be discarded also in stop predicate
Seems to fix the problem that the loolkit processes hang around
forever even if there is no associated client.
2016-04-13 12:17:59 +03:00
Tor Lillqvist
04f3a9e111 It works better to set TerminationFlag
That global flag is checked all over the place, so setting it will
actually make the threads eventually finish. (All polling is done with
timeout, I think, and then checking TerminationFlag whenever the poll
times out.)

Sure, it would be much better to use an eventfd and poll that, too,
instead of timing out from the polls all the time to check a plain old
boolean flag.
2016-04-13 11:49:16 +03:00
Tor Lillqvist
26ceda2f15 More specific message 2016-04-13 11:49:00 +03:00
Miklos Vajna
4fac6c0126 DocumentBroker: can pass these by reference
Change-Id: I327e515e39671239b8699cfadcf61e088af68b13
2016-04-13 10:05:10 +02:00
Tor Lillqvist
8f3ec463b8 Change some cppunit assertion messages to match what is actually being asserted
If you can't come up with a meaningful message to use in a
CPPUNIT_ASSERT_MESSAGE(), just use CPPUNIT_ASSERT() instead. These
messages aren't intended for end-users but for developers, so it is
pointless to make them high-level and dumbed-down.
2016-04-13 09:58:18 +03:00
Pranav Kant
9ea4624839 loolwsd: Handle socket exceptions while trying to send frame
In case of abnormal termination of session from client-side,
we might still have data being processed in the kit process, for
example, during auto-save. Trying to send such data over an
expired socket towards the client would throw exceptions which
need to be handled, otherwise the auto-save process would not be
successful. Further, the unhandled exception can bring the document
broker in an unstable state with dockey still present in the
object.

Also do not send 'editlock: 0' to a websocket session which is
going to be removed because the session might have been
forcefully terminated from the client-side, in which case sending
data would go nowhere.

Change-Id: I10eb9c818bc81d4db26d5a19dc8bd44f6fbdf32c
2016-04-13 09:56:32 +05:30
Henry Castro
6701dc62ce loolwsd: response bad request 2016-04-12 17:45:25 -04:00
Michael Meeks
25a092d7de Add memory accounting metric to UnitPrefork.
Also add hooks to allow custom LOK <-> WSD message for this test.
2016-04-12 21:58:27 +01:00
Henry Castro
87639db612 loolwsd: test: remove temporary files 2016-04-12 14:34:25 -04:00
Henry Castro
c7abd16399 loolwsd: replace CPPUNIT_ASSERT_MESSAGE -> CPPUNIT_FAIL 2016-04-12 13:56:32 -04:00
Michael Meeks
6a990dfb61 Security bits and test cleanup.
Enforce user being 'lool' for setcap binaries loolmount and loolforkit.

Add warnings if configured without --enable-debug.

Developers should pass --enable-debug to configure.
2016-04-12 17:13:56 +01:00