Commit graph

235 commits

Author SHA1 Message Date
Ashod Nakashian
c980ece8bc loolwsd: preparing for wopi storage
Change-Id: Iae1bd042d84603cf81115789df40f50e8dc20d16
Reviewed-on: https://gerrit.libreoffice.org/22884
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-04 03:04:43 +00:00
Pranav Kant
c5aa122fcb loolwsd: Create notification pipe
... and Admin and AdminModel containing all the required data
that we need to expose to Admin panel.

Admin processor will keep listening to any data on this
notification pipe and update AdminModel accordingly.

Change-Id: I0dd6f07ae60158733c34d17f53a35def70600513
Reviewed-on: https://gerrit.libreoffice.org/22780
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-03 03:34:47 +00:00
Tor Lillqvist
02913dcbfc Use std:: consistently for cstdlib functions 2016-03-02 08:47:13 +02:00
Tor Lillqvist
73282c50d6 Make preinit the default. Turn off with LOK_NO_PREINIT 2016-03-02 08:26:15 +02:00
Tor Lillqvist
9d655cbcc0 Don't pretend this will work on anything except Linux 2016-02-29 14:25:12 +02:00
Tor Lillqvist
29a3f58f1a The loolwsd program does not need any capabilities
So don't give it any then.

Remove the --uid option and related attempts to handle running loolwsd
under sudo, to be able to debug it. Now with loolwsd not having
capabilities, it should work fine to just run it under a debugger
normally. (For the loolbroker and loolkit processes, attaching to an
already started process is the way to debug.)
2016-02-29 14:13:19 +02: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
7ced4adc5e Just use "" instead of std::string() 2016-02-22 16:30:42 +02: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
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
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
Ashod Nakashian
7aeeab46f8 loolwsd: Admin manager added with a sample stats command
Change-Id: I7d3c1a5ab573d20d285c1c184cfb88ace17991f8
Reviewed-on: https://gerrit.libreoffice.org/22430
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-17 15:30:02 +00:00
Henry Castro
a607159a8a loolwsd: catch exception requestTermination 2016-02-16 17:25:51 -04:00
Henry Castro
9b4099c41c loolwsd: check if the named pipes exists 2016-02-16 17:13:14 -04:00
Henry Castro
3ad641c7bd loolwsd: check if the pipe path exists 2016-02-16 17:04:21 -04:00
Ashod Nakashian
90776a3c0d loolwsd: control preinit vs fork using envars and disable bind-now
Change-Id: I63dffa18da69751ab72463bb64065d235d811db5
Reviewed-on: https://gerrit.libreoffice.org/22381
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-15 23:18:24 +00:00
Henry Castro
72db8ed63a loolwsd: replace the random jail id for lokit process id 2016-02-13 19:01:03 -04:00
Henry Castro
75b552bf71 loolwsd: create named pipes workspace 2016-02-13 13:22:15 -04:00
Henry Castro
9e3d5c0337 loolwsd: ensure chroot jail every lokit process 2016-02-13 10:15:28 -04:00
Henry Castro
5848cff634 loolwsd: wait for loolbroker process to change state 2016-02-03 19:51:27 -04:00
Henry Castro
70ff592624 loolwsd: use strsignal 2016-02-03 18:08:16 -04:00
Henry Castro
661ae62259 loolwsd: exit when error no child process 2016-02-03 17:43:04 -04:00
Henry Castro
5fd2be332a loolwsd: use EXIT_SOFTWARE to indicate internal error 2016-02-01 21:53:16 -04:00
Ashod Nakashian
f3b319ee7f loolwsd: each HTTPServer has its params and skip failed child query
Change-Id: I41c730a935fd0d2e1e3181cced529d414c3aebb0
Reviewed-on: https://gerrit.libreoffice.org/22014
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-02 01:51:04 +00:00
Henry Castro
b477f41636 loolwsd: add fatal signals handler 2016-02-01 21:26:19 -04:00
Pranav Kant
7ffd4b45db bccu#1468: handle 'nextmessage:' in prisoner -> master text frames
There are cases when prisoner would send huge text data but
without preceeding 'nextmessage' frames making the master throw
WebSocketException.

Also move the 'nextmessage' frame interpretation logic up in the
'else if' ladder to be able to detect and handle such huge text frames.

Change-Id: Ibe44b69f4ab75c1b8096648c6006316c88366e7c
Reviewed-on: https://gerrit.libreoffice.org/21835
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-01 05:09:35 +00:00
Ashod Nakashian
6f5afd92ba loolwsd: fixed server thread-pool
TCPServer doesn't use the custom ThreadPool passed to it
to dispatch connections. This leads to starvation
when too many connections are initiated together.

Because we open an internal socket back to master, we
need to be able to dispatch two connections (two threads)
for each client connection.

