Commit graph

9 commits

Author SHA1 Message Date
Michael Meeks
c8d1c18cb5 Revert "wsd: correctly remove request from socket buffer"
This reverts commit c851c3e93b.
2017-04-25 22:49:08 +01:00
Ashod Nakashian
c851c3e93b wsd: correctly remove request from socket buffer
POST requests require the full request to be
left in the socket buffer to be parsed in full.
But GET requests, especially WS upgrade, must
have the request cleared from the socket, as
there is more data expected to be read after
the upgrade, which happens by the DocBroker
thread, so clearing the buffer must be done
before the upgrade.

This patch accomodates these two conflicting
cases and refactors the code slightly to
make it more structured and readable.

Change-Id: Ia7357a745a3900f986099ba14af2a0946023018b
Reviewed-on: https://gerrit.libreoffice.org/36873
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-24 06:49:33 +02:00
Ashod Nakashian
95d51493aa wsd: remove nextmessage
This was a workaround to Poco's limitation
of requiring socket receiveFrame be given
preallocated buffer, which couldn't be
exceeded by a larger payload. This meant
the receiver had to know the maximum
payload in advance.

Since only the Kit uses Poco sockets,
and the Kit never receives large payloads,
this preamble is now obsolete.

100% (94/94) of old-style tests PASS.

Change-Id: I76776f89497409e5755e335a3e25553e91cf0876
Reviewed-on: https://gerrit.libreoffice.org/36037
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:18:09 +00:00
Ashod Nakashian
17fc91e220 nb: process POST requests
These are really GET requests that aren't
WebSocket upgrade. Should rename to something
less misleading.

Re-enabled testSlideShow which depended on this.

Change-Id: I52b7f67b650fcdcbae7c2bff020b756099263141
2017-03-10 10:47:41 +01:00
Ashod Nakashian
3a79e13214 wsd: use MAX_CONNECTION from configure instead of hard-coded MAX_SESSIONS
Since we always need to set the thread-pool size
anyway, we cannot have 'unlimited' connections.

Actually, we never did, so that was misleading
in configure.ac anyway.

The current defaults are 20 connections and
10 documents, instead of the previous 1024
connections.
The reason for this "low" limit is to
enable unittesting these limits automatically
for the default configure.

There is also a lower-limit (needed by unittests
and internal technical requirements) of 3 connections
and 2 documents.

Change-Id: I6ccf3a607c50bb2a86bf1c0a16ebb6326ee34c7d
Reviewed-on: https://gerrit.libreoffice.org/32712
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-04 04:29:18 +00:00
Miklos Vajna
721003512e IoUtil: avoid multiplying at int precision, then comparing to long
Here:

if (payload.capacity() > READ_BUFFER_SIZE * 4)

Change-Id: I12e090d03b471b7394a4898d5e1a74992182051e
2016-12-01 18:15:58 +01:00
Jan Holesovsky
e15ec1d33b These constants are not needed any more.
Change-Id: I5e73d4eacdf5e88f11bc3755162fe601a65417fe
2016-11-28 11:33:20 +01:00
Ashod Nakashian
6ab32e0aa9 loolwsd: use larger threshold to large messages
Messages larger than a certain size are preambled
with a 'nextmessage' message that hold the size
of the subsequent message.

This is a workaround to a limitation the Poco
WebSocket API where if the buffer size is
smaller than the received frame the socket
ends up in a bad state and must be closed.
Unfortunately the new API that avoids this
workaround is not yet released by Poco.

Here we minimize the need for 'nextmessage'
to truely large messages. The limit is now
raised from above 1KB to over 63KB.

We may raise this limit further, but that will
cost each socket that much dedicated buffer size.

Change-Id: I01e4c68cdbe67e413c04a9725152224a87ab8267
Reviewed-on: https://gerrit.libreoffice.org/31286
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:54:37 +00:00
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00
Renamed from loolwsd/Common.hpp (Browse further)