office-gobmx/ucb
Caolán McNamara 8c1dbd3188 cid#1607542 COPY_INSTEAD_OF_MOVE
and

cid#1606986 COPY_INSTEAD_OF_MOVE
cid#1557969 COPY_INSTEAD_OF_MOVE
cid#1557837 COPY_INSTEAD_OF_MOVE
cid#1557772 COPY_INSTEAD_OF_MOVE
cid#1557735 COPY_INSTEAD_OF_MOVE
cid#1557672 COPY_INSTEAD_OF_MOVE
cid#1557664 COPY_INSTEAD_OF_MOVE
cid#1557650 COPY_INSTEAD_OF_MOVE
cid#1557642 COPY_INSTEAD_OF_MOVE
cid#1557639 COPY_INSTEAD_OF_MOVE
cid#1557628 COPY_INSTEAD_OF_MOVE
cid#1557623 COPY_INSTEAD_OF_MOVE
cid#1557581 COPY_INSTEAD_OF_MOVE
cid#1557489 COPY_INSTEAD_OF_MOVE
cid#1557473 COPY_INSTEAD_OF_MOVE
cid#1557317 COPY_INSTEAD_OF_MOVE
cid#1557261 COPY_INSTEAD_OF_MOVE
cid#1557146 COPY_INSTEAD_OF_MOVE
cid#1557135 COPY_INSTEAD_OF_MOVE
cid#1557134 COPY_INSTEAD_OF_MOVE
cid#1557079 COPY_INSTEAD_OF_MOVE
cid#1557063 COPY_INSTEAD_OF_MOVE
cid#1557052 COPY_INSTEAD_OF_MOVE
cid#1556982 COPY_INSTEAD_OF_MOVE
cid#1556977 COPY_INSTEAD_OF_MOVE
cid#1556950 COPY_INSTEAD_OF_MOVE
cid#1556943 COPY_INSTEAD_OF_MOVE
cid#1556804 COPY_INSTEAD_OF_MOVE
cid#1556736 COPY_INSTEAD_OF_MOVE
cid#1556658 COPY_INSTEAD_OF_MOVE
cid#1556621 COPY_INSTEAD_OF_MOVE
cid#1556590 COPY_INSTEAD_OF_MOVE
cid#1556579 COPY_INSTEAD_OF_MOVE
cid#1556534 COPY_INSTEAD_OF_MOVE
cid#1556524 COPY_INSTEAD_OF_MOVE
cid#1556478 COPY_INSTEAD_OF_MOVE
cid#1556467 COPY_INSTEAD_OF_MOVE
cid#1556422 COPY_INSTEAD_OF_MOVE
cid#1556314 COPY_INSTEAD_OF_MOVE
cid#1556309 COPY_INSTEAD_OF_MOVE
cid#1556258 COPY_INSTEAD_OF_MOVE
cid#1556143 COPY_INSTEAD_OF_MOVE
cid#1556119 COPY_INSTEAD_OF_MOVE
cid#1556101 COPY_INSTEAD_OF_MOVE
cid#1556097 COPY_INSTEAD_OF_MOVE
cid#1556039 COPY_INSTEAD_OF_MOVE
cid#1555966 COPY_INSTEAD_OF_MOVE
cid#1555948 COPY_INSTEAD_OF_MOVE
cid#1555915 COPY_INSTEAD_OF_MOVE
cid#1555836 COPY_INSTEAD_OF_MOVE
cid#1555748 COPY_INSTEAD_OF_MOVE
cid#1555644 COPY_INSTEAD_OF_MOVE
cid#1555582 COPY_INSTEAD_OF_MOVE
cid#1555478 COPY_INSTEAD_OF_MOVE
cid#1555475 COPY_INSTEAD_OF_MOVE
cid#1555409 COPY_INSTEAD_OF_MOVE
cid#1555372 COPY_INSTEAD_OF_MOVE
cid#1555334 COPY_INSTEAD_OF_MOVE
cid#1555330 COPY_INSTEAD_OF_MOVE
cid#1555310 COPY_INSTEAD_OF_MOVE
cid#1555257 COPY_INSTEAD_OF_MOVE
cid#1555247 COPY_INSTEAD_OF_MOVE
cid#1555147 COPY_INSTEAD_OF_MOVE
cid#1555120 COPY_INSTEAD_OF_MOVE
cid#1555059 COPY_INSTEAD_OF_MOVE
cid#1555016 COPY_INSTEAD_OF_MOVE
cid#1554880 COPY_INSTEAD_OF_MOVE
cid#1554824 COPY_INSTEAD_OF_MOVE
cid#1554808 COPY_INSTEAD_OF_MOVE
cid#1546189 COPY_INSTEAD_OF_MOVE

