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 12:24:18 +0100
commit403d3e057575825f86ff97bf9e277feafa69362e (patch)
tree954a19f54e6fa48462db4b062ebde02271bafb67 /ucb
parent8bb183f133202ebb687e0b56cc5a2938354506f7 (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>
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 2467aef835bf..3beb87b9593f 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.