Commit graph

32 commits

Author SHA1 Message Date
Ashod Nakashian
10553c4a78 wsd: remove unused helper
Change-Id: Ib27e596d751c78e40a51a53ece5c523ab6e7eabf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
3feb547bae killpoco: remove direct URI encode/decode usage in RequestDetails
Change-Id: I27e616300c8defd115be894ecf56fe72916748cc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Tor Lillqvist
b65c82031a RequestDetails::_isMobile is unused
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ib2a6bb69b09776dbaf48216330f1c260299d9cac
2022-11-09 09:09:55 +01:00
Andras Timar
cf6e22c22c Fix typos in comments
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I813f652b516c79f350b46317e589b91e0ef39a1a
2022-08-23 18:37:44 +02:00
Ashod Nakashian
480fb7b931 wsd: move tokenizer helpers into StringVector
In an attempt to reduce the size of Util.{c,h}pp
which has grown to contain all sorts of unrelated
helpers, we move StringVector helpers into
the StringVector.{c,h}pp files.

This makes the code better organized.

Change-Id: I152f341606807ae66253415b951bc9f89b09df57
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Miklos Vajna
f5836a5d1d sanitizers: fix unit-base, again
==4544==ERROR: AddressSanitizer: odr-violation (0x000002c40140):
  [1] size=104 'HostUtil::WopiHosts' ../wsd/HostUtil.cpp:12:34
  [2] size=104 'HostUtil::WopiHosts' wsd/HostUtil.cpp:12:34
These globals were registered at these points:
  [1]:
    #0 0x71f618 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-llvmorg-9.0.1.src/compiler-rt/lib/asan/asan_globals.cc:362
    #1 0x7f00cb0f3d7b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-base.so+0x10e0d7b)

  [2]:
    #0 0x71f618 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-llvmorg-9.0.1.src/compiler-rt/lib/asan/asan_globals.cc:362
    #1 0x120e2ae in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/coolwsd+0x120e2ae)

==4544==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'HostUtil::WopiHosts' at ../wsd/HostUtil.cpp:12:34
==4544==ABORTING

All of HostUtil was duplicated between the test shared objects and
coolwsd, so remove it from the test objects and rather exclude
RequestDetails::getDocKey() from the test objects instead, which was
linked in but was not used in practice.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ia2147c89cf4230df97a8f45ac7d509aa11cdca97
2022-04-01 13:31:45 +02:00
Rash419
31d8822758 wsd: cleanup: moved all parsing related static methods and containers to HostUtil.cpp
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8555522c6216f893b90ba4c27747314830f7abd2
2022-03-29 12:18:31 +02:00
Miklos Vajna
c9bba090b7 sanitizers: fix unit-base
==30332==ERROR: AddressSanitizer: odr-violation (0x0000020b9b20):
  [1] size=1 'StorageBase::SSLAsScheme' ../wsd/Storage.cpp:67:19
  [2] size=1 'StorageBase::SSLAsScheme' wsd/Storage.cpp:67:19
These globals were registered at these points:
  [1]:
    #0 0x71d0f8 in __asan_register_globals.part.13 lode/packages/llvm-llvmorg-9.0.1.src/compiler-rt/lib/asan/asan_globals.cc:362
    #1 0x7f4c362ed33b in asan.module_ctor (online-san/test/../test/.libs/unit-base.so+0x10eb33b)

  [2]:
    #0 0x71d0f8 in __asan_register_globals.part.13 lode/packages/llvm-llvmorg-9.0.1.src/compiler-rt/lib/asan/asan_globals.cc:362
    #1 0x11c709e in asan.module_ctor (online-san/coolwsd+0x11c709e)

==30332==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'StorageBase::SSLAsScheme' at ../wsd/Storage.cpp:67:19
==30332==ABORTING

Resolve the conflict by not providing these definitions when building
tests.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I6a8f74bd0b78a76f46b5401acaa816dd0b185aa9
2022-03-18 09:23:59 +01:00
Rash419
d02dd19f33 wsd: use hostname, port and scheme in doc key
This allows us to use multiple hosts using same coolwsd instance.

added aliases configuration to coolwsd.xml to avoid
possibility of opening the same file as two if the
WOPI host is accessed using different aliases

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I32913015c15fd396cecc702b76e0dcaa8bcafad3
2022-03-16 11:32:59 +03:00
Andras Timar
f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00
Henry Castro
c2d60f3627 wsd: rename 'lool' -> 'cool'
Change-Id: I4ece04921a0e12d4c69b2a70b563e66cc89be0a6
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:54 +01:00
Henry Castro
28be4a7936 wsd: more comments rename 'lool' -> 'cool'
Change-Id: Ic24d2c9e56e9a75781d83482f473ea2264fb34f5
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:38 +01:00
Henry Castro
2319ead3a4 wsd: rename 'lool' -> 'cool'
Change-Id: I40e2765efab7639620ba948737f5580377b11652
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:07 +01:00
Henry Castro
3cb915b3f5 wsd: rename comments 'lool' -> 'cool'
Change-Id: I8129cfa64af480f7cd9873aaf56e0056abdd962a
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:03 +01:00
Henry Castro
e0fe47be5f rename loleaflet.html -> cool.html
Change-Id: Iaa28f1269f8192755ec323396ae4ff054529f412
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-10 17:18:56 +01:00
Ashod Nakashian
6f25a9e8ee wsd: move getDocKey into RequestDetails
RequestDetails manages URLs and their components.
The DocKey is based on the URL, so it makes sense
to be provided by RequestDetails.

