summaryrefslogtreecommitdiff
path: root/ucb/source/ucp
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2024-06-20 14:21:20 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2024-06-20 16:48:56 +0200
commit21279261fda69855924271230e3ac736615fc95c (patch)
tree25e2ec7fa9857cd9e1b97ff0fdb3b807a0af40e1 /ucb/source/ucp
parent1be12e6d298a1e22871cdb9eecb7b6440b0d1d88 (diff)
ucb: webdav-curl: don't mash together HTTP_CONNECT and HTTP_TIMEOUT
First a DAVException with DAV_HTTP_CONNECT is thrown, then it's converted to USC_CONNECTION_TIMED_OUT, then that is converted to DAVException with DAV_HTTP_TIMEOUT, a bit misleading. Change-Id: Ie5089d67d363f57eaa9e1ed057b36adb41e846d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169277 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'ucb/source/ucp')
-rw-r--r--ucb/source/ucp/webdav-curl/DAVException.hxx1
-rw-r--r--ucb/source/ucp/webdav-curl/webdavcontent.cxx9
2 files changed, 8 insertions, 2 deletions
diff --git a/ucb/source/ucp/webdav-curl/DAVException.hxx b/ucb/source/ucp/webdav-curl/DAVException.hxx
index 759e43f25f8e..bd3053305901 100644
--- a/ucb/source/ucp/webdav-curl/DAVException.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVException.hxx
@@ -93,6 +93,7 @@ const sal_uInt16 SC_HTTP_VERSION_NOT_SUPPORTED = 505;
const sal_uInt16 SC_INSUFFICIENT_STORAGE = 507;
// unofficial status codes only used internally by LO
+const sal_uInt16 USC_CONNECT_FAILED = 907;
// used to cache the connection time out event
const sal_uInt16 USC_CONNECTION_TIMED_OUT = 908;
// name resolution failed
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 1b004017b482..c33e4cb24bcc 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3889,7 +3889,8 @@ Content::ResourceType Content::getResourceType(
rResAccess->resetUri();
// first check if the cached error can be mapped to DAVException::DAV_HTTP_TIMEOUT or mapped to DAVException::DAV_HTTP_CONNECT
- if (aDAVOptions.getHttpResponseStatusCode() == USC_CONNECTION_TIMED_OUT
+ if (aDAVOptions.getHttpResponseStatusCode() == USC_CONNECT_FAILED
+ || aDAVOptions.getHttpResponseStatusCode() == USC_CONNECTION_TIMED_OUT
// can't get any reliable info without auth => cancel request
|| aDAVOptions.getHttpResponseStatusCode() == USC_AUTH_FAILED
|| aDAVOptions.getHttpResponseStatusCode() == USC_AUTHPROXY_FAILED)
@@ -3904,6 +3905,9 @@ Content::ResourceType Content::getResourceType(
DAVException::ExceptionCode e{};
switch (aDAVOptions.getHttpResponseStatusCode())
{
+ case USC_CONNECT_FAILED:
+ e = DAVException::DAV_HTTP_CONNECT;
+ break;
case USC_CONNECTION_TIMED_OUT:
e = DAVException::DAV_HTTP_TIMEOUT;
break;
@@ -4057,7 +4061,7 @@ void Content::getResourceOptions(
SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException: DAV_HTTP_TIMEOUT or DAV_HTTP_CONNECT for URL <" << m_xIdentifier->getContentIdentifier() << ">" );
// cache the internal unofficial status code
- aDAVOptions.setHttpResponseStatusCode( USC_CONNECTION_TIMED_OUT );
+ aDAVOptions.setHttpResponseStatusCode(e.getError() == DAVException::DAV_HTTP_CONNECT ? USC_CONNECT_FAILED : USC_CONNECTION_TIMED_OUT);
// used only internally, so the text doesn't really matter..
aStaticDAVOptionsCache.addDAVOptions( aDAVOptions,
m_nOptsCacheLifeNotFound );
@@ -4215,6 +4219,7 @@ void Content::getResourceOptions(
if ( networkAccessAllowed != nullptr &&
( ( CachedResponseStatusCode == SC_NOT_FOUND ) ||
( CachedResponseStatusCode == SC_GONE ) ||
+ ( CachedResponseStatusCode == USC_CONNECT_FAILED ) ||
( CachedResponseStatusCode == USC_CONNECTION_TIMED_OUT ) ||
( CachedResponseStatusCode == USC_LOOKUP_FAILED ) ||
( CachedResponseStatusCode == USC_AUTH_FAILED ) ||