diff options
author | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-07-25 12:56:27 +0200 |
---|---|---|
committer | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-07-29 21:32:34 +0000 |
commit | a5fc27e0575eab115de3714ae07fcac7481f4daf (patch) | |
tree | 930936b4b7969f6413ec2fc15f117edf1f7ff40c | |
parent | ff051403381ca85724fec4f7bd2363141fa675f6 (diff) |
tdf#101094 (18) OPTIONS: Update OPTIONS cache lifetime if not found
Change-Id: I1b37bba50cd41ab5eeb960927148cf6b005f3fd4
Reviewed-on: https://gerrit.libreoffice.org/27698
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontent.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index b515ea06b46f..01eba4ebf7e1 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -2109,6 +2109,7 @@ uno::Any Content::open( if ( xDataSink.is() ) { // PULL: wait for client read + OUString aTargetURL = m_xIdentifier->getContentIdentifier(); try { std::unique_ptr< DAVResourceAccess > xResAccess; @@ -2148,6 +2149,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 } @@ -3688,6 +3704,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 prevously 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( rURL, 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 ) || |