This is meant to reduce lots of small allocations and instead have
pointers into the single string for the various tokens instead.
This has a few requirements, though:
1) It's no longer OK to modify the tokens, changing their length would
invalidate the start/length of other tokens. Rework
DocumentBroker::load() to avoid such mutation.
2) The iterators no longer expose zero-terminated strings, so
Poco::cat() doesn't work anymore: add an own cat() instead and use that
in e.g. ChildSession. The own cat() has the benefit that it won't read
past the end of the array if the begin index is out of bounds to add
more safety.
(This nicely works towards killing Poco usage in general.)
3) If zero-terminated strings for all individual tokens is needed, a
copy has to be made, as done in spawnProcess().
(For all of these requirements, the build fails if there are problems.)
Change-Id: Iea40e4400e630b2d669f5c72aea85cb40edf9a2c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89711
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
The bulk of this commit just changes std::vector<std::string> to
StringVector when we deal with tokens from a websocket message.
The less boring part of it is the new StringVector class, which is a
wrapper around std::vector<std::string>, and provides the same API,
except that operator[] returns a string, not a string&, and this allows
returning an empty string in case that prevents reading past the end of
the underlying array.
This means in case client code forgets to check size() before invoking
operator[], we don't crash. (See the ~3 previous commits which fixed
such crashes.)
Later the ctor could be changed to take a single underlying string to
avoid lots of tiny allocations, that's not yet done in this commit.
Change-Id: I8a6082143a8ac0b65824f574b32104d7889c184f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89687
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Also access token is already passes decoded to GetProofHeaders,
so don't decode it second time.
Change-Id: I7c4404462a9dd9f53e4e82684b1fcae1aeecee73
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88736
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Cookies may be passed from the client to the storage,
in which case each user may have its own unique set
of cookies. These cookies are now preserved in the
ClientSession, which is per connection, and are then
passed to the storage to use when communicating with
the WOPI-like backend.
(cherry picked from commit 6022faf3cc9b622b490c3f8ca91efbff8e542414)
Change-Id: Ic2e13fa541a5ee01b7383939bbbf7d46ea75684b
When trying to open a link normally from help->Online help
nothing happens but the popup is closed.
When trying to open a like forcefully in new tab
from help->online help it crashes the server.
Change-Id: I7e0944ebe521002625a84e155e379ed7e25d2309
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/85466
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
No Admin.hpp needed (which would cause a conflicting definitions of a
class called Document when compiling Kit.cpp).
No locks "supported" in the way the code expects for WOPI-like things.
Change-Id: Ie43311af054f2940576ce9b2b13520f24887628e
Reviewed-on: https://gerrit.libreoffice.org/84018
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
in loolwsd.xml. If set, watermarks will be the same
as entered for all the views instead of per view
watermarks sent in CheckFileInfo
Change-Id: I0943520423abc2567f44920f8679057b3cfbf01f
Reviewed-on: https://gerrit.libreoffice.org/83666
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
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>
Clients often need to communicate with their wopi hosts when
invoking Action_Save to provide more context when storing the
document in question. Action_Save now support passing arbitrary
string as ExtendedData entry that can be used by client to
pass any context or otherwise flags to the WOPI host, which
will receive it via the X-LOOL-WOPI-ExtendedData custom header.
See reference.html for more details.
Change-Id: I1814d1f3d984a553ffa60cec13d23b014ba59eb3
Reviewed-on: https://gerrit.libreoffice.org/74135
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Added functions to get file timestamp and to convert
chrono timestamp in ISO8601 fraction format and some
test cases.
Change-Id: I58961a31f7262b367cff9f33cffdec7571a2f8f7
This simplifies the anonymization configuration
as virtually always they are all either enabled
together, or not at all.
Change-Id: I6fe60f5287fc5d71cd7a6ac3268eac67e5e6e9fb
Reviewed-on: https://gerrit.libreoffice.org/70033
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71090
The Download_As is emitted when the user chooses 'Print' or 'Show
slideshow' or 'Download As [some type'] and the integration indicates
via DownloadAsPostMessage in the CheckFileInfo that it wants to handle
the downloading of pdf for printing or svg for slideshows or experted
document.
This is particularly useful in situations when the integration cannot
rely on browser's support for downloading like in mobile apps that use
the Online in a WebView.
Change-Id: Iefdf214937c0c0dafd7462340a1c5e88df94e716
Reviewed-on: https://gerrit.libreoffice.org/73449
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
This patch concerns rename file operation when the integration
supports it
Signed-off-by: merttumer <mert.tumer@collabora.com>
Change-Id: Ibb4f615b91dda2491bfcd4d4738198d69eca4e6f
Reviewed-on: https://gerrit.libreoffice.org/71587
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Signed-off-by: merttumer <mert.tumer@collabora.com>
That "name" will be passed as the xauthor parameter in a message like:
child-01b9 load url=file:///.../x.odt?permission=edit jail=file:///.../x.odt xjail=file:///.../x.odt authorid=localhost1 xauthorid=localhost1 author=Local%20Host%20#1 xauthor=Local Host #1 readonly=0 lang=en-US
and that is parsed into space-separated tokens. Which leads to warning
messages like:
WRN Unexpected doc options token [Host]. Skipping.| common/Session.cpp:94
WRN Unexpected doc options token [#1]. Skipping.| common/Session.cpp:94
So use "LocalHost#0" etc instead.
Change-Id: I01ce8c4fb8309a7a9d3395e4fd874e469475d44c