summaryrefslogtreecommitdiff
path: root/ucb/source/ucp
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-08-27 12:29:21 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-11-01 18:46:02 +0100
commit9703240ea9c8932b32f16fd30c059d5e034fe9a0 (patch)
treecd82c612a9ff087b837fc6e1031e00a070571bd6 /ucb/source/ucp
parent1cb59f9187f6dfd255bb0d47bdb5ca8be09ea47e (diff)
ucb: webdav-curl: tdf#101094 (29) Fix for IIS 10.0 disabled OPTIONS method
When OPTIONS methods (or verb) is disabled (or denied) on a IIS 10.0 web server, error 404 (e.g. 'Not Found') is emitted, so we need to deal with it. [ port of commit e0d0d87257d62ac61377a73909e17753f96e7aaa ] Change-Id: I67309f1bce20bba1399a9a3c22568291d095ac69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123484 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'ucb/source/ucp')
-rw-r--r--ucb/source/ucp/webdav-curl/webdavcontent.cxx34
-rw-r--r--ucb/source/ucp/webdav-curl/webdavcontent.hxx3
2 files changed, 36 insertions, 1 deletions
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 237c51851af0..b96a58b3fb83 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3965,8 +3965,17 @@ void Content::getResourceOptions(
break;
case SC_NOT_FOUND:
{
+ // Apparently on IIS 10.0, if you disabled OPTIONS method, this error is the one reported,
+ // instead of SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED.
+ // So check if this is an available resource, or a real 'Not Found' event.
+ sal_uInt32 nLifeTime = m_nOptsCacheLifeNotFound;
+ if( isResourceAvailable(xEnv, rResAccess ) )
+ {
+ nLifeTime = m_nOptsCacheLifeNotImpl;
+ rDAVOptions.setResourceFound(); // means it exists, but it's not DAV
+ }
aStaticDAVOptionsCache.addDAVOptions( rDAVOptions,
- m_nOptsCacheLifeNotFound );
+ nLifeTime );
SAL_WARN( "ucb.ucp.webdav", "OPTIONS - Resource not found for URL <" << m_xIdentifier->getContentIdentifier() << ">" );
}
break;
@@ -4015,4 +4024,27 @@ void Content::getResourceOptions(
}
+//static
+bool Content::isResourceAvailable( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv,
+ const std::unique_ptr< DAVResourceAccess > & rResAccess )
+{
+ try
+ {
+ // To check for the physical URL resource availability, using a simple HEAD command
+ // if HEAD is successfull, set element found.
+ std::vector< OUString > aHeaderNames;
+ DAVResource resource;
+ rResAccess->HEAD( aHeaderNames, resource, xEnv );
+ return true;
+ }
+ catch ( ... )
+ {
+ // some error... so set as not found
+ // retry errors are taken care of
+ // in rResAccess function method.
+ return false;
+ }
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.hxx b/ucb/source/ucp/webdav-curl/webdavcontent.hxx
index f00b82634299..f854cc24047e 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.hxx
@@ -296,6 +296,9 @@ public:
void getResourceOptions( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv,
DAVOptions& rDAVOptions );
+ static bool isResourceAvailable( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv,
+ const std::unique_ptr< DAVResourceAccess > & rResAccess);
+
static void removeCachedPropertyNames( const OUString & rURL );
};