Change-Id: I2d2f33c603f1596228c9ecb169472ba6751e7826
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177593
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-11-30 22:39:23 +01:00
..
qa loplugin:ostr in ucb 2024-05-15 18:02:14 +02:00
source cid#1607542 COPY_INSTEAD_OF_MOVE 2024-11-30 22:39:23 +01:00
test/com/sun/star/comp/ucb
CppunitTest_ucb_webdav_core.mk
IwyuFilter_ucb.yaml tdf#146386 remove references to FTP UCP code 2023-11-16 19:15:01 +01:00
JunitTest_ucb_unoapi.mk
JunitTest_ucb_webdav_unoapi.mk --disable-curl builds: split WebDAV-related JunitTests to fix checks 2023-11-13 06:45:47 +01:00
Library_cached1.mk
Library_srtrs1.mk
Library_ucb1.mk
Library_ucpcmis1.mk ucb: cmis: remove CertValidationHandler 2024-06-24 12:38:52 +02:00
Library_ucpdav1.mk
Library_ucpexpand1.mk
Library_ucpext.mk
Library_ucpfile1.mk
Library_ucpgio1.mk
Library_ucphier1.mk
Library_ucpimage.mk
Library_ucppkg1.mk
Library_ucptdoc1.mk
Makefile
Module_ucb.mk --disable-curl builds: split WebDAV-related JunitTests to fix checks 2023-11-13 06:45:47 +01:00
README.md

Universal Content Broker (UCB)

Universal Content Broker (has ucps) which do things like convert files to strings in content broker world, or connect LibreOffice with various DMS and fileshare systems like WebDAV, CMIS, or GIO.

The UCPs implement the Universal Content Provider UNO interfaces in C++, in particular the com.sun.star.ucb.ContentProvider service.

WebDAV UCP

The WebDAV content provider is based on libcurl for much of the network and protocol stuff, including authentication.

WebDAV as implemented here is defined in an IETF RFC 4918 extensions, and the code supports both unencrypted HTTP/1.1 (IETF RFC 2616) as well as TLS 1.2 or later.

Our WebDAV com.sun.star.ucb.ContentProvider service implementation registers the vnd.sun.star.webdav and http URI schemes (and their encrypted TLS variants). See here for the specification: https://wiki.documentfoundation.org/Documentation/DevGuide/Universal_Content_Providers#The_WebDAV_Content_Provider

Historically, webdav had two ucps, one based on neon, the second one based on serf. Both are superseded by the current libcurl implementation (since LibreOffice 7.3), but in case of behavioural differences, go hunt for code differences (ucb/source/ucp/webdav-neon and ucb/source/ucp/webdav).

The WebDAV protocol is implemented on top of libcurl basic http GET, PUT, and POST requests (and is relatively straight-forward - see ucb/source/ucp/webdav-curl/webdavcontent.cxx for the main functionality), but incorporates custom handling for a number of server idiosyncrasies:

  • Nextcloud will reply to a PROPFIND request with "100 Continue" and then after the data is uploaded it will send a "401 Unauthorized" if the auth header is missing in the headers to which it replied with "100 Continue".
  • Sharepoint 16 responds to PROPFIND, PROPPATCH and LOCK with "Transfer-Encoding: chunked" with "HTTP/1.1 200 OK" and an actual error message in the response body.
    • apparently setting Content-Length works better, so we use that
  • Sharepoint returns redirect urls that curl can't parse, so we encode them (check WebDAVResponseParser for the code)
  • Sharepoint may reply to HEAD with 200 OK but then 404 NOT FOUND to PROPFIND
  • Sharepoint does not appear to support Dead Properties
  • avoiding chunked encoding for PUT, since for Nextcloud:

To a first approximation, there are 3 parts involved in the UCP:

  • The upper layer implements the UNO API which is called by LibreOffice, and translates the calls from generic sequence-of-any stringly typed abstractness into HTTP or WebDAV protocol calls, and does some high level protocol handling to figure out what the server supports and so on. This is independent of the low-level library.
  • Then there is the lower layer of the UCP, which translates the generic HTTP or WebDAV protocol calls to something that the particular third-party library can understand, hook up its callbacks for data transfer and authentication, and parse the reply XML documents.
  • At the bottom, there is the third-party library that implements the HTTP protocol.

The most important classes are:

  • ContentProvider: the UNO entry point/factory, creates Content instances
  • Content: the main UNO service, translates the UCP API to WebDAV methods, one instance per URL
  • DAVResourceAccess: sits between Content and CurlSession
  • DAVSessionFactory: creates CurlSession for DAVResourceAccess
  • CurlSession: low-level interfacing with libcurl
  • SerfLockStore: singleton used by CurlSession to store DAV lock tokens, runs a thread to refresh locks when they expire
  • WebDAVResponseParser: parse XML responses to LOCK, PROPFIND requests
  • DAVAuthListener_Impl: request credentials from UI via UNO