ucb: webdav-curl: avoid pointless HEAD requests for DAV resources
commit0dca261c9361dbebf097bd5591a5e33269698739
authorMichael Stahl <michael.stahl@allotropia.de>
Thu, 25 Nov 2021 16:36:20 +0000 (25 17:36 +0100)
committerMichael Stahl <michael.stahl@allotropia.de>
Fri, 26 Nov 2021 17:02:20 +0000 (26 18:02 +0100)
tree4ffb9d1d3ee99e609d315077b346d669d5bf1ca2
parentac787764de3806b75607634a5c5856f58ddce881
ucb: webdav-curl: avoid pointless HEAD requests for DAV resources

Content::getPropertyValues() has a funny conditional which was changed
in commit a86bc34ddcff6b04bb9fdb8c960bbf2c49540da1 "Resolves: #i121922#
Fix wrong condition".

But the new condition also appears wrong, there is no need to do any
further requests if all properties have already been retrieved, so the
check for m_bDidGetOrHead could just be omitted.

There is a surprising result in the Remote Files dialog when connecting
to a Sharepoint 16 server: all properties have been retrieved from the
directory given as Root, but because of !m_bDidGetOrHead the branch is
taken anyway.

The HEAD request results in a "HTTP/1.1 302 Redirect" to
$ROOT/Forms/AllItems.aspx, HEAD on this URL gives a "HTTP/1.1 200 OK"
and then subsequently a PROPFIND on that very same URL results in
"HTTP/1.1 404 NOT FOUND".

Physics claims that a single observation should be sufficient to
determine whether an URL exists or not, but Sharepoint is apparently
able to maintain this quantum superposition indefinitely, hence the
Remote Files dialog doesn't display anything as the 404 causes an exception.

Try to fix this by requiring a missing property again before initiating
the HEAD request for DAV resources.

Change-Id: I1239762948b6abd1f8fc097edd4a16cb6b75ca7a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125826
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 4bbaec0ef84cccae2003d7b0690164482e148797)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125845
ucb/source/ucp/webdav-curl/webdavcontent.cxx