Commit graph

24 commits

Author SHA1 Message Date
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00
Ashod Nakashian
5c7905d4cc loolwsd: when parsing messages don't parse binary data
The last key=value entry of a message with binary payload
will not be parsed with space alone, since it is followed
immediately by a new line.

To parse these cases correctly we need to break at newline
as well.

Change-Id: I43fff48362a69dc91f36860014d49d128c0edb68
Reviewed-on: https://gerrit.libreoffice.org/30187
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-23 20:57:03 +00:00
Ashod Nakashian
3f42ba342c loolwsd: inline some common LOOLProtocol functions and more args
Change-Id: If75fa5c7c606377b9a79aa6e8d927840b9da39fa
Reviewed-on: https://gerrit.libreoffice.org/29632
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:17:01 +00:00
Tor Lillqvist
6081160bd4 Add LOOLProtocol::getToken*FromMessage()
Tokenizes a string and looks for the requested named parameter (in the
form name=value, like the other getToken* functions).

Also add a unit test for the getToken* functions.
2016-09-26 19:32:15 +03:00
Ashod Nakashian
f4fc6d0c29 loolwsd: new name=value pair parser for strings
Change-Id: I01c56f9c452fe0ac75b3d9f2aa67787c5bb4d8c6
Reviewed-on: https://gerrit.libreoffice.org/25336
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-23 01:45:18 +00:00
Ashod Nakashian
fae850189d loolwsd: include cleanup and organization
A source file (.cpp) must include its own header first.
This insures that the header is self-contained and
doesn't depend on arbitrary (and accidental) includes
before it to compile.

Furthermore, system headers should go next, followed by
C then C++ headers, then libraries (Poco, etc) and, finally,
project headers come last.

This makes sure that headers and included in the same dependency
order to avoid side-effects. For example, Poco should never rely on
anything from our project in the same way that a C header should
never rely on anything in C++, Poco, or project headers.

Also, includes ought to be sorted where possible, to improve
readability and avoid accidental duplicates (of which there
were a few).

Change-Id: I62cc1343e4a091d69195e37ed659dba20cfcb1ef
Reviewed-on: https://gerrit.libreoffice.org/25262
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 15:52:54 +00:00
Ashod Nakashian
a11c1b5483 loolwsd: new token parser helper
Change-Id: I29af7aefe68c4673e21fe11c2ac469cfc87c1a2c
Reviewed-on: https://gerrit.libreoffice.org/25018
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-15 22:55:32 +00:00
Tor Lillqvist
ab92acac20 Spelling correction 2016-05-09 07:30:26 +03:00
Ashod Nakashian
ac4f9857ea loolwsd: getAbbreviatedMessage adds no brackets
Change-Id: Ic26feda6fa8e9e93548624f9d6b6fd84f085eb19
Reviewed-on: https://gerrit.libreoffice.org/24638
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:33:21 +00:00
Ashod Nakashian
466ffc25db Use [] around messages as they are more readable than ''
Change-Id: Id172bb03e8fa9dd148612d756d4a74fc501ea95c
Reviewed-on: https://gerrit.libreoffice.org/24469
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-28 22:20:40 +00:00
Michael Meeks
9d913f986b Use size_t for iterating tokens. 2016-04-20 20:47:00 +01: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
Ashod Nakashian
2ba9bddf9a loolwsd: logging improvements
Change-Id: Ie656aa9d9f19762a960f6608cdadccf3c7eee665
Reviewed-on: https://gerrit.libreoffice.org/23646
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 02:03:25 +00:00
Ashod Nakashian
9f39e465a6 loolwsd: cleanup of the command parser
Change-Id: I654e42ab6de92b7120ae2212d7e08c682d3d36f0
Reviewed-on: https://gerrit.libreoffice.org/23584
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-29 02:47:56 +00:00
Tor Lillqvist
6af8a9bbc1 Avoid 'short' and 'signed' 2016-02-23 10:22:18 +02:00
Ashod Nakashian
2bb2e2aec1 loolwsd: protect against empty messages
Change-Id: Ic60c1abf85268c9ad629bc1f981e53688fc6267a
Reviewed-on: https://gerrit.libreoffice.org/21753
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 21:01:03 +00:00
Tomaž Vajngerl
8ee6503469 add function to convert string to integer
(cherry picked from commit f7acce6f20bf362b741542d66e2879c1638bab7c)
2016-01-14 13:11:57 +01:00
Ashod Nakashian
2d385d697e Protocol versioning added and documented
Change-Id: I6e1df89c7330052bd2d442a42c0b24c8ae4facf6
Reviewed-on: https://gerrit.libreoffice.org/21168
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-06 17:06:47 +00:00
Tor Lillqvist
389815ac63 Introduce LOLProtocol::getTokenKeyword() and use it
The new function takes a map from keywords to integer values, and accepts
parameters in the form of either name=keyword, or for backward compatibility,
name='keyword'. Use it to parse the type parameter of the key, mouse,
selecttext and selectgraphic messages. This restricts the accepted keywords to
those actually valid for each message.
2015-04-27 21:12:20 +03:00
Tor Lillqvist
ed07f1a4e1 Avoid accessing string out of bounds 2015-04-23 17:16:44 +03:00
Tor Lillqvist
3abb6d0307 Now the chroot etc re-work is getting closer to working
Works now for the trivial 'connect' test program. Still need to add
pre-spawning of a new child process as soon as an existing one from the pool
has been taking into use. And need to test with the actual JS client.
2015-04-22 21:44:17 +03:00
Tor Lillqvist
0a60ea9dcc Bump Emacs fill-column to 100
The default 70 is so last century.
2015-04-22 21:43:11 +03:00
Mihai Varga
7d66119532 Command type handler for selectText, selectGraphic, key, mouse 2015-04-13 20:42:44 +03:00
Tor Lillqvist
422dfd1767 Start on load testing
Add a new program, loadtest, that runs a requested number of client sessions
in parallel to a loolwsd server. A client session loads one of a list of test
documents, and does some operations on it.

Move the getTokenInteger() and getTokenString() functions out from LOOLSession
into a new namespace LOOLProtocol, as they are neeeded also in the loadtest
program.

Add, also in LOOLProtocol, functions to parse some of the messages from the
server. (In general that is done in client JavaScript code, of course; only
for testing purposes needed in C++ code.)
2015-03-26 17:04:08 +02:00