Commit graph

890 commits

Author SHA1 Message Date
Tor Lillqvist
dbd5e3877d Don't send "disconnect" frames here either
The JavaScript code does not either.
2016-02-24 17:45:20 +02:00
Tor Lillqvist
bc7decb6ca No "disconnect" message is sent by our client JS code (and that is good)
Having a separate "disconnect" message is a disgrace. There should be
no need for it. WebSocket has a perfectly fine graceful disconnect
mechanism already (CLOSE frames). The code needs to be prepared to
receive a CLOSE frame at any time. The code also needs to be prepared
for the underlying socket being bluntly closed by the other end,
without sending any WebSocket CLOSE frame. The only sane thing is to
handle a "disconnect" message in the same way as those situations
anyway, so why is it needed?
2016-02-24 17:44:17 +02:00
Tor Lillqvist
46b43602fd No colours in the log, thanks
The escape sequences just make the log harder to read in an editor.
2016-02-24 15:35:32 +02:00
Andras Timar
277f86b7e9 loolwsd: bump version after tarball 2016-02-24 14:13:56 +01:00
Andras Timar
f35e13a936 loolwsd: bump version before tarball 2016-02-24 14:10:49 +01:00
Tor Lillqvist
c25f819e83 Yoda naming avoid 2016-02-24 09:46:53 +02:00
Tor Lillqvist
72c6cb8980 No LibreOfficeKit used in this file 2016-02-24 09:46:53 +02:00
Tor Lillqvist
07dc25641d Increase stylistic consistency
Sort #includes and using statements. Use 'using' consistently for all
Poco:: types. (I am not 100% convinced that using 'using' like done
here in loolwsd was a good idea after all. But at least let's be
consistent now that we do use it.)
2016-02-24 09:45:52 +02:00
Tor Lillqvist
32dc0a3c87 Don't ever attempt to handle the payload of CLOSE frames 2016-02-23 20:03:52 +02:00
Tor Lillqvist
7320d8ca51 Bin unused 'using' 2016-02-23 20:02:54 +02:00
Tor Lillqvist
79037b687e Log received messages to stderr 2016-02-23 20:02:29 +02:00
Tor Lillqvist
fbee03cae2 Minor clarification
No need to pass the value of a variable, initialised much earlier, to
a system call when one can pass the required constant value as
such. Much clearer.
2016-02-23 17:59:52 +02:00
Miklos Vajna
7552fcd806 loolwsd: work around -Werror,-Wunused-private-field 2016-02-23 09:35:46 +01:00
Miklos Vajna
ae07c555bb loolwsd: fix -Werror,-Winconsistent-missing-override 2016-02-23 09:32:25 +01:00
Tor Lillqvist
6af8a9bbc1 Avoid 'short' and 'signed' 2016-02-23 10:22:18 +02:00
Tor Lillqvist
674ceb90b9 Add comment 2016-02-23 09:28:48 +02:00
Tor Lillqvist
c9fef1eb7e Add comment about weird use of condition variable 2016-02-23 09:09:22 +02:00
Tor Lillqvist
00e3d6ca20 Cosmetics: add a space 2016-02-22 17:09:59 +02:00
Tor Lillqvist
819d5c23c0 Use all tokens 2016-02-22 16:31:24 +02:00
Tor Lillqvist
7ced4adc5e Just use "" instead of std::string() 2016-02-22 16:30:42 +02:00
Tor Lillqvist
72ff491fb2 Cosmetics: avoid trailing space in 'disconnect' message 2016-02-22 16:27:12 +02:00
Tor Lillqvist
ef30af121a Log a bit more information 2016-02-22 13:50:14 +02:00
Tor Lillqvist
5a69177f74 We are not interested in the payload of CLOSE frames 2016-02-22 13:50:14 +02:00
Andras Timar
33f66d4686 loolwsd: add new headers to distribution tarball 2016-02-22 11:16:05 +01:00
Tor Lillqvist
b4387a535a Bin some superfluous using declarations and includes, and actually use others
Sorry, could not resist. Obviously not very important.

In retrospect, maybe it would have been better to have as policy to
*not* use any 'using Poco::Foo'. Now there is an inconsistent mix of
writing out the complete type and using a 'using'. Plus copy-pasted
long lists of 'usings'. And of course, one should never have 'using'
in an include file. Oh well.
2016-02-22 11:37:47 +02:00
Henry Castro
fa4e3bcc86 loolwsd: use kill signal SIGINT 2016-02-21 14:48:05 -04:00
Pranav Kant
6722d430a5 loolwsd: Use helper functions for document password unit test
Change-Id: Ibf921ea1834f85b9a1d81232b1a018c1936fe620
2016-02-21 20:40:05 +05:30
Henry Castro
9b729b7a43 loolwsd: remove child jail path when the lokit process dies 2016-02-21 08:45:17 -04:00
Henry Castro
d835d53ff5 loolwsd: check last child exit code 2016-02-21 08:37:55 -04:00
Henry Castro
ba47e28581 loolwsd: re-work UriToDocumentURIMap
This is not in synchronization with lokit process because
it is normal that lokit dies now.
2016-02-21 08:26:29 -04:00
Henry Castro
730ec99194 loolwsd: ensure lokit process exited successfully after close the document and views 2016-02-21 08:10:30 -04:00
Henry Castro
b646fca95d loolwsd: add lokit iddle maintenance time out 2016-02-21 08:02:31 -04:00
Pranav Kant
f729156806 loolwsd: Fix misplaced break statement
Probably due to merge conflicts, it ended up in a wrong place.