Therefore, the default ThreadPool needs to have sufficient
capacity to grow. A new constant is added to define this
capacity and it is used to configure both the TCPServer
(which configures the default ThreadPool) and the customer
ThreadPool (used to host the actuall connection handler).

Change-Id: I49adc039aa99e9350b0defc4a5e141b77524992e
Reviewed-on: https://gerrit.libreoffice.org/21976
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-01 05:06:35 +00:00
Ashod Nakashian
a956c61b07 loolwsd: logging
Change-Id: Ie81dc0b890fd59d0073b812117762bb0aff0f579
Reviewed-on: https://gerrit.libreoffice.org/21933
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-30 15:43:07 +00:00
Henry Castro
faf2a57d19 loolwsd: eof broker pipe 2016-01-26 21:22:07 -04:00
Henry Castro
2baae1b324 loolwsd: simplify one loolbroker 2016-01-25 21:07:10 -04:00
Henry Castro
6b28433265 loolwsd: Log::warn when the thread pool is full.
When thread pool is full no more connections are accepted.
It is confused as a deadlock
2016-01-25 17:11:51 -04:00
Henry Castro
e3fd07ad0e loolwsd: remove unnecessary inter process mutex
It is no longer needed becuase loolbroker handle connections
2016-01-25 12:26:22 -04:00
Ashod Nakashian
f9fd4c917a loolwsd: refactored HTTP Request Handler
Change-Id: I84685910afa04664639ae674fd66ff888962387e
Reviewed-on: https://gerrit.libreoffice.org/21757
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 21:10:53 +00:00
Ashod Nakashian
b85b4423b0 loolwsd: break the wait on save-as queue and better failure handling
Change-Id: Ifee252b3c189ee0b1287bda891b38c5abddb7440
Reviewed-on: https://gerrit.libreoffice.org/21755
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 21:09:28 +00:00
Ashod Nakashian
9593ec5720 loolwsd: improved polling and pong with client
Change-Id: I17c4f7685d23b6e4c84a7f8b34fcb7dbcaf959f9
Reviewed-on: https://gerrit.libreoffice.org/21754
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 21:02:16 +00:00
Ashod Nakashian
55f2105f00 loolwsd: logging improvements
Change-Id: I77844a2b549c1f497c2d44f054169bf11d9227d8
Reviewed-on: https://gerrit.libreoffice.org/21752
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 21:00:34 +00:00
Jan Holesovsky
0c509e17c1 loolwsd: Fix /convert-to to handle filenames containing spaces. 2016-01-21 23:30:52 +01:00
Ashod Nakashian
dd374d8aec loolwsd: disconnect command to gracefully shutdown a socket
Change-Id: I8beb4c14fc95bdb2a98c7e5da44408511bce5e28
Reviewed-on: https://gerrit.libreoffice.org/21683
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:05:55 +00:00
Ashod Nakashian
d310d3f3f5 loolwsd: proper ping handling by echoing
Change-Id: Ifc66ae1bc15d588d4613d87ab0fa19ec389b7615
Reviewed-on: https://gerrit.libreoffice.org/21682
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:04:26 +00:00
Ashod Nakashian
291b0aac67 loolwsd: don't ignore the last few bytes of a closed socket
Change-Id: Id6332857e49ccbacfa6e63b87a1ed570e9598147
Reviewed-on: https://gerrit.libreoffice.org/21680
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:03:29 +00:00
Ashod Nakashian
d2bde985cc loolwsd: poll timeout of 500ms and handling priority events
Change-Id: Iadf449ee62700e1ac5da2be8c73c674657633808
Reviewed-on: https://gerrit.libreoffice.org/21679
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:02:04 +00:00
Ashod Nakashian
bccfd79d35 loolwsd: reset http request handler's thread name as it's reused
Change-Id: I62332e1d3018a7ff3cebe3982910792fa75d0c8f
Reviewed-on: https://gerrit.libreoffice.org/21676
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 15:45:30 +00:00
Ashod Nakashian
8e8e7c70c2 loolwsd: cleanup and correction of child signal handling
Change-Id: I8739e71a2180c970ba4b8eb3b1d4721ecf4268e9
Reviewed-on: https://gerrit.libreoffice.org/21670
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 15:42:24 +00:00
Pranav Kant
f429001ff9 loolwsd: Display version information on command line
Change-Id: Ie65c30574ca4cef619a224ec6df3501d6bda086a
Reviewed-on: https://gerrit.libreoffice.org/20847
Reviewed-by: jan iversen <jani@documentfoundation.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2016-01-19 16:36:00 +00:00
Miklos Vajna
c8ea8bcacd loolwsd: handle WS messages split into multiple frames 2016-01-18 16:54:22 +01:00
Miklos Vajna
3cbdd9e3bd MasterProcessSession: capitalize static members 2016-01-18 09:43:49 +01:00