diff options
-rw-r--r-- | ucb/source/ucp/webdav-curl/webdavcontent.cxx | 34 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-curl/webdavcontent.hxx | 3 |
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 ); }; |