Commit graph

421 commits

Author SHA1 Message Date
Ashod Nakashian
5dc8e815c4 wsd: logging: color trace differently to improve readability
Change-Id: I5127061f4d62122d07bad32d4757569f1a9cc877
Reviewed-on: https://gerrit.libreoffice.org/80321
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 48387b00077b9baa72508c05e3fc3228a4569998)
Reviewed-on: https://gerrit.libreoffice.org/81559
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-10-28 10:45:31 +01:00
mert
86489d3dcd Include normalizedViewId to TileCache
Change-Id: Ib23afa023d79189f7fd7aca8b5b0e198c3011fbc
2019-10-15 18:13:03 +03:00
Ashod Nakashian
77e7cae689 wsd: fix password-protect file loading from multiple views
With password-protected files, the first loading attempt
always fails due to missing password. At that point the
client is notified of the missing password and the user
is prompted. The second attempt includes a (hopefully)
correct password and the document loading commences.

Due to the fact that an exception is raised when
the loading fails, this left the loading latch
triggered, which blocked subsequent attempts.

Change-Id: I7cc257a36eb1cc080f460aac8cdb7030783a5914
2019-10-14 21:35:27 +01:00
Michael Meeks
1b7d962607 Avoid lots of re-sizing of token array while parsing.
Change-Id: I009d1203838fa2d585bd415836fc6338f47e2be3
2019-10-08 17:58:57 +01:00
Andras Timar
d1ae1b36c2 typo fixes in comments and code
Change-Id: Idd98516d30d98dea18eda9bbec8ac9777063b553
2019-10-08 11:49:45 +02:00
DarkByt31
dd014e7029 tdf#107038 Poco::Timestamp replacement with std::chrono
Util added getHttpTime
WhiteBoxTests added test for getHttpTime

Change-Id: Ifb6a3fb2dc9b059b925e7b881362b72759a8b56b
Reviewed-on: https://gerrit.libreoffice.org/79754
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-09-28 12:26:32 +02:00
Ashod Nakashian
f7bd2c7e1d wsd: fix variable might be clobbered by ‘longjmp’ or ‘vfork’
As the comment details, this avoids having C++ objects
in the same frame as setjmp, which may reset their
contents without the dtor getting called.

Change-Id: I851ae8bffb4356d465a25dfc815a1fecb489fa30
Reviewed-on: https://gerrit.libreoffice.org/79338
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-09-22 20:24:36 +02:00
Ashod Nakashian
82a34a6cb4 wsd: improved logging of thread renaming
The thread name helps one track threads in logs.
When renaming threads it's important to log the process
and previous thread name (if any), so grepping is more
fruitful and tracking is easier.

Change-Id: I47a948d77629b387cc1e9fd58fdd88e1ae1168df
Reviewed-on: https://gerrit.libreoffice.org/79327
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-09-22 20:21:18 +02:00
Tor Lillqvist
a7362d52ac Use portable format conversion specifier for uint64_t
Avoids a warning when compiling for iOS: format specifies type
'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned
long long').

Change-Id: I8b5205dd0c3a8ae2f531f1647b3e3bac27ea6065
Reviewed-on: https://gerrit.libreoffice.org/78985
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2019-09-16 13:52:14 +02:00
Tor Lillqvist
f89264047c Fix build failure in the MOBILEAPP case
We never exit an app process intentionally, so Log::isShutdownCalled()
can always return false.

Change-Id: I6b3cce85ccac5e3ffbb7b29ca552cb9e4441df2a
Reviewed-on: https://gerrit.libreoffice.org/78979
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2019-09-16 13:32:57 +02:00
Miklos Vajna
71a942c24b Log: rename isShutdown to isShutdownCalled
Class members that differ only in case are not great.

Change-Id: I2e54bf9b6da7e4e15e03389000a6ff86e98c16a6
2019-09-16 11:52:15 +02:00
Miklos Vajna
f8140acac7 Avoid static member access through instance
Change-Id: Ifbfdfbb0d5b6020908d041904b61a2ed3b8255c1
2019-09-11 12:23:59 +02:00
Miklos Vajna
a7d836dd7c Fix UB in unit-wopi
net/Socket.hpp:405:9: runtime error: member call on address 0x6070007a2210 which does not point to an object of type 'Poco::Logger'
0x6070007a2210: note: object has invalid vptr
 05 00 80 0e  7c 01 80 6f 3c 7f 00 00  c8 b8 0f 01 3c 7f 00 00  00 00 00 00 be be be be  38 22 7a 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              invalid vptr
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior net/Socket.hpp:405:9 in