Change-Id: If99e677a2e5a227f09b5035f388c4da587084db9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-11-02 08:43:26 -04:00
Ashod Nakashian
0933508fb8 wsd: move sanitizeURI into RequestDetails
And cleanup around DocKey and URI handling.

Change-Id: Ieef83197ac9b04e22af92eee217e336bc2b31761
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-11-02 08:43:26 -04:00
Ashod Nakashian
6dec522a65 wsd: sanitizeURI from to RequestDetails
Change-Id: I8693bd6a36be4c67b62be4b5a997dd227460fbd1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-09-26 17:02:01 -04:00
Ashod Nakashian
0e6a8cbfae wsd: improved dehexifying of URLs
Change-Id: Ib51e2e61432a7ac634d5b8577f75b57507b0ad60
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 90516342d154434c3a7ad3d245b00a16b8bb5716)
2021-09-13 09:40:09 -04:00
Ashod Nakashian
6ae7864b5e wsd: hexified URL support
Change-Id: I44c46da58e0f807354aaa201ef44d3ecf50f9a07
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 6b5cbce94c41883c7f11c28f4277083798318bf7)
2021-09-13 09:40:09 -04:00
Ashod Nakashian
54a10729f3 killpoco: replace Poco::icompare
Change-Id: I9b8154538c85593f054afd17bd588a593b803e98
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
583c627a66 wsd: avoid single-character strings
Change-Id: I709e8e797bc5e68984823d8c46c590e109d23f18
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-09 17:19:58 +01:00
Andras Timar
0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
Ashod Nakashian
5cf0273c7f wsd: parse the URI params of the URI and DocumentURI
Change-Id: Iefc8c10ff85270aa95f255cef29b3427a0efcfe6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96826
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 07:35:00 +02:00
Henry Castro
9928143e05 android: fix invalid URI when running x86_64
Change-Id: If057df24de63759d3e239475ecca94f8faaa0d35
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95611
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
2020-06-11 20:41:36 +02:00
Tor Lillqvist
441b204d26 Avoid assertion failure in the iOS app
Change-Id: I5e0733579db01616f8c6e7743bb01a9a2feca8aa
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95591
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-06-05 13:39:30 +02:00
Ashod Nakashian
d06ad733c5 wsd: improved RequestDetails parsing and documentation
...with support for properly extracting the different
fields with unit-test.

URIs are quite complex and varied. For historic reasons
they have all been treated without distinction, which
makes support for all variants difficult. RequestDetails
encapsulates this complexity, and now it is almost
completely documented both descriptively and functionally
(via extensive unit-tests).

Parsing of the URIs is now more structured by having
named fields instead of relying on knowing which
token should contain which field, which is error-prone
and very opaque.

Change-Id: I68d07c2e00baf43f0ade97d20f62691ffb3bf576
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95292
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 20:04:48 +02:00
Ashod Nakashian
1ee57ba1d0 wsd: proxy: correctly parse single-char fields in the URI
...instead of skipping them.

And add tests to defend the fix.

Change-Id: I8585cc3592841c8ad16d3804dc09a2a3b3a3bb71
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95291
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 20:01:59 +02:00
Ashod Nakashian
fae093d89d wsd: std::move rather than copy
Change-Id: I7c4eea8aa5ab57444aa395f727e4ce6ac713b665
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95337
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 20:01:16 +02:00
Ashod Nakashian
44f4e59b6b wsd: RequestDetails takes the service root as argument
This avoids depending on LOOLWSD's statics, which
makes adding unit-tests much more difficult due to
the high number of dependencies LOOLWSD pulls.

Adds a number of unit-tests for RequestDetails.

Change-Id: I9f1d56f80a633505c7ff548ec0e33ffe61f59f53
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95290
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 17:28:40 +02:00
Ashod Nakashian
3309d597e9 wsd: correctly parse wopi URLs in RequestDetails
Wopi URLs have their own /ws marker, which
is confused with the one used with the RichProxy.
Without correctly identifying the one belonging
to the original URL and the one for the Proxy
logic, we end up mis-parsing and Wopi documents
don't load via RichProxy.

Change-Id: I7874e2aed9d5ac7de734f3db01f2820c5bbc5098
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94470
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-05-19 15:17:12 +02:00
Michael Meeks
dec683218a Proxy: move RequestDetails to its own header.
Share it with various other places requiring similar data.

Change-Id: I873f56798f5a34dcf7440456bd649b68f6d3df98
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94069
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-12 20:30:17 +02:00