Commit graph

3899 commits

Author SHA1 Message Date
Pranav Kant
8330341a8a Include docurl in document download requests
From
/lool/jailid/randomdir/filename
to
/lool/docurl/jailid/randomdir/filename

Change-Id: I4d58e733768c62f2951ecfdcfcb604d99772862d
2016-09-30 00:33:58 +05:30
Pranav Kant
187abe0018 loleaflet: Remove unused fields
Change-Id: Ide180430cb2d359fa089ded8061af764c4001bb2
2016-09-30 00:33:58 +05:30
Pranav Kant
8c61ee3c94 Change insertfile URI to include doc key in it
From
/lool/insertfile
to
/lool/<docUrl>/insertfile

Change-Id: I63864673bc1d92a737a95b484c2f440cb5ce6605
2016-09-30 00:33:58 +05:30
Pranav Kant
12dee85ef8 Serve all assets (l10n, images etc.) versioned
Rather than accessing them using '/dist/', access them using the
version (git hash) in the url.

Change-Id: I999bd99a13dbf92b26641e3bd5c9e0b7468bb654
2016-09-30 00:33:58 +05:30
Jan Holesovsky
c8a97eb300 Move testTileQueue from WhiteBoxTests to TileQueueTests.
Change-Id: Ib592c425d595e1d3449092bd0b9008c1b857274a
2016-09-29 20:32:25 +02:00
Jan Holesovsky
ae179b8bce Move the TileQueue tests that do not require loolwsd to a separate file.
Change-Id: Iaac51e891a5c34cebc95d7631c95c84ed8aad80e
2016-09-29 20:04:05 +02:00
Tor Lillqvist
86bd8426d0 More work on disk space monitoring
Monitor the disk space on important file systems: The ones where
cached tiles are stored and where the chroot jails are created. Those
might be the same file system of course, the code checks and doesn't
do needless work.

The check is done whenever a new loolkit process is taken into use and
a new chroot jail it constructed, and whenever a new client session
connects to a document. We don't check more often than once a minute,
though.

Still need to add code to guard against running out of diska space
when saving documents back to where they were opened from. For that
presumably need to enhance the Storage abstraction.
2016-09-29 17:54:40 +03:00
Miklos Vajna
6941370d38 Update bundled headers
Change-Id: I51d680910f059ded5fba03d302fd95d822a73c64
2016-09-29 14:16:19 +02:00
Tor Lillqvist
2c93bd6e89 Document the 'pong' message
Should the 'pong' have a colon to match other server->client messages?
Consistency is a virtue.
2016-09-29 14:40:56 +03:00
Henry Castro
78b2fae7e9 loolwsd: test: update max connections 2016-09-28 18:16:09 -04:00
Henry Castro
7a1d02a7ce loolwsd: MAX_CONNECTIONS, should send HTTP status code
It is not necessary to throw a WebSocketException
2016-09-28 18:12:01 -04:00
Tor Lillqvist
96e6ad7502 Re-think disk full handling
Instead of trying to inform the sysadmin (which we did not yet try to
do in any meaningful way), inform all connected clients (even those
editing other documents).

We use 'error: cmd=internal kind=diskfull' as the message to the
clients. The loleaflet code needs to be updated to handle that
carefully by displaying a very prominent message that tells the user
that all bets are off.

Also add a unit test for the functionality.

Document the new protocol details.

The code for this alert functionalty became a bit less elegant than I
like because of the way we include Util.cpp in the unit test 'test'
program.

Still need to add code to check for disk full in more places, not just
when saving a cached tile or font. Probably we should even actually
check for disk space on the file system(s) we use getting alarmingly
low, not just check for file writing operations that fail. Later.
2016-09-29 00:23:14 +03:00
Tor Lillqvist
075c487001 Fix comment. There can be several ChildSessions in a kit process 2016-09-29 00:23:09 +03:00
Henry Castro
0729a38277 loolwsd: restore MAX_CONNECTIONS
Let's do another unit test with http request connections
2016-09-28 17:03:36 -04:00
Henry Castro
5e19aa635e loolwsd: test: connections and documents 2016-09-28 16:04:51 -04:00
Henry Castro
fe2004a06f loolwsd: rework bccu#2022, User warning on hitting limit 2016-09-28 16:01:53 -04:00
Henry Castro
940e78162f loleaflet: remove map attribution 2016-09-28 10:00:35 -04:00
Ashod Nakashian
0e03ac54e6 loolwsd: unittest fixes
Change-Id: I77f7b225c444ca0bc352de4b45b0ead4ad454714
Reviewed-on: https://gerrit.libreoffice.org/29361
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-28 13:28:31 +00:00
László Németh
0b454bccfc loleaflet: cleanup of tile debugging mode 2016-09-28 13:21:01 +02:00
Michael Meeks
86b36b8d6d Don't flush and write to the deflater from different threads concurrently. 2016-09-28 10:55:10 +01:00
Miklos Vajna
31867f669d Fix remaining uninitialized members
The missing init of mutexes is probably theoretical, the TraceFile and
the Unit ones were real errors, I think.

Change-Id: If19c23a9c93d34059998346af8d45c26a34043a6
2016-09-28 10:20:48 +02:00
Ashod Nakashian
71dfb9f7b7 loolwsd: localise locking in ChildSession
Avoid using the static mutex and instead use
the loKitDocument mutex when accessing the
latter. The static mutex is used only when
accessing the document manager. That is,
only when loading and unloading a document.

For ChildSession members that may
be accessed from both the callback and
incoming web-socket, guard them with the
member mutex.

Finally, move any local data manipulation
outside of locks altogether.

Change-Id: I046906bc6ed7e0b38c309f97836b38e27f9bfc8e
Reviewed-on: https://gerrit.libreoffice.org/29336
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-28 03:28:26 +00:00
Ashod Nakashian
dfeae15038 loolwsd: accessing the WS should be thread-safe
Change-Id: I490e9b720024b93099ca63d66e840db2c1931720
Reviewed-on: https://gerrit.libreoffice.org/29335
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-28 03:27:19 +00:00
Ashod Nakashian
4c7b015b68 loolwsd: use atomics for potentially shared flags
Change-Id: I36e34159cca24e2c3d99eaf4d4f36f3e008cb6ce
Reviewed-on: https://gerrit.libreoffice.org/29334
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-28 03:26:20 +00:00
Henry Castro
0ccbf8b235 loolwsd: bccu#2022, User warning on hitting limit 2016-09-27 17:28:30 -04:00
Henry Castro
c3568a6a41 loleaflet: refactor L.Control.Attribution.js 2016-09-27 17:28:30 -04:00
László Németh
459b5e585c loleaflet: show latency and other data in tile debugging mode
- show best, average, worst, last times of
  - server ping round trip
  - times between key press and invalidation message
  - tile based and total tile update latencies

- show data of the last five invalidation:
  - tilecombine messages, if they exist
  - otherwise the invalidation message
  - border of the last five invalidation rectangles

- visual fixes:
  - more transparent red color for better text typing
  - small letters over tiles with transparent background
  - black attribution text instead of gray + bottomleft position
2016-09-27 20:49:13 +02:00
László Németh
9c9c98b89f loolwsd: add ping support to the protocol
The client message 'ping' requests a 'pong' server message.
2016-09-27 20:49:13 +02:00
Jan Holesovsky
feb359e3a9 CPPUNIT_ASSERT_EQUAL.
Change-Id: Ifb0fe46101e243b5f562fb6a63ea350b42f445c0
2016-09-27 19:27:15 +02:00
Jan Holesovsky
26bec64e20 Make the advice about gdb actually useful.
Change-Id: I5b95c79cce5c3b30b3d07210ec7b7a04fdb3067d
2016-09-27 18:18:23 +02:00
Jan Holesovsky
bfbc56f045 JWT token generation does not work without SSL, disable the appropriate tests.
Change-Id: Id25a6507ea11a1e3cfacc8b833d4fd404eaeae27
2016-09-27 18:08:34 +02:00
Jan Holesovsky
dd9aeb8637 Use cppunit macros.
Change-Id: Ie56113a95dfc07b39f64a7ed0ce50efb1fa7081b
2016-09-27 17:38:17 +02:00
Jan Holesovsky
da061317ff Trivial tilecombine unit test for TileQueue.
Fails with any of 137e677eb0 or
fb0e041232 reverted.

Change-Id: Ib025e5d943eef1306e89167260ad352b0ecaf65b
2016-09-27 17:11:06 +02:00
Miklos Vajna
27f541549c Util: add missing include 2016-09-27 17:07:52 +02:00
Ashod Nakashian
56924299c9 loolwsd: restore Poco regex and old initialization
Unfortunately, std::regex is not well supported by old
compilers, namely gcc 4.8 doesn't seem to pass tests.

In addition, newer gcc versions, such as 5.2, don't like
{0,0} initialization.

For now we agreed on restoring the original Poco regex
and the old initialization of {}. When we move to
newer gcc, we can revert this commit so we get std::regex.

This commit reverts the following 3 commits:

Revert "Util: fix -Werror=shadow"
This reverts commit 01c6cb40ef.

Revert "loolwsd: replace Poco regex with std"
This reverts commit 1fdb4bf862.

Revert "Fix gcc-4.8 build"
This reverts commit 92ff278997.

Change-Id: I04912055d1143a2aeebb8d853c4d0c7fe74a40cc
Reviewed-on: https://gerrit.libreoffice.org/29324
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-27 15:00:33 +00:00
Tor Lillqvist
891b942e7c Handle disk full situations more gracefully
Introduce new API in our Util namespace to save data to a file
safely. The data is written to a temporary file in the same directory
and after that has succeeded, it is renamed atomicaly to the intended
name. If any step of the saving fails, neither the temporay file or
the intended target (if one exists before) is left behind.

Also add an API intended to alert the sysadmin in cases where their
attention and action are required. This is not yet properly
implemented. See FIXME comment for discussion.
2016-09-27 15:53:48 +03:00
Tor Lillqvist
8c404e700e Add FIXME about systemd logging mechanism considerations
If we can find out that we are running under systemd, we probably
shouldn't bother with any timestamps in our logging. Systemd does
that, doesn't it?
2016-09-27 15:53:48 +03:00
Jan Holesovsky
0409243683 Log either to file or the console, not to both.
Change-Id: Iac1e74d0624c2bbac4ffaf99b11488f02e626a2a
2016-09-27 14:36:39 +02:00
Jan Holesovsky
0cb07b22e3 Set less verbose logging for non-debug builds.
For debugging builds, use a logfile instead of the console.

Change-Id: I0d5654a568115c054c7439fe1358f5613dc432bf
2016-09-27 14:34:41 +02:00
Jan Holesovsky
0467f84a6f Actually move the check for tty where we check for various envvars etc.
Change-Id: Ib05208770f9e1865fd322302b861108f351607da
2016-09-27 14:34:41 +02:00
Tor Lillqvist
db1733e70d We don't need to check LOOL_NO_LOGCOLOR any more
Since 429cc9d49b, we use colour only
when stderr is going to a terminal.
2016-09-27 12:38:43 +03:00
Jan Holesovsky
429cc9d49b Only use color output if we are not redirected to a file.
Change-Id: I494a6bcfa4505d28e0f028c3e8de955c18bb58dd
2016-09-27 11:30:52 +02:00
Tor Lillqvist
f437ffa47e Bin pointless non-informative copy-pasta
(A cppunit-based test program already itself outputs what tests in it
failed, if any.)
2016-09-27 12:07:18 +03:00
Tor Lillqvist
7922948142 Get rid of some fragile string literal length counts
Basically, instead of foo.compare(0, 3, "bar") use
LOOLProtocol::getFirstToken(foo)!="bar". Using a separate length of a
string literal is very fragile, it is easy to get the length wrong, or
forget to change it in case the string changes. See
137e677eb0.

It isn't entirely sure to me whether was is kept in a message queue
follows LOOL protocol message syntax, but it seems to be so in
practice, so we can use LOOLProtocol::getFirstToken().

Also, calls like msg.compare(0, 4, "tile") add undocumented implicit
requirements that the token in question must be unique as an initial
substring of the first tokens of all messages. It actually isn't,
there is also "tilecombine". But in this case, that was taken care of
by checking for "tilecombine" first. Ugh. Whether that was by accident
or design is hard to say, but at least there was no comment indicating
intentionality.

We still have lots of similar fragile mis-use of std::string::find().
2016-09-27 11:41:27 +03:00
Miklos Vajna
01c6cb40ef Util: fix -Werror=shadow
gcc-4.8 still doesn't allow using the same name for a member function
and a local variable.

Change-Id: I9c327331b5c3460ec0e6d986a0543b17ba92c7ac
2016-09-27 09:48:06 +02:00
Miklos Vajna
fed97b97a7 LOOLKit: remove unused unsing declarations
Change-Id: I6a0efca4dd87694aaa3d32500a56c3a5d246b028
2016-09-27 09:46:24 +02:00
Tor Lillqvist
fa697d843e Remove reference to non-public bugzilla 2016-09-27 09:29:18 +03:00
Ashod Nakashian
d03f460f5f loolwsd: remove debugging logs
Change-Id: I031d8b265f503a26a345901ddec26c801da0d8c8
Reviewed-on: https://gerrit.libreoffice.org/29310
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-27 02:33:12 +00:00
Ashod Nakashian
1fdb4bf862 loolwsd: replace Poco regex with std
Change-Id: Id761d964708bf34b58146b8a3d5ff19df7452b67
Reviewed-on: https://gerrit.libreoffice.org/29309
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-27 02:32:36 +00:00
Pranav Kant
bd40df2c97 loleaflet: Update view cursors when zoom changes
Change-Id: I58c8e71379b11c334c7a3cdd2d0b767d5b9d023c
2016-09-27 07:59:00 +05:30