Change-Id: Ia32e18149d99e901ceaa47a4e984f9ca818d0619
2016-02-21 14:08:00 +05:30
Henry Castro
cdc0ffb0cb loolwsd: add cppunit test partscountchanged 2016-02-20 17:14:10 -04:00
Henry Castro
c2413998be loolwsd: add partscountchanged protocol 2016-02-20 16:45:40 -04:00
Pranav Kant
d05f42df08 loolwsd: Rework document password unit test
Our unit test structure changed with
7037f07a38 . Restructure this one
too.

Change-Id: I1a14dd0ab0d631fd447edf620b6c24fe3730c843
2016-02-20 03:52:22 +05:30
Pranav Kant
b71ebb8dfc loolwsd: Ask for password for multiple views also
This is possible by moving all the password handling logic to
Document container class. When a user opens a password protected
document the first time, it saves all possible data such as
password, password type etc. Upon opening the same document
again, password is matched with the cached password saved in the
document container class before allowing the new view access to
this document.

Change-Id: Id1f2b6e06de806564bf865e83fed51b01c9a0fbc
Reviewed-on: https://gerrit.libreoffice.org/22208
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 22:00:46 +00:00
Pranav Kant
631ae0f11f loolwsd: Get the first *live* connection
Sometimes there are situations when `connection` map is filled
with dead sessions. We don't want to deal with those dead ones.

Change-Id: I00dda77c39b5adbba69421eace0be0159e02505c
Reviewed-on: https://gerrit.libreoffice.org/22207
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:57:10 +00:00
Pranav Kant
10db02c208 loolwsd: Move document related callback logic to Document class
There are 5 LOK callbacks currently that are triggered on LOKit,
and not on LOKitDocument. These include status indicators, and
document password callbacks during document load. Lets move all
the callbacks called during document load in the Document container
itself, and keep the callbacks called after document load in the
Child session.

Change-Id: I8e43c2baaa12023b34822954dd494780ee6dd7ca
Reviewed-on: https://gerrit.libreoffice.org/22206
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:56:50 +00:00
Pranav Kant
a2549e3df7 loolwsd: Disconnect the child if there is no client
Don't let them hanging around, otherwise we would keep sending
messages to a dead peer (ToClient) indefinitely.

Change-Id: I9d4bb6edee351bd31f1faa30deaa4f37c3c7d031
Reviewed-on: https://gerrit.libreoffice.org/22465
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:56:12 +00:00
Pranav Kant
7ecde23422 loolwsd: Remove superfluous registration of callback
Our DocumentCallback is smart enough which checks all the
running connections, and send the callback notification to all of
them. Registering the callback only during the first loadDocument
call should be enough.

Change-Id: I82bcb9525814dae14def3bfb6c088337d0d0ea3c
Reviewed-on: https://gerrit.libreoffice.org/22202
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:55:50 +00:00
Pranav Kant
b902d80ec7 loolwsd: Add a unit test for password protected documents
Change-Id: Ia675d2750e11cb466b2e80b8f36f2ef04e0a7a09
Reviewed-on: https://gerrit.libreoffice.org/22466
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:55:07 +00:00
Pranav Kant
3667bef9a6 loolwsd: Handle password protected documents
Change-Id: Iceb5bb598ef1517bf640994c27bad4ca36bd72c1
Reviewed-on: https://gerrit.libreoffice.org/21894
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:49:45 +00:00
Ashod Nakashian
13f9b7a2db loolwsd: Storage Abstraction support
An abstract Storage abstraction class is added.
There will be a factory to instantiate concrete
implementation for a given backend.

For WebDAV and similar hosted backends, authentication
and authorization will be done by the implementation
with the help of the Auth abstraction.

Change-Id: I38ec5dad4c2c4ce16df30d65826df96751b10e2d
Reviewed-on: https://gerrit.libreoffice.org/22513
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:45:25 +00:00
Ashod Nakashian
d8df19d064 loolwsd: Authentication and Authorization support
An abstract class to request an access token, given
an authorization grant. The class should be
specialized for each authentication/authorization
type we support.

Currently it's not enabled in the code as it's
an early stage in developing an general API.

Change-Id: I4f2efd376d575640bd3e17c7257994020b11bbe8
Reviewed-on: https://gerrit.libreoffice.org/22512
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:44:55 +00:00
Miklos Vajna
e3cc05ddcd loolwsd: fix indentation 2016-02-19 08:38:02 +01:00
Henry Castro
7037f07a38 loolwsd: re-work cppunit test websoket 2016-02-18 17:12:16 -04:00
Pranav Kant
9cf0cbf3a6 loolwsd: Allow sending 'tilecombine' messages with 'timestamp'
... and revert back with this parameter in 'tile:' response
messages so that client can identify the response.

This is also required to make client-side tile benchmarking tests
work again.

Change-Id: I307aabf622b17f4dce727d1faf3c83eb566ba905
2016-02-19 00:32:03 +05:30
Pranav Kant
cabb9d7fc3 loolwsd: Add a missing command, 'tilecombine' to documentation
Change-Id: Iedefef83cefca6e88e9676a0bc810ecb766b59ee
2016-02-19 00:32:03 +05:30
Henry Castro
e9de068423 loolwsd: fixes coding style naming convention rules in Util files 2016-02-18 13:00:37 -04:00