Which is use-after-free: once Poco::Logger::shutdown() is called, we
need to tolerate LOG_DBG() and other similar calls, even if they don't
go anywhere.

Change-Id: Ic76433743177dd2b604ff34e340309c506d83350
2019-09-09 15:41:09 +02:00
Michael Meeks
79637655f6 Avoid PRIx64 format - we are 64bit only, so lx will do.
Fixes RHEL6 compilation problems around inttypes inclusion / definition.

Change-Id: I4f4647c7954c32d90dad94a43c630af24d551d78
2019-09-05 22:53:09 +01:00
Michael Meeks
6d1cc6c01d Avoid using std::get_time to compile on older Linux.
Change-Id: I862e5f342ea485a9b65b413ab0c1bdea4f5fbb8d
2019-09-05 14:10:20 +01:00
Tor Lillqvist
80ddb46392 Fix portability problems after 22f1656e08
It is std::chrono::system_clock that has to_time_t.
std::chrono::steady_clock does not have to_time_t.

std::chrono::high_resolution_clock is either the same as system_clock
(in libstdc++, on Linux) or steady_clock (libc++, on iOS).

(This change does not fix the actual bugs in the code, just makes it
compile for iOS. The new ISO8601 fractional time code is not unit
tested at the moment. The testTime() function is not part of the test
suite in WhiteBoxTests.cpp. If it is made part of it, it reveals
problems in the code (and/or in the unit test code).)

Change-Id: Id33342bc8b26465632f3d21d6ec2f3c975ae3681
Reviewed-on: https://gerrit.libreoffice.org/78550
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-09-03 13:50:27 +02:00
Ashod Nakashian
36b5109d21 wsd: cosmetic formatting
Change-Id: I552b2468432ce6ed52c50e22b6f19d8055c5dbb1
2019-09-03 01:53:12 -04:00
DarkByt31
22f1656e08 tdf#107038 Poco::Timestamp replacement with std::chrono
Added functions to get file timestamp and to convert
chrono timestamp in ISO8601 fraction format and some
test cases.

Change-Id: I58961a31f7262b367cff9f33cffdec7571a2f8f7
2019-09-02 15:50:37 -04:00
Michael Meeks
f384b8a414 Add watermark opacity setting.
Change-Id: I839e8aef91acfed40d4afd8c1b50176ed54c670a
2019-08-26 16:29:12 -04:00
Ashod Nakashian
f1aa98af75 wsd: Use unordered map for anonymization
And simplify the trace-logging enablement check.

Change-Id: I4f5c9e08912b8dbc708b191b80032660ce4e1ba0
Reviewed-on: https://gerrit.libreoffice.org/70742
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71093
2019-08-17 04:28:07 +02:00
Ashod Nakashian
919a93cd4b wsd: improved anonymization algorithm
Better hashing algorithm based on FNV-1a.
Adds support for salting the hash, and
for providing salt via configuration.

More unit-tests added, and better formatting.

Change-Id: I2be42675d0cdbaa73c3d7faed99e07631a9c20fc
Reviewed-on: https://gerrit.libreoffice.org/70034
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71091
2019-08-17 04:26:35 +02:00
Ashod Nakashian
c6c673ed6f wsd: cache the logger instance to avoid costly lookups
Change-Id: Idf9261d46b44afc42a960146886c180e37d8d51f
Reviewed-on: https://gerrit.libreoffice.org/69641
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/71085
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-08-17 03:38:43 +02:00
Miklos Vajna
13884468c3 common: fix UB in vectorAppend()
unit-copy-paste with ubsan failed with:

common/Util.hpp:751:43: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:43:28: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior common/Util.hpp:751:43 in

