summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-11-25 17:36:20 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-11-26 18:02:20 +0100
commit0dca261c9361dbebf097bd5591a5e33269698739 (patch)
tree4ffb9d1d3ee99e609d315077b346d669d5bf1ca2 /ucb
parentac787764de3806b75607634a5c5856f58ddce881 (diff)
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
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav-curl/webdavcontent.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 8bf19a582693..1eb069a3480e 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -1452,9 +1452,12 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
// All properties obtained already?
std::vector< OUString > aMissingProps;
if ( !( xProps
- && xProps->containsAllNames(
- rProperties, aMissingProps ) )
- || !m_bDidGetOrHead )
+ && xProps->containsAllNames(rProperties, aMissingProps))
+ // i#121922 for non-DAV, uncacheable properties must be fetched
+ // regardless of m_bDidGetOrHead.
+ // But SharePoint may do weird things on HEAD so for DAV
+ // only do this if required.
+ && (eType != DAV || !m_bDidGetOrHead))
{
// Possibly the missing props can be obtained using a HEAD
// request.