Bug 152493 - FILESAVE WebDAV upload (updating an existing remote file) fails with LO 7.4 (i.e. with libcurl), and no workaround any more (-with-webdav=neon)
Summary: FILESAVE WebDAV upload (updating an existing remote file) fails with LO 7.4 (...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
7.4.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.6.0 target:7.5.1 target:7.4.6
Keywords: regression
Depends on:
Blocks: WebDAV
  Show dependency treegraph
 
Reported: 2022-12-13 12:38 UTC by NISZ LibreOffice Team
Modified: 2023-03-10 09:20 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2022-12-13 12:38:18 UTC
Description:
During uploading a spreadsheet (ods) in LibreOffice Calc 7.4 with WebDAV, the upload fails. The spreadsheet in the server has not been updated. The same occurs with odt documents in Writer. This is likely caused by the Curl backend because before when the Neon was used, it worked fine. Unfortunately the Neon cannot be chosen because that has been removed from the code permanently.

Steps to Reproduce:
1. Open a file from a Vibe 4.0.6 WebDAV server
2. Save
3. Reopen

Actual Results:
The file fails to update, keeps the original state after reload.

Expected Results:
The file have to be saved properly.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 7.4.1.2 (x64) / LibreOffice Community
Build ID: 3c58a8f3a960df8bc8fd77b461821e42c061c5f0
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-GB
Calc: CL
Comment 1 Julien Nabet 2022-12-22 10:36:46 UTC
It could be interesting to have more details about WebDAV server.
Michael: thought you might be interested in this one since it concerns WebDAV and the new Curl way.
Comment 2 Michael Stahl (allotropia) 2023-01-26 09:02:38 UTC
problem is that the server sends a "HTTP/1.1 100" response with "Transfer-Encoding: chunked" and libcurl cannot handle it.

one possible fix:
https://gerrit.libreoffice.org/c/core/+/146067
Comment 3 Commit Notification 2023-01-30 08:30:21 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/30ca48f4dc0e65a3798e6b21574bc80f6d4953fa

tdf#152493 ucb WebDAV: fix upload using HTTP 1.0 fallback

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Mike Kaganski 2023-01-30 08:55:57 UTC
(In reply to Michael Stahl (allotropia) from comment #2)
> "Transfer-Encoding: chunked" and libcurl cannot handle it.

I don't know how this may be related, but it seems that at least something is supported in libcurl:

https://pragmaticjoe.gitlab.io/posts/2016-09-04-http-chunked-encoding-using-c-and-libcurl/

which deals with more problematic case of not having all the data in advance, but also mentions that when everything is at hand, "you just need to add the header “Transfer-Encoding: chunked” to the request, and curl will take care of everything after that".
Comment 5 László Németh 2023-01-31 10:05:24 UTC
Regression from commit 023ebf17898db4bca63129f079fd90b5cf76c1a9
"ucb: remove --with-webdav=neon", i.e. Neon has no such upload
problem, so removing it meant losing the previous workaround.
Comment 6 László Németh 2023-01-31 10:40:42 UTC
(In reply to Mike Kaganski from comment #4)
> (In reply to Michael Stahl (allotropia) from comment #2)
> > "Transfer-Encoding: chunked" and libcurl cannot handle it.
> 
> I don't know how this may be related, but it seems that at least something
> is supported in libcurl:
> 
> https://pragmaticjoe.gitlab.io/posts/2016-09-04-http-chunked-encoding-using-
> c-and-libcurl/
> 
> which deals with more problematic case of not having all the data in
> advance, but also mentions that when everything is at hand, "you just need
> to add the header “Transfer-Encoding: chunked” to the request, and curl will
> take care of everything after that".

The ucb code contains several comments about Sharepoint and Nextcloud problems with chunked encoding:

  // note: Sharepoint cannot handle "Transfer-Encoding: chunked"

  // note: Nextcloud 20 cannot handle "Transfer-Encoding: chunked"

etc.

Likely it's important, that a newer command line curl (e.g. on Ubuntu 22) has got a similar problem with Vibe WebDAV server, i.e. it was possible to overwrite *an existing remote file* only with --http1.0:

curl -u user:passwd --http1.0 -T local_modified_copy weblink

But an older curl (e.g. on Ubuntu 20.04: curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets) works with its default options.

So switching on HTTP 1.0 as the common ground seems to be more viable solution for me, than applying some low level settings, which would need more careful testing likely with the different WebDAV servers.
Comment 7 László Németh 2023-01-31 10:46:42 UTC
> So switching on HTTP 1.0 as the common ground seems to be more viable solution for me, than applying some low level settings, which would need more careful testing likely with the different WebDAV servers.

Note: HTTP 1.0 is only the fallback when CURLE_UNSUPPORTED_PROTOCOL error occurs.
Comment 8 Commit Notification 2023-02-03 10:12:28 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/0d0f4411934dead0765930693072fe9582f50be9

tdf#152493 ucb WebDAV: fix upload using HTTP 1.0 fallback

It will be available in 7.5.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2023-02-03 10:12:31 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/7dc3d1b88f368d40552531c1f9999ed67826fb9d

tdf#152493 ucb WebDAV: fix upload using HTTP 1.0 fallback

It will be available in 7.4.6.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.