Change-Id: I71ae9b43a63f979c300d704419afc9a14cd303cd
2019-08-15 08:38:07 +02:00
Miklos Vajna
9a7768b420 common: wrap SigHandlerTrap in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
SigHandlerTrap:

==26186==ERROR: AddressSanitizer: odr-violation (0x000002090ae0):
  [1] size=40 'SigHandlerTrap' ../common/SigUtil.cpp:76:12
  [2] size=40 'SigHandlerTrap' common/SigUtil.cpp:76:12
These globals were registered at these points:
  [1]:
    #0 0x5f9a28 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f8f537f1d8b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ad8b)

  [2]:
    #0 0x5f9a28 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2bcfe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2bcfe)

Change-Id: I54d5f6d4298848cacd437d302cff0e8c5003fb8c
2019-08-13 09:08:32 +02:00
Tor Lillqvist
98dab7d74f Avoid assertion failure in the iOS app
There is just one process, and the UnitBase::Global is dummy, its type
is irrelevant.

Change-Id: I73fd0c32e50dd698161f25dbc3f4c8655776286a
2019-08-12 13:20:52 +03:00
Miklos Vajna
1263694944 common: wrap ShutdownRequestFlag in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
ShutdownRequestFlag:

==13663==ERROR: AddressSanitizer: odr-violation (0x00000208f860):
  [1] size=1 'ShutdownRequestFlag' ../common/SigUtil.cpp:60:19
  [2] size=1 'ShutdownRequestFlag' common/SigUtil.cpp:60:19
These globals were registered at these points:
  [1]:
    #0 0x5f9a18 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f9b903f1d0b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ad0b)

  [2]:
    #0 0x5f9a18 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b9fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b9fe)

Change-Id: I247760325f804813249e814dbb4576493619dee7
2019-08-12 09:03:42 +02:00
Miklos Vajna
35646b7bf9 common: wrap DumpGlobalState in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
DumpGlobalState:

==5783==ERROR: AddressSanitizer: odr-violation (0x00000208f7a0):
  [1] size=1 'DumpGlobalState' ../common/SigUtil.cpp:49:19
  [2] size=1 'DumpGlobalState' common/SigUtil.cpp:49:19
These globals were registered at these points:
  [1]:
    #0 0x5f9a08 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f5c5edf1c9b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ac9b)

  [2]:
    #0 0x5f9a08 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b98e in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b98e)

Change-Id: I4b7b0238eb9b38a30875e8788c1dcb27f1d1643f
2019-08-09 09:23:17 +02:00
Miklos Vajna
bd4d72d41f common: wrap TerminationFlag in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
TerminationFlag:

==11732==ERROR: AddressSanitizer: odr-violation (0x00000208f4a0):
  [1] size=1 'TerminationFlag' ../common/SigUtil.cpp:41:19
  [2] size=1 'TerminationFlag' common/SigUtil.cpp:41:19
These globals were registered at these points:
  [1]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f5df9cf18cb in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60a8cb)

  [2]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b4fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b4fe)

Change-Id: Ic620b143ecb77699f40676ff39d0fa7abceb34d5
2019-08-08 09:10:59 +02:00
Michael Meeks
9e791fb0d4 clipboard: persist selections for a while after a view closes.
re-factor ClientSession state to be a simpler state machine.
Have a nice disconnect / disconnected handshake on view close.

Change-Id: Ie933cc5c7dfab46c66f4d38a4d75c459aa1cff87
2019-08-05 22:21:54 -04:00
Szymon Kłos
610c2aaf23 Fix ParseError on valid data
Change-Id: I0706030d9933313e44ae89b92b62576dacbf7e9e
2019-08-05 21:28:09 -04:00
Szymon Kłos
7f6af05213 Sync request with clipboard parser
Allow to use multiple clipboard streams.

