diff options
author | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-07-25 12:56:27 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-11-01 18:40:13 +0100 |
commit | 567f8f716bb644494fa74b9a5030c5a047c8a189 (patch) | |
tree | e5fdfa83323951a03070042ce23b2e793234ef7c /ucb/source | |
parent | 43c1de58c3115dd0495d0326975d520a333845b8 (diff) |
ucb: webdav-curl: tdf#101094 (18) OPTIONS: Update OPTIONS cache lifetime if not found
[ ported from commit a5fc27e0575eab115de3714ae07fcac7481f4daf ]
Change-Id: I61d06051a4526676fc4ab80d653ab7c2a9e4c209
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123470
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/webdav-curl/webdavcontent.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 3f42acc56223..962d95fe945f 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -2124,6 +2124,7 @@ uno::Any Content::open( if ( xDataSink.is() ) { // PULL: wait for client read + OUString aTargetURL = m_xIdentifier->getContentIdentifier(); try { std::unique_ptr< DAVResourceAccess > xResAccess; @@ -2163,6 +2164,21 @@ uno::Any Content::open( } catch ( DAVException const & e ) { + // check if error is SC_NOT_FOUND + // if URL resource not found, set the corresponding resource + // element in option cache and update the cache lifetime accordingly + if( e.getStatus() == SC_NOT_FOUND ) + { + DAVOptions aDAVOptions; + if( aStaticDAVOptionsCache.getDAVOptions( aTargetURL, aDAVOptions ) ) + { + // get redirected url + aDAVOptions.setResourceFound( false ); + aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, + m_nOptsCacheLifeNotFound ); + } + } + cancelCommandExecution( e, xEnv ); // Unreachable } @@ -3695,6 +3711,22 @@ Content::ResourceType Content::getResourceType( *networkAccessAllowed = *networkAccessAllowed && shouldAccessNetworkAfterException(e); } + if ( e.getStatus() == SC_NOT_FOUND ) + { + // arrives here if OPTIONS is still cached for a resource previously available + // operate on the OPTIONS cache: + // if OPTIONS was not found, do nothing + // else OPTIONS returned on a resource not existent (example a server that allows lock on null resource) set + // not found and adjust lifetime accordingly + DAVOptions aDAVOptionsInner; + if (aStaticDAVOptionsCache.getDAVOptions(rResAccess->getURL(), aDAVOptionsInner)) + { + // get redirected url + aDAVOptionsInner.setResourceFound( false ); + aStaticDAVOptionsCache.addDAVOptions( aDAVOptionsInner, + m_nOptsCacheLifeNotFound ); + } + } // if the two net events below happen, something // is going on to the connection so break the command flow if ( ( e.getError() == DAVException::DAV_HTTP_TIMEOUT ) || |