Commit graph

3966 commits

Author SHA1 Message Date
Andras Timar
2e12fade82 Updated Slovenian translation 2016-10-20 22:39:22 +02:00
Ashod Nakashian
693d6ccdbf bccu#2104 - writer: undo/redo doesn't invalidate properly
Change-Id: I9b3ee76cfde2c15ae59bb393070224c9f14ab586
Reviewed-on: https://gerrit.libreoffice.org/30109
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-20 15:14:21 +00:00
László Németh
7f72553236 loleaflet: traffic log and automatic typing in tile debug mode
- show outgoing and incoming network messages with some
  highlighting in Javascript console (default in tile
  debug mode)

- add optional automatic typing

- add layer controls for overlays and automatic typing

- differentiate rectangle borders (newer is more opaque)

- fixes:

  - fix function call at cancelled tiles

  - hide all attribution control when disabling debug mode
2016-10-20 16:25:05 +02:00
Henry Castro
e189f60ad4 loleaflet: refocus map due drop down insert table 2016-10-20 09:31:27 -04:00
Pranav Kant
49f4e696e5 loleaflet: Click user item to go to its cursor
Change-Id: Iac87da20cfe422000eb9a32ccad50e8483637616
2016-10-20 17:22:36 +05:30
Andras Timar
0cdc9d70b5 loolwsd: fix error: declaration of ‘isLoaded’ shadows a member of 'this' [-Werror=shadow] 2016-10-20 11:03:24 +02:00
Pranav Kant
9f69359b33 loleaflet: Disable these toolbar buttons too, in readonly mode
Change-Id: I8bc661dd3cfd689c7c7ded367deacdba853153e4
2016-10-19 21:08:33 +05:30
Pranav Kant
1be2a78564 Handle WOPI's UserCanWrite to determine readonliness
permission= parameter in URL is still supported, but overridden
by UserCanWrite parameter.

Also, introduce a new protocol message, perm: which dictates
loleaflet about the permission rather than the other way around
(only in case of WOPI)

It is to be noted that by default loolwsd assumes very
restrictive permissions, so not providing UserCanWrite in WOPI
implementation by a WOPI host would lead to opening of only
readonly session.

Change-Id: I2013c1661fd491c79bb367a41e1a7036fa03f984
2016-10-19 20:47:20 +05:30
Pranav Kant
ef32f30017 loolwsd: Fix a crash due to invalid fileinfo
Throw if document load fails. Ignoring such a scenario would lead
to crash later in the document load process.

Change-Id: Ie80fc4f26e08e4920d4c04726f947edd2837a0cf
2016-10-19 15:51:29 +05:30
Andras Timar
1f2be91009 loleaflet: updated port files 2016-10-19 11:53:18 +02:00
Michael Meeks
8d4c5d4e68 Avoid deadlock when notifying users of document load failure. 2016-10-18 21:51:33 +01:00
Tor Lillqvist
ece9740926 Use LOOLProtocol::getAbbreviatedFrameDump() 2016-10-18 17:00:45 +03:00
Tor Lillqvist
24442a080c Introduce LOOLProtocol::getAbbreviatedFrameDump()
Produces a human-readable logging string describing a LOOL protocol
frame. To be used for re-factoring snippets of similar code that
sometimes print also the flags, sometimes pointlessly print the
(binary) contents of a CLOSE frame (as if it was text), etc.
2016-10-18 16:57:14 +03:00
Tor Lillqvist
53b718844f Add a FIXME for some sillyness
One thing works mainly by accident, another is inefficient.
2016-10-18 16:32:04 +03:00
Tor Lillqvist
b0c870cbeb Expand documentation for getAbbreviatedMessage()
It has always been the intent that getAbbreviatedMessage() is for
producing human-readbale nice output for logging purposes only. But
this has not been mentioned, so (naturally) the function has been
misused. Sigh.
2016-10-18 16:26:30 +03:00
Tor Lillqvist
e87cf1e5d8 Adapt to new URI format in the GET request 2016-10-18 12:29:05 +03:00
Tor Lillqvist
38ccbd0196 We can use LoolException::toString() in one more place 2016-10-18 09:45:02 +03:00
Tor Lillqvist
620c08a32d Bin pointless copy-pasted (?) code snippet
We did not use the 'request' variable for anyhthing.
2016-10-18 09:09:13 +03:00
Tor Lillqvist
b02a917f0a Introduce LoolException::toString() to avoid a few std::string casts
Also consistently cast the call of std::exception::what() and not a
string literal being conatenated with that.
2016-10-18 08:40:04 +03:00
Tor Lillqvist
72133868b5 Use correct function name in some log messages
These Log::foo() calls are in ClientRequestHandler::handleClientRequest(),
not in ClientRequestHandler::handleRequest().

Actually I wonder why we show the name of the function in this handful of
places. We don't do it in general. Consistency, bah.
2016-10-18 08:39:24 +03:00
Tor Lillqvist
32b33ee685 Add logging of NumDocBrokers and the size of the DocBrokers array
I fear they get can out of sync when HTTPCrashTest::killLoKitProcesses()
kills a loolkit process, and this then causes HTTPWSError::testMaxDocuments()
to fail. This is to help debugging that.

Haven't fully understood what is going on yet. But one thing is sure:
It is a bad idea to duplicate the same state information in two
places, we shouldn't really use that separate NumDocBrokers
variable.

Probably also NumConnections tracks state that can easily be
calculated from the data structures, but maybe NumConnections does not
that easily get out of sync.
2016-10-18 08:06:16 +03:00
Tor Lillqvist
970259d170 killLoKitProcesses() already calls countLoolKitProcesses(0)
No need to immetiately call it again in testBarren().
2016-10-17 22:11:39 +03:00
Tor Lillqvist
a3236497a8 Fix HTTPWSTest::testConnectNoLoad
The waiting for the expected number of loolkit processes after that
test never succeeded. That apparently was caused by the fact that the
loolwsd process is waiting for up to COMMAND_TIMEOUT_MS (five seconds
currently) for an auto-save of the document to succeed, and that never
happens in this case.

countLoolKitProcesses() on the other hand was waiting only a bit over
three seconds (calculated in a complicated way from POLL_TIMEOUT_MS
and a few magic numbers) for the number of loolkit processes to reach
the expected number. Or something like that.

COMMAND_TIMEOUT_MS=5000 and POLL_TIMEOUT_MS=COMMAND_TIMEOUT_MS/10 =>
500. We used to have in countLoolKitProcesses():
sleepMs=POLL_TIMEOUT_MS/3 => 166 and repeat=(3000/sleepMs)+1 =>
19. 19*166 => 3154.

Fix by calculating the max time to wait for the expected number of
loolkit processes in countLoolKitProcesses() in a different way, so
that it is always longer than COMMAND_TIMEOUT_MS.
2016-10-17 22:11:05 +03:00
Tor Lillqvist
bb36ca79d4 Attempt to handle unauthorized WOPI usage better
Use the previously unused UnauthorizedRequestException for this, and
throw a such in StorageBase::create() when the WOPI host doesn't match
any of those configured.

In a developer debug build, without access to any real WOPI
functionality, you can test by setting the FAKE_UNAUTHORIZED
environment variable and attempting to edit a plain local file:
URI. That will cause such an exception to be thrown in that function.

Catch that UnauthorizedRequestException in
ClientRequestHandler::handleGetRequest(), and send an 'error:
cmd=internal kind=unauthorized' message to the client. Handle that in
loleaflet in the same place where the 'error: cmd=internal
kild=diskfull' message is handled, and in the same fashion, giving up
on the document.

Actually, using exceptions for relatively non-exceptional situations
like this is lame and makes understanding the code harder, but that is
just my personal preference...

FIXME: By the time StorageBase::create() gets called we have already
sent three 'statusindicator:' messages ('find', 'connect', and
'ready') to the client. We should ideally do the checks we do in
StorageBase::create() much earlier.

Also consider that ClientRequestHandler::handleClientRequest() has
code that catches UnauthorizedRequestException and
BadRequestException, and tries to set the HTTP response in those
cases. I am not sure if that functionality has ever been exercised,
though. Currently, we upgrade the HTTP connection to WebSocket early,
and only after that we check whether the WOPI host is authorized
etc. By that time it is too late to return an HTTP response to the
user. If that even is what we ideally should do? If not, then we
probably should drop the code that constructs HTTP responses and
attempts to send them.

Also, if I, as a test, force an HTTPResponse::HTTP_BAD_REQUEST to be
sent before the HTTP connection is upgraded to WebSocket, loleaflet
throws up the generic "Well, this is embarrassing" dialog anyway. At
least in Firefox on Linux. (Instead of the browser showing some own
dialog, which I was half-expecting to happen.)
2016-10-17 19:34:04 +03:00
Tor Lillqvist
b29ae3c032 Sort lines for clarity 2016-10-17 19:34:04 +03:00
Pranav Kant
8ab4682a71 loolwsd: Fix handling of CPPUNIT_TEST_NAME in external test-suite
Doing a plain CPPUNIT_TEST_NAME='somettest' make check will
result in executing all the tests in external test suite. This is
a problem when one wants to execute only internal tests (unit-*
ones) as test harness first executes those followed by all of the
tests in external test-suites.

Lets execute all the tests only when no CPPUNIT_TEST_NAME is
provided, and ignore when it is provided but no match is found.

Change-Id: I7e40b6f3124e6965a86cfb6395d246df3b5c17ba
2016-10-17 21:21:54 +05:30
Pranav Kant
be1e49715c loolwsd: Bring this test back to life
There doesn't seem to be any failure on this test anymore.
Consecutive 20 runs of this test gives no failure, so lets enable
it again.

Change-Id: I77ddd1c36d18162bdc75fd24d51c1a2df22f749d
2016-10-17 18:34:22 +05:30
Pranav Kant
38e8a38034 loolwsd: Fix admin remove doc after unloading the session
Change-Id: Ia512d5b4c5f0e230542caed6cebc242e3a345430
2016-10-17 18:34:22 +05:30
Pranav Kant
d4fbc92023 loolwsd: Fix admin console document add
Change-Id: I987f26b4aae2c4ea8ef65919f570576ef8c5d2a7
2016-10-17 18:34:22 +05:30
Pranav Kant
1c2c03fcb6 loolwsd: Query docbroker for load duration after loading the doc
addSession() now also loads the document, so querying docbroker
for load duration before it doesn't make any sense.

Change-Id: I3c60bef5e2054878ba695b8f76b6800cdedffe8d
2016-10-17 18:34:22 +05:30
Tor Lillqvist
9ced5ffdd5 Log how we are actually exiting the test when calling exitTest()
unit-admin fails every time for me at the moment. Make it at least a
bit easier to figure out what is going on.
2016-10-17 13:42:02 +03:00
Marco Cecchetti
e61d8aaa5f loleaflet: handle EMPTY invalid tiles msg with part in the payload
Change-Id: I73e363f51101c8e4e258131ea1692a7709d6a544
Reviewed-on: https://gerrit.libreoffice.org/29964
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2016-10-17 10:39:41 +00:00
Pranav Kant
cd92dc277b loolwsd: Remove this leftover duplicate comment
Change-Id: I243e2fd745b4b0c70cec79deefffcb5b8f7d2548
2016-10-17 15:25:20 +05:30
Tor Lillqvist
fdb16a5d52 Add comment to hopefully avoid others being confused like I was 2016-10-17 12:44:58 +03:00
Ashod Nakashian
cb09f50d8c loolwsd: static variables must start with uppercase per the style guidelines
Change-Id: I1e8105983f98cc0cd15448e6d9cb1e6fca36ca9d
Reviewed-on: https://gerrit.libreoffice.org/29955
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:14:45 +00:00
Ashod Nakashian
72fb908086 loolwsd: limit test documents and connections to the config
...if configured with limits.

Change-Id: Ic148f725c58485ea88f62ddf7b4ac47b3b43ff04
Reviewed-on: https://gerrit.libreoffice.org/29951
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:14:30 +00:00
Ashod Nakashian
d266d124df loolwsd: argument cleanup
Pass std::string instead of char* and length where
a string is always constructed anyway. Also cleaner
and safer code.

Change-Id: I1c9341e2c81bbdb7adeb29d3fba59849b2617e95
Reviewed-on: https://gerrit.libreoffice.org/29954
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:14:00 +00:00
Ashod Nakashian
60bfda4609 loolwsd: loose coupling between ClientSession and DocumentBroker
Change-Id: I5bd1c51a8f1110923db052d0712f9f204db5d4af
Reviewed-on: https://gerrit.libreoffice.org/29953
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:13:31 +00:00
Ashod Nakashian
d857b3dbbb loolwsd: add the ClientSession to the Broker last
This avoids early connection failures causing the
session to linger in the Broker indefinetely.

Change-Id: Ibe2b5b386ed1cd6e12e68735bff60b15957188cf
Reviewed-on: https://gerrit.libreoffice.org/29952
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:12:43 +00:00
Ashod Nakashian
5ba6ce1a33 loolwsd: fix and cleanup HTTPWSError unittests
Change-Id: Ib730c8b3c1eac56bd24c97b62bc12060e437205f
Reviewed-on: https://gerrit.libreoffice.org/29950
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:11:58 +00:00
Ashod Nakashian
f113d9c9c7 loolwsd: fix and improve kit crash unittest
Change-Id: Icd50faab8c8453d8df39253b75d887d315bda6d1
Reviewed-on: https://gerrit.libreoffice.org/29949
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:11:39 +00:00
Ashod Nakashian
de7cda7891 loolwsd: improve child cleanup and forking
Change-Id: I437216d87b6fa15e567e102ed875b22ef03351b2
Reviewed-on: https://gerrit.libreoffice.org/29948
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:11:18 +00:00
Ashod Nakashian
4f4472ffa6 loolwsd: shutdown client sockets and cleanup when kit dies
Change-Id: I4d59553d744a8075d4d873ff520d9f3e417521b3
Reviewed-on: https://gerrit.libreoffice.org/29947
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:10:43 +00:00
Ashod Nakashian
4c967ec0c8 loolwsd: correct the test document name
Change-Id: I4efe1e36a70b62154a5e0dd70d42ee0a6c98cf6f
Reviewed-on: https://gerrit.libreoffice.org/29946
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:10:06 +00:00
Ashod Nakashian
57c5e55a4d loolwsd: trap signal handler to prevent premature exit
When upon cleanup we segfault we want to avoid
forcible exit using _Exit(). This was done by
an unconditional wait (sleep).

This patch changes that mechanism into a latch
(mutex) that traps the exit when the sig handler
is invoked, therby preventing exit as long as
necessary for the sighandler to finish.

Change-Id: Ifc8e972be12645a1b310d4cb4e3a4172afc31327
Reviewed-on: https://gerrit.libreoffice.org/29945
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:09:49 +00:00
Ashod Nakashian
4ca15894df loolwsd: only forkit cleans up the jail directory
No need to do a partial cleanup in the kit
when forkit recycles the disk. This avoid
both programatic errors (as the comments in
the removed code explains) as well as hammering
the disk from multiple processes.

By leaving all disk cleanup to forkit we
guarantee safety and that only one process
does disk cleanup, and sequentially at that.

N.B. Kit processes are still responsible for
setting up the jail and the LO binaries etc.
So disk IO is not strictly sequential from a
single process.

Change-Id: Ia6768ab87df71a83a6676c3d52da3d6797f717fc
Reviewed-on: https://gerrit.libreoffice.org/29944
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:09:02 +00:00
Ashod Nakashian
c1ee1f5102 loolwsd: stop ChildProcess WS on TerminationFlag
Change-Id: I303dedb8254a9b815dd0b2c5d0a62cc5345af062
Reviewed-on: https://gerrit.libreoffice.org/29943
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:08:15 +00:00
Ashod Nakashian
67437c6076 loolwsd: all timeouts in milliseconds
Change-Id: Ic5db4e13b2caba53fcbeea0bfdb10d112f2d5a18
Reviewed-on: https://gerrit.libreoffice.org/29942
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:08:00 +00:00
Ashod Nakashian
d4214c555f loolwsd: kill waitBridgeCompleted and AvailableChildSessions
Change-Id: I26eac76135d35ea17ac7e6d2697df81ad07a1d73
Reviewed-on: https://gerrit.libreoffice.org/29941
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:06:21 +00:00
Ashod Nakashian
7043b95f4d loolwsd: fix convert-to after removing Prisoner WS
Change-Id: I652a9fffa267e01043262eb25d3c2e19bf9eb447
Reviewed-on: https://gerrit.libreoffice.org/29940
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:06:05 +00:00