Change-Id: Ib98a7c1db8738145138fa3657e94c404260e4a28
2019-08-05 21:28:09 -04:00
Ashod Nakashian
e7cec81846 Fix build - potential use before initialization
Change-Id: I5d9db13b0241af64fa8e9eb9528a6e460166f280
2019-08-05 21:18:57 -04:00
Michael Meeks
13469e8b00 clipboard - set it with a post now.
Change-Id: I6b9234988185984335408da502f479ccda8a95a7
2019-08-05 21:18:44 -04:00
Michael Meeks
149b861975 clipboard: a more helpful calc test.
Change-Id: Ibe0e583a2019e7bc5968dd8f73cf4e4a07d363b2
2019-08-05 21:18:27 -04:00
Michael Meeks
9726ce6f77 Various copy/paste fixes, unit test passing, parsing of result.
Change-Id: I9168853dd011e86896c3bd474a4d05ee82c0e336
2019-08-05 21:18:12 -04:00
Michael Meeks
7f4a7404cc Add hard random/hex key generation utility.
Change-Id: I8bb95153a5bd63a6b41edf65a0fdf0ebd52ad070
2019-08-05 21:08:07 -04:00
Michael Meeks
4a9de331ed Unit testing - add more hooks and helpers.
Change-Id: Ieb12699e3b012606eaa0be3cc94d6f9b58adc441
2019-08-05 21:08:01 -04:00
Michael Meeks
c36da1cd97 Implement getClipboard and start of a unit test.
includes Change-Id: I47d38f9285c855dcc6fbeeb73d35f22a46a30c05

Change-Id: I60b84bef1cf832ec5c191d664afd90a080b7ffbc
2019-08-05 20:25:49 -04:00
Michael Meeks
52e477e57e Switch to text/html for paste where we can.
Build special URLs to detect the same host being in-use, and much more.

Change-Id: I0ca639ea416cb78bf5e5274eac4400542b6b2cda
2019-08-05 15:47:47 -04:00
Michael Meeks
f2c6facb29 Don't combine tiles a long way from each other.
We currently combine only horizontally, but ctrl-right arrow in
calc can throw us to the other side of the sheet, creating a very
large area to re-render.

Change-Id: I7125ab815e3de1296b3af32632626005eeee0ec9
2019-07-26 10:12:00 +01:00
Henry Castro
760864870f wsd: introduce "TemplateSource" WOPI property
Change-Id: I9df1d5d0d4be7fe10ee15c40c36195c86ccf857e
Reviewed-on: https://gerrit.libreoffice.org/76190
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2019-07-24 12:10:15 +02:00
Samuel Mehrbrodt
b40cf51181 Log fatal errors also to stderr
Change-Id: I5e6429ab007d13a2506c375923049b91c80ffba0
Reviewed-on: https://gerrit.libreoffice.org/72722
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2019-06-04 09:09:37 +02:00
Tor Lillqvist
199c6e2918 Revert "Get rid of use of GNU libtool" and its follow-up
The change causes problems for people on various sad distros. Oh well,
whatever.

This reverts commit bd00d9fd05.
This reverts commit 054a9cdb04.

Change-Id: Ie439e4c655d02b6f34bdd1a9c1c5b6db6048b653
2019-05-27 10:25:51 +03:00
Tor Lillqvist
bd00d9fd05 Get rid of use of GNU libtool
It is is complicated enough to build the iOS app. Requiring GNU
libtool brings with it the risk of polluting the command environment
as there already is a completely different command in macOS with the
same name, /usr/bin/libtool. And as GNU libtool was used only to build
the unit tests for the "normal" server-based Online that are built and
run only on Linux anyway, we don't really need any of the
"portability" that GNU libtool brings.

Without GNU libtool, we compile all the $(wsd_sources) (see
test/Makefile.am) that the unit-* tests use into a single object file,
WsdSources.o. (Because they need to be compiled as PIC we can't use
the already compiled object files for the Online server programs.)
This required some additional minor changes to a few source files.

Change-Id: I20a2c523170376fa4c1a0d9d8d6b693a9779376f
Reviewed-on: https://gerrit.libreoffice.org/72840
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2019-05-24 09:50:16 +02:00
Samuel Mehrbrodt
6e87ebc91e 1GB should be enough for development
Change-Id: I7567f99c4cf54a25084e25b44887b7906bbc7b06
Reviewed-on: https://gerrit.libreoffice.org/72827
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2019-05-23 12:38:31 +02:00
Tor Lillqvist
977ca9a353 Drop unused variable
Change-Id: I927440f3c05956f3f244f6bc657a76a58e839231
2019-05-23 13:26:05 +03:00
Michael Meeks
9d723cb230 Initial chunked transfer encoding.
Important for convert-to on larger documents and/or with newer curls.

Change-Id: Id18be6d22741a3af7cee39a069c509e4f662977b
2019-05-22 11:07:42 +01:00
Michael Meeks
046ab32e46 Use compile-time rather than run-time string concatenation.
Saves some time & space.

Change-Id: If1e62056447fb7e8f26e8cf107451876adf3fecb
2019-05-20 12:30:01 +01:00
DarkByt31
8e34705fe2 tdf#107038 Poco::DateTimeFormatter with Util::getHttpTimeNow()
Added a function to Util to get current time in HTTP
format using std::chrono.

Change-Id: I9e7a732f585c1758c9348c450a01713a66f1e7b7
Reviewed-on: https://gerrit.libreoffice.org/72585
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-05-20 11:53:13 +02:00
Michael Meeks
289894c66c debug: show WebSocketURI & a unique host id in help -> about.
Rather useful for debugging clustering issues.

Change-Id: I6d5f224bf8a3e4034c419137c8ad2b17fdf265ed
2019-05-17 13:24:32 +01:00
Tor Lillqvist
d9e5a47058 Introduce new flag to speed up shutdown of the Online plumbing in the iOS app
Spent hours on trying to cleverly use the existing TerminationFlag
(with minor modifications to the code that checks it, and some
additional code to set and reset it), but could not get it to work.
This is simpler, but sure, using a global variable is ugly of course.
At least the new MobileTerminationFlag is very specific in semantics
and only used in the mobile apps.

Change-Id: I0775fdfa7880750ca12c6fd7ec41d3d3ceb2f0ad
2019-05-16 11:44:41 +03:00
Tor Lillqvist
ebda7c6b8b Use same kind of thread id as Xcode and osl_getThreadIdentifier() on iOS
Reduce the number of different kinds of identifiers for threads that
are displayed in various places. Use the number that you get with
pthread_threadid_np(), in hex, which is the same that Xcode (i.e.
lldb) displays in its "thread list" command. It also is the same
number that osl_getThreadIdentifier() returns.

Change-Id: I0c14ad99badd7e742d15b7d1f37037fa66c892b4
2019-05-16 11:42:19 +03:00
Tor Lillqvist
8ae35c6348 No need to call Log::shutdown() in a mobile app
The process never exists voluntarily. It is killed by the OS when
inactive and its resources are needed.

Change-Id: I9a7fa8200a44bba8dfcd2b09882f1b87814025be
2019-05-16 11:41:08 +03:00
Michael Meeks
638fb0316d unipoll: restore missing asserts & some cleanup.
Change-Id: I4277b5e044ead54d91bc834ea05bec649a608678
2019-05-10 17:37:59 +01:00
Michael Meeks
73dc711e0a Unipoll: terminate repeated polling loop on wakeup.
Wakeup wakes up the nested SocketPoll::poll nicely, but that's no
use if we immediately ignore that and re-poll, so shorten the
timeout in this case.

Change-Id: I927d2375b92c9ce6c6ebe3f0ab33e2863894e2ef
2019-05-10 15:13:40 +01:00
Michael Meeks
956f8bf5e8 Unipoll: move event processing into the same thread.
Change-Id: I15aff3b5f18201eca915da94dbaa05148026e244
2019-05-10 14:43:27 +01:00
Ashod Nakashian
8136bbc1b5 wsd: parse empty json string as empty map
Change-Id: I11335e82e42e9f896ae33c2e57cb9d79b642171e
Reviewed-on: https://gerrit.libreoffice.org/69633
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71097
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
2019-05-08 20:38:27 +02:00
Michael Meeks
685709080d Revert attempts at re-using ostringstream
Cleaning up the thread variable with the shared string stream is
    something of a nightmare, for a rather marginal gain.

    ==9296== Invalid write of size 1
    ...
    ==9296==    by 0x738C092: str (sstream:195)
    ==9296==    by 0x738C092: std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::str(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (sstream:649)
    ==9296==    by 0x65383A: Log::beginLog[abi:cxx11](char const*) (Log.cpp:141)
    ==9296==    by 0x551823: Admin::~Admin() (Admin.cpp:381)
    ==9296==    by 0x7D9ECF7: __run_exit_handlers (exit.c:83)
    ==9296==    by 0x7D9ED49: exit (exit.c:105)
    ==9296==    by 0x7D86F50: (below main) (libc-start.c:342)
    ==9296==  Address 0x8ba41c0 is 0 bytes inside a block of size 513 free'd
    ==9296==    at 0x4C2FA1D: operator delete(void*) (vg_replace_malloc.c:576)
    ...
    ==9296==    by 0x738784A: ~basic_stringbuf (sstream:65)
    ==9296==    by 0x738784A: std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream() (sstream:591)
    ==9296==    by 0x7D9F27E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    ==9296==    by 0x7D9EC0A: __run_exit_handlers (exit.c:41)
    ==9296==    by 0x7D9ED49: exit (exit.c:105)
    ==9296==    by 0x7D86F50: (below main) (libc-start.c:342)

    Good to log during shutdown / exit.

This reverts commit c315d219d5967f23fb1769e78021f61b8f9da6ec.
This reverts commit ce78fec310.

Change-Id: Ia4a15be336d89d8d883530943724d48e4b0ec9fe
Reviewed-on: https://gerrit.libreoffice.org/71444
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-04-27 23:18:11 +02:00
Michael Meeks
c2c5bd0e3e Reset the stringstream properly.
Avoids some N^2 log-line explosion; also make the method name
more findable.

Change-Id: I3ee8c521f1ac98a939cd4d758c720b577d3bfa57
Reviewed-on: https://gerrit.libreoffice.org/71443
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-04-27 23:03:16 +02:00
Ashod Nakashian
ce78fec310 wsd: reuse ostringstream when logging
This is faster and reduces memory fragmentation.

Also, cleans up the logging macros and implementation.

Change-Id: I7fb00da041d1261c694c4b48b67a3c66ad0cbf8d
Reviewed-on: https://gerrit.libreoffice.org/71020
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-04-23 03:01:00 +02:00
Ashod Nakashian
ed0efde542 wsd: use thread_local instead of __thread
The former is the standard C++ approach
and is reportedly faster than __thread
(at least with gcc).

Change-Id: Ibdefd32172774a280637f73dd062282b7bf62025
Reviewed-on: https://gerrit.libreoffice.org/71019
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-04-23 03:00:44 +02:00
Ashod Nakashian
e76d27188e wsd: use fast deflate level for png
The default deflate level of 6 is quite slow
and the benefits are hardly worth the high
latency that users experience.

Tested on a writer document with some small
images and a few pages of text:

Level 4 gives virtually identical compression
ratio to level 6, but is between 5-10% faster.

Level 3 runs almost twice as fast as level 6,
but the output is typically 2-3x larger.

Perhaps this should be exposed via config
so it would be possible to reduce latency
due to compression when CPU is scarce but
network bandwidth ample, and vice versa.

Change-Id: Iba88eea8f180d11458b33c68389e797234df1a60
Reviewed-on: https://gerrit.libreoffice.org/71018
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-04-23 03:00:31 +02:00
Ashod Nakashian
90c8dd41b9 wsd: logging, comments, and const correctness
Change-Id: Ibfbef282e951a80fb145239df4bbcc9f3e4c8e13
Reviewed-on: https://gerrit.libreoffice.org/71017
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-04-23 03:00:19 +02:00
Michael Meeks
81a27e26aa Switch local prisoner sockets to abstract UDS
Unix Domain Sockets are inaddressable remotely, and more efficient,
as well as allowing future SCM_CREDENTIALS / SCM_RIGHTS.

Change-Id: Ia2472260f75feb43e9022cdfa0fe005ccd489454
2019-03-30 16:51:06 +00:00
Tor Lillqvist
25c8ed7897 For iOS, generate the data: URLs for the PNG tiles already in the Online code
(What we cache is also the textual data: URLs even if we store them
using .png file names.)

This avoids the current back-and-forth-encoding: First we
base64-encode the complete binary "tile:" message (one text line
followed by a newline and the binary PNG) to pass to WebKit, then in
the JavaScript snippet passed to WebKit we decode the base64 and turn
it into an ArrayBuffer, and then we unpack the ArrayBuffer and encode
the PNG part to use as a data: URL.
2019-03-22 16:21:51 +02:00
Michael Meeks
5627c767ab Anonymization: don't log when it is disabled.
Also fix unexpected concatenation error in Poco::URI::encode generating
eg. authorid=localhost0 xauthorid=localhost0localhost0 in the output.

Change-Id: I560e47e31884eeb1c662f468436ed7541cfb082d
2019-03-15 11:27:38 +01:00
Tor Lillqvist
a1feac0c24 Fix -Werror=stringop-truncation: Make sure FatalGdbString is NUL-terminated
(Note that when I say 'NUL' I mean the ASCII character called NUL,
i.e. a zero byte. Not to be confused with 'NULL'.)

Why FatalGdbString has to be a C style fixed size char array I don't
know. Or wait, I do know. Because SPEED!!! And using C strings safely
is trivial.

Change-Id: Id28b00a6e3219cf6f015c4209732f33216f83b22
2019-03-06 11:48:33 +02:00
Michael Meeks
36e9d5b376 TileCache: re-factor API to work in terms of vectors, not file references.
Change-Id: Ia9d48773121ab965b79ddb16b55b5d3fdcd7fd5c
2019-02-14 21:46:39 +01:00
Michael Meeks
f98a7f0592 Improve unit test / SSL handling & detection.
Change-Id: I6bd3116ac94d3d2c61e2ec543cb17896834ef2df
2019-02-13 18:24:36 +01:00
Jan Holesovsky
7b48434d0d android: Better logname for the native part.
Change-Id: I25d091075def09b605d8fcd8cf4f956b6569f90d
2019-02-13 17:33:53 +01:00
Jan Holesovsky
7f0f6e5a36 android: Restart if anything goes wrong.
But sleep for a bit of time between the runs to avoid a busy loop.

Change-Id: I90a7bee052d82e8a0488e6a34fb1b6f43e6f6e64
2019-02-13 16:37:54 +01:00
Jan Holesovsky
73b93777f7 android: Implement logging to logcat.
Change-Id: I68d7861af019a24d9ecd80782cca38d09485345d
2019-02-13 16:08:01 +01:00
Jan Holesovsky
f76b36193d android: #if(n)def MOBILEAPP -> #if (!)MOBILEAPP for better reliability.
Change-Id: I5f9c9420b6c83601db1c8fdba4ae5a10b17b2107
2019-02-12 12:20:11 +01:00
Jan Holesovsky
df5565674e android: Fix minor build issues. 2019-02-12 10:50:40 +01:00
Jan Holesovsky
e60421e5d5 android: No execinfo.h on Android (yet). 2019-02-12 10:50:40 +01:00
Miklos Vajna
daa3384b53 UnitHTTPServerRequest: make members private
None of this was used by subclasses.

Change-Id: Iaaa3e726e9aabec581f2c0599f65d7513e0a0e07
2018-12-17 09:15:05 +01:00
Miklos Vajna
b1f06d1c0a FileUtil: make fs members private
Change-Id: I921118c42a20117725074169f6425e9ff87bc54b
2018-12-10 08:55:39 +01:00
Ashod Nakashian
33aff0ce61 wsd: utility to parse integer lists
A quite common logic that is best moved to a utility
and optimized for best performance.

Includes unit-tests.

Change-Id: Id63a388690c17355eb2fac529070c38e9b082fd0
2018-12-07 12:39:27 +01:00
Miklos Vajna
da8785ed50 Log::StaticNameHelper: make members private
Change-Id: I7c46dc6757b98867c4893ee019b3fd6d903020fc
2018-12-04 09:06:58 +01:00
Tomaž Vajngerl
73c8fa9d09 Extract Authorization out of Auth and put it into common
This is needed so we can use this inside ChildSession.

Change-Id: I88f2cc767412fd52dbb242938f0f9897d4277639
Reviewed-on: https://gerrit.libreoffice.org/63836
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2018-11-29 21:47:13 +01:00
Tor Lillqvist
235c9b8a60 Use getAbbreviatedMessage() for its intended purpose
Don't log a potentially very long message in its entirety.

Change-Id: I01fbf76465d99bbab117d1dcacc6c7239a1da518
2018-11-29 01:07:03 +02:00
Miklos Vajna
e167cd173b StreamLogger: make members private
Change-Id: Ie9ec09a9b7b8885bd97e62bd65df27cf1454c408
2018-11-19 09:06:10 +01:00
Miklos Vajna
d52cf35418 MessageQueueBase: make members private
Change-Id: I65360bc23475b25b2c626ea75186e8863fc74b8f
2018-11-16 09:06:17 +01:00
Miklos Vajna
0122ba2a6a CursorPosition: make members private 2018-11-15 09:07:38 +01:00
Miklos Vajna
63bf882f73 Rectangle: make members private 2018-11-14 09:07:54 +01:00
Miklos Vajna
cd08cbf385 Session: make members private 2018-11-13 09:04:19 +01:00
Michael Meeks
fa74404019 Add a time limit for badly behaved / huge document load / conversions.
Also improve debug printing of load times in dumpstate.

Change-Id: Ib3fd70dffb57588cd90bd928c4be9890cee8bc65
2018-11-08 01:27:40 +00:00
Tor Lillqvist
2d1c865dd5 Use std::memcpy() here for consistency
Change-Id: I295b1db38333935ccf6efc4c2232bc2db8e84dd5
2018-11-02 16:20:49 +02:00
Tor Lillqvist
224bdad365 Use faster PNG compression in mobile app
Also, log the average time taken for PNG compression of tiles.

Change-Id: I720f55dc44bd6729dce710e3b781a7239a8bf585
2018-11-01 02:32:56 +02:00
Miklos Vajna
22fac18fcd WebSocket: make members private
All of them were protected, but only _socket was used actually. Add a
protected setter/getter for that field.
2018-10-24 09:36:13 +02:00
Tamás Zolnai
0bb8b7c7a8 Add /hosting/capabilities endpoint to advertise online features
Add an entry to discovery.xml with the urlsrc where capabilities end
point can be found. Use json format to send back the feature list.

Change-Id: I390a53d956d53ca79e5a8090aead7f4131ec4ca0
2018-10-19 18:15:22 +02:00
Tor Lillqvist
b7a42bd9d1 Add a FIXME 2018-10-19 02:02:54 +03:00
Tor Lillqvist
351193e1b7 Don't bother logging the full pathname __FILE__ on iOS 2018-10-17 12:54:36 +03:00
Tor Lillqvist
5f01fbdf81 The iOS memrchr() replacement should of course be marked inline 2018-10-17 12:34:49 +03:00
Tor Lillqvist
0d8912ffe9 Test also looking for the last char 2018-10-17 11:55:19 +03:00
Tor Lillqvist
b90fafa54f Adapt to change in LOG_BODY_ parameters 2018-10-17 11:48:22 +03:00
Tor Lillqvist
ccc7d2133d "The memrchr() function is a GNU extension, available since glibc 2.1.91."
Thus it doesn't exist on iOS, so add a trivial implementation. Include
an (ifdeffed out) unit test for it.
2018-10-17 11:46:56 +03:00
Jan Holesovsky
9a8e4fc0e8 wsd: safer string splitting
Reviewed-on: https://gerrit.libreoffice.org/57644
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit 17d1fdda7a0c29df12c43b956418c83b59bfe0da)

Change-Id: I88b82a3754c4f5e280f00be8e27614c3fe49eff8
2018-10-16 20:12:23 -04:00
Ashod Nakashian
9bfe8b70e2 wsd: don't warn on missing json
Change-Id: I28086152fbf9fc82ddead1a2feb80f21ffdcd208
(cherry picked from commit 7b48be5a9dde4fcec01b8804559ffa4f9c19d53c)
2018-10-16 20:12:23 -04:00
Ashod Nakashian
b6333ada8d wsd: anonymization improvements and unittests
Also support anonymization of downloadas documents
and renaming of documents.

Reviewed-on: https://gerrit.libreoffice.org/57541
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 78248a542c9ca31bf9ad4cad9b55d78690384395)

Change-Id: I81a80e6290217659987d73f625e5f0fb81cb7ef2
2018-10-16 20:12:23 -04:00