[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVException.hxx |5 + ucb/source/ucp/webdav-curl/webdavcontent.cxx | 74 +-- ucb/source/ucp/webdav-curl/webdavcontent.hxx |4 + 3 files changed, 77 insertions(+), 6 deletions(-) New commits: commit 62069267024a35e323e8685c3808bf80d64ddb5c Author: Giuseppe Castagno AuthorDate: Fri Oct 14 17:13:20 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:53:33 2021 +0100 ucb: webdav-curl: tdf#102499 (9): Fix eXo Platform WebDAV on 'Save Remote File' [ port of commit 59d6d5579528a66e55b75987d2d959968db485a8 ] Change-Id: I32c2bb8c3985ce8d8cf8cd0aeae513815ed40b6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123502 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVException.hxx b/ucb/source/ucp/webdav-curl/DAVException.hxx index c2f9f53acdd9..537b5a82fa2b 100644 --- a/ucb/source/ucp/webdav-curl/DAVException.hxx +++ b/ucb/source/ucp/webdav-curl/DAVException.hxx @@ -94,6 +94,11 @@ const sal_uInt16 SC_INSUFFICIENT_STORAGE = 507; // unofficial status codes only used internally by LO // used to cache the connection time out event const sal_uInt16 USC_CONNECTION_TIMED_OUT= 908; +// name resolution failed +const sal_uInt16 USC_LOOKUP_FAILED = 909; +const sal_uInt16 USC_AUTH_FAILED = 910; +const sal_uInt16 USC_AUTHPROXY_FAILED= 911; + class DAVException : public std::exception diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index b2d645bc1f23..974867e78685 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3720,7 +3720,7 @@ Content::ResourceType Content::getResourceType( DAVOptions aDAVOptions; { -getResourceOptions( xEnv, aDAVOptions, rResAccess ); +getResourceOptions( xEnv, aDAVOptions, rResAccess, networkAccessAllowed ); // at least class one is needed if( aDAVOptions.isClass1() ) @@ -3931,7 +3931,8 @@ void Content::initOptsCacheLifeTime() void Content::getResourceOptions( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv, DAVOptions& rDAVOptions, -const std::unique_ptr< DAVResourceAccess > & rResAccess ) +const std::unique_ptr< DAVResourceAccess > & rResAccess, +bool * networkAccessAllowed ) { OUString aRedirURL; OUString aTargetURL = rResAccess->getURL(); @@ -3990,8 +3991,25 @@ void Content::getResourceOptions( // used only internally, so the text doesn't really matter.. aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, m_nOptsCacheLifeNotFound ); -cancelCommandExecution( e, xEnv ); -// unreachable +if ( networkAccessAllowed != nullptr ) +{ +*networkAccessAllowed = *networkAccessAllowed +&& shouldAccessNetworkAfterException(e); +} +} +break; +case DAVException::DAV_HTTP_LOOKUP: +{ +SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException: DAV_HTTP_LOOKUP for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +aDAVOptions.setHttpResponseStatusCode( USC_LOOKUP_FAILED ); +// used only internally, so the text doesn't really matter.. +aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, + m_nOptsCacheLifeNotFound ); +if ( networkAccessAllowed != nullptr ) +{ +*networkAccessAllowed = *networkAccessAllowed +&& shouldAccessNetworkAfterException(e); +} } break; case DAVException::DAV_HTTP_AUTH: @@ -4002,6 +4020,29 @@ void Content::getResourceOptions( // she cancelled the credentials request. // this is not actually an error, it means only that for current user this is a standard web, // though possibly DAV enabled +aDAVOptions.setHttpResponseStatusCode( USC_AUTH_FAILED ); +// used only internally, so the text doesn't really matter.. +aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, + m_nOptsCacheLifeNotFound ); +if ( networkAccessAllowed !=
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 24 1 file changed, 24 insertions(+) New commits: commit 3665527ea9f003830eb47ecd221a950c35caf731 Author: Giuseppe Castagno AuthorDate: Fri Oct 21 15:53:53 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:53:17 2021 +0100 ucb: webdav-curl: tdf#102499 (8): Return empty property when not present. [ port of commit bb27b2ff87e534b6f4fb9583271db29d6bbae8b6 ] Change-Id: I3375aff7e3b82bb41917b1d87432fd48af41a05c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123501 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 01bc742f0e25..b2d645bc1f23 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -1621,6 +1621,30 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( m_bCollection ) ); } +// Add a default for the properties requested but not found. +// Determine still missing properties, add a default. +// Some client function doesn't expect a void uno::Any, +// but instead wants some sort of default. +std::vector< OUString > aMissingProps; +if ( !xProps->containsAllNames( +rProperties, aMissingProps ) ) +{ +// +for ( std::vector< rtl::OUString >::const_iterator it = aMissingProps.begin(); + it != aMissingProps.end(); ++it ) +{ +// For the time being only a couple of properties need to be added +if ( (*it) == "DateModified" || (*it) == "DateCreated" ) +{ +util::DateTime aDate; +xProps->addProperty( +(*it), +uno::makeAny( aDate ), +true ); +} +} +} + sal_Int32 nCount = rProperties.getLength(); for ( sal_Int32 n = 0; n < nCount; ++n ) {
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVException.hxx |4 ucb/source/ucp/webdav-curl/webdavcontent.cxx | 25 + 2 files changed, 29 insertions(+) New commits: commit 2346a19dfeba7f0f2082888ab76c1c731e9e591c Author: Giuseppe Castagno AuthorDate: Thu Oct 13 09:34:19 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:52:18 2021 +0100 ucb: webdav-curl: tdf#102499 (7): Caching connect timeout or cannot connect. An unofficial HTTP response status code is defined and used internally in LibreOffice WebDAV ucp provider in order to catch either the DAVException::DAV_HTTP_TIMEOUT state or the DAVException::DAV_HTTP_CONNECT state. [ port of commit 97cc70d7285526ae2ee3b3bac425eb031c4c0321 ] Change-Id: Idd5d412dd10131199f34a047055d098a0f74cf7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123499 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVException.hxx b/ucb/source/ucp/webdav-curl/DAVException.hxx index 4da64420cc00..c2f9f53acdd9 100644 --- a/ucb/source/ucp/webdav-curl/DAVException.hxx +++ b/ucb/source/ucp/webdav-curl/DAVException.hxx @@ -91,6 +91,10 @@ const sal_uInt16 SC_HTTP_VERSION_NOT_SUPPORTED = 505; // DAV extensions (<https://tools.ietf.org/html/rfc4918#section-11>) const sal_uInt16 SC_INSUFFICIENT_STORAGE = 507; +// unofficial status codes only used internally by LO +// used to cache the connection time out event +const sal_uInt16 USC_CONNECTION_TIMED_OUT= 908; + class DAVException : public std::exception { diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 7866ce132632..01bc742f0e25 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3813,6 +3813,25 @@ 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 ) +{ +// behave same as DAVException::DAV_HTTP_TIMEOUT or DAVException::DAV_HTTP_CONNECT was thrown +try +{ +// extract host name and connection port +CurlUri theUri( rResAccess->getURL() ); +OUString aHostName = theUri.GetHost(); +sal_Int32 nPort = theUri.GetPort(); +throw DAVException( DAVException::DAV_HTTP_TIMEOUT, +ConnectionEndPointString(aHostName, nPort) ); +} +catch ( DAVException& exp ) +{ +cancelCommandExecution( exp, xEnv ); +} +} + if ( aDAVOptions.getHttpResponseStatusCode() != SC_NOT_FOUND && aDAVOptions.getHttpResponseStatusCode() != SC_GONE ) // the cached OPTIONS can have SC_GONE { @@ -3941,6 +3960,12 @@ void Content::getResourceOptions( // probably a new bit stating 'timed out' should be added to opts var? // in any case abort the command 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 ); +// used only internally, so the text doesn't really matter.. +aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, + m_nOptsCacheLifeNotFound ); cancelCommandExecution( e, xEnv ); // unreachable }
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVTypes.cxx | 46 +++ ucb/source/ucp/webdav-curl/DAVTypes.hxx |7 ++-- ucb/source/ucp/webdav-curl/webdavcontent.cxx |6 +-- 3 files changed, 21 insertions(+), 38 deletions(-) New commits: commit 805a4e9d3e03e1339e9149fa745ac14fe334ccdf Author: Giuseppe Castagno AuthorDate: Tue Oct 11 15:21:23 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:51:55 2021 +0100 ucb: webdav-curl: tdf#102499 (6): Cache OPTIONS if not present or if lifetime different Add the OPTIONS information and response status code into the cache: - if the OPTIONS information is already cached, update the cache only if the lifetime is different; - if the OPTIONS information is not cached, cache it. Add some new functions in DAVOptions to support the change and remove a function no longer used. [ port of commit 1ca68d386bc0345240bf288bec023faaba2e07af ] Change-Id: I9c06e06ba807eff393052dc706cb45b2dfcef105 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123498 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx b/ucb/source/ucp/webdav-curl/DAVTypes.cxx index d16b7bacc3bd..82be1807ed41 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx @@ -29,6 +29,7 @@ DAVOptions::DAVOptions() : m_isLocked( false ), m_aAllowedMethods(), m_nStaleTime( 0 ), +m_nRequestedTimeLife( 0 ), m_sURL(), m_sRedirectedURL(), m_nHttpResponseStatusCode( 0 ), @@ -44,6 +45,7 @@ DAVOptions::DAVOptions( const DAVOptions & rOther ) : m_isLocked( rOther.m_isLocked ), m_aAllowedMethods( rOther.m_aAllowedMethods ), m_nStaleTime( rOther.m_nStaleTime ), +m_nRequestedTimeLife( rOther.m_nRequestedTimeLife ), m_sURL( rOther.m_sURL ), m_sRedirectedURL( rOther.m_sRedirectedURL), m_nHttpResponseStatusCode( rOther.m_nHttpResponseStatusCode ), @@ -64,6 +66,7 @@ DAVOptions & DAVOptions::operator=( const DAVOptions& rOpts ) m_isHeadAllowed = rOpts.m_isHeadAllowed; m_aAllowedMethods = rOpts.m_aAllowedMethods; m_nStaleTime = rOpts.m_nStaleTime; +m_nRequestedTimeLife = rOpts.m_nRequestedTimeLife; m_sURL = rOpts.m_sURL; m_sRedirectedURL = rOpts.m_sRedirectedURL; m_nHttpResponseStatusCode = rOpts.m_nHttpResponseStatusCode; @@ -81,6 +84,7 @@ bool DAVOptions::operator==( const DAVOptions& rOpts ) const m_isHeadAllowed == rOpts.m_isHeadAllowed && m_aAllowedMethods == rOpts.m_aAllowedMethods && m_nStaleTime == rOpts.m_nStaleTime && +m_nRequestedTimeLife == rOpts.m_nRequestedTimeLife && m_sURL == rOpts.m_sURL && m_sRedirectedURL == rOpts.m_sRedirectedURL && m_nHttpResponseStatusCode == rOpts.m_nHttpResponseStatusCode && @@ -149,26 +153,6 @@ void DAVOptionsCache::addDAVOptions( DAVOptions & rDAVOptions, const sal_uInt32 normalizeURLLastChar( aEncodedUrl ); rDAVOptions.setURL( aEncodedUrl ); -// unchanged, it may be used to access a server -OUString aRedirURL( rDAVOptions.getRedirectedURL() ); -rDAVOptions.setRedirectedURL( aRedirURL ); - -TimeValue t1; -osl_getSystemTime( ); -rDAVOptions.setStaleTime( t1.Seconds + nLifeTime ); - -m_aTheCache[ aEncodedUrl ] = rDAVOptions; -} - -void DAVOptionsCache::updateCachedOption( DAVOptions & rDAVOptions, const sal_uInt32 nLifeTime ) -{ -osl::MutexGuard aGuard( m_aMutex ); -OUString aURL( rDAVOptions.getURL() ); - -OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(aURL) ) ); -normalizeURLLastChar( aEncodedUrl ); -rDAVOptions.setURL( aEncodedUrl ); - // unchanged, it may be used to access a server OUString aRedirURL( rDAVOptions.getRedirectedURL() ); rDAVOptions.setRedirectedURL( aRedirURL ); @@ -177,20 +161,16 @@ void DAVOptionsCache::updateCachedOption( DAVOptions & rDAVOptions, const sal_uI DAVOptionsMap::iterator it; it = m_aTheCache.find( aEncodedUrl ); if ( it != m_aTheCache.end() ) -{ -DAVOptions = (*it).second; -// exists, set new staletime, only if remaining time is higher -TimeValue t1; -osl_getSystemTime( ); - -if ( ( opts.getStaleTime() - t1.Seconds ) > nLifeTime ) -{ -opts.setStaleTime( t1.Seconds + nLifeTime ); -} -// update relevant fields -opts.setHttpResponseStatusCode( rDAVOptions.getHttpResponseStatusCode() ); -opts.setHttpResponseStatusText( rDAVOptions.getHttpResponseStatusText() ); +{ // already in cache, check LifeTime +if ( (*it).second.getRequestedTimeLife() == nLifeTime ) +return; // same lifetime, do nothing } +// not in cache, add it +TimeValue t1; +osl_getSystemTime( ); +
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVTypes.cxx | 77 +++- ucb/source/ucp/webdav-curl/DAVTypes.hxx |6 + ucb/source/ucp/webdav-curl/webdavcontent.cxx | 100 ++- 3 files changed, 144 insertions(+), 39 deletions(-) New commits: commit 2afb51076c3f766ab39cbfc66d8469889a2b0a5c Author: Giuseppe Castagno AuthorDate: Mon Sep 12 20:59:09 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:51:27 2021 +0100 ucb: webdav-curl: tdf#102499 (5): Deal with HTTP unofficial response status codes A reference can be found here: <https://en.wikipedia.org/wiki/List_of_HTTP_status_codes> (retrieved 2016-09-13). Changes done: Add set of 'HEAD method not available' before using fall back GET method. Add new method in OPTIONS cache. Add response status code if fall-back GET didn't succeeded. Add copy-assignement operator to DAVOptions. Fix behaviour of GET fall back when HEAD missing. [ port of commit 16df731a30917a426df81d751a0bfd0ae5fcdd45 ] Change-Id: I4dbf4ead49f72617fad0a13f75b8e361d1a8dba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123497 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx b/ucb/source/ucp/webdav-curl/DAVTypes.cxx index ad39d0d46095..d16b7bacc3bd 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx @@ -36,7 +36,6 @@ DAVOptions::DAVOptions() : { } - DAVOptions::DAVOptions( const DAVOptions & rOther ) : m_isClass1( rOther.m_isClass1 ), m_isClass2( rOther.m_isClass2 ), @@ -52,11 +51,25 @@ DAVOptions::DAVOptions( const DAVOptions & rOther ) : { } - DAVOptions::~DAVOptions() { } +DAVOptions & DAVOptions::operator=( const DAVOptions& rOpts ) +{ +m_isClass1 = rOpts.m_isClass1; +m_isClass2 = rOpts.m_isClass2; +m_isClass3 = rOpts.m_isClass3; +m_isLocked = rOpts.m_isLocked; +m_isHeadAllowed = rOpts.m_isHeadAllowed; +m_aAllowedMethods = rOpts.m_aAllowedMethods; +m_nStaleTime = rOpts.m_nStaleTime; +m_sURL = rOpts.m_sURL; +m_sRedirectedURL = rOpts.m_sRedirectedURL; +m_nHttpResponseStatusCode = rOpts.m_nHttpResponseStatusCode; +m_sHttpResponseStatusText = rOpts.m_sHttpResponseStatusText; +return *this; +} bool DAVOptions::operator==( const DAVOptions& rOpts ) const { @@ -81,12 +94,10 @@ DAVOptionsCache::DAVOptionsCache() { } - DAVOptionsCache::~DAVOptionsCache() { } - bool DAVOptionsCache::getDAVOptions( const OUString & rURL, DAVOptions & rDAVOptions ) { osl::MutexGuard aGuard( m_aMutex ); @@ -115,7 +126,6 @@ bool DAVOptionsCache::getDAVOptions( const OUString & rURL, DAVOptions & rDAVOpt } } - void DAVOptionsCache::removeDAVOptions( const OUString & rURL ) { osl::MutexGuard aGuard( m_aMutex ); @@ -130,7 +140,6 @@ void DAVOptionsCache::removeDAVOptions( const OUString & rURL ) } } - void DAVOptionsCache::addDAVOptions( DAVOptions & rDAVOptions, const sal_uInt32 nLifeTime ) { osl::MutexGuard aGuard( m_aMutex ); @@ -151,6 +160,39 @@ void DAVOptionsCache::addDAVOptions( DAVOptions & rDAVOptions, const sal_uInt32 m_aTheCache[ aEncodedUrl ] = rDAVOptions; } +void DAVOptionsCache::updateCachedOption( DAVOptions & rDAVOptions, const sal_uInt32 nLifeTime ) +{ +osl::MutexGuard aGuard( m_aMutex ); +OUString aURL( rDAVOptions.getURL() ); + +OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(aURL) ) ); +normalizeURLLastChar( aEncodedUrl ); +rDAVOptions.setURL( aEncodedUrl ); + +// unchanged, it may be used to access a server +OUString aRedirURL( rDAVOptions.getRedirectedURL() ); +rDAVOptions.setRedirectedURL( aRedirURL ); + +// check if already cached +DAVOptionsMap::iterator it; +it = m_aTheCache.find( aEncodedUrl ); +if ( it != m_aTheCache.end() ) +{ +DAVOptions = (*it).second; +// exists, set new staletime, only if remaining time is higher +TimeValue t1; +osl_getSystemTime( ); + +if ( ( opts.getStaleTime() - t1.Seconds ) > nLifeTime ) +{ +opts.setStaleTime( t1.Seconds + nLifeTime ); +} +// update relevant fields +opts.setHttpResponseStatusCode( rDAVOptions.getHttpResponseStatusCode() ); +opts.setHttpResponseStatusText( rDAVOptions.getHttpResponseStatusText() ); +} +} + sal_uInt16 DAVOptionsCache::getHttpResponseStatusCode( const OUString & rURL, OUString & rHttpResponseStatusText ) { osl::MutexGuard aGuard( m_aMutex ); @@ -176,6 +218,29 @@ sal_uInt16 DAVOptionsCache::getHttpResponseStatusCode( const OUString & rURL, OU return 0; } +void DAVOptionsCache::setHeadAllowed( const OUString & rURL, const bool HeadAllowed ) +{ +osl::MutexGuard aGuard( m_aMutex ); +OUString aEncodedUr
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx | 21 ++--- ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx | 11 ++- ucb/source/ucp/webdav-curl/webdavcontent.cxx | 15 ++- 3 files changed, 22 insertions(+), 25 deletions(-) New commits: commit acc8ba867692c4ab426daed5414f1e9fdd90ba4a Author: Giuseppe Castagno AuthorDate: Mon Oct 3 16:20:43 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:50:31 2021 +0100 ucb: webdav-curl: tdf#101094 (36): Fix behaviour of GET in fetching Headers only Implement a better way to GET only headers, as HEAD method substitute. Wrote a new version of GET, specifically for 'no payload' service because sometimes neon was returning an internal error about: 'Compressed response was truncated' but without a specific error state. [ port of commit f7697a633cd56003fcb1d86bee7eb658020af506 - omit the actual change in NeonSession because it's not obvious if it is needed/was a neon-specific problem ] Change-Id: Ic6afe37d0e010745091301fd9647fc1b3b9e378d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123495 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx index e76e6ae9d1fa..291f0d580b8d 100644 --- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx @@ -483,7 +483,8 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( } -uno::Reference< io::XInputStream > DAVResourceAccess::GET( +// used as HEAD substitute when HEAD is not implemented on server +void DAVResourceAccess::GET0( DAVRequestHeaders , const std::vector< OUString > & rHeaderNames, DAVResource & rResource, @@ -504,14 +505,14 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( ucb::WebDAVHTTPMethod_GET, rRequestHeaders ); -xStream = m_xSession->GET( getRequestURI(), - rHeaderNames, - rResource, - DAVRequestEnvironment( - getRequestURI(), - new DAVAuthListener_Impl( - xEnv, m_aURL ), - rRequestHeaders, xEnv ) ); +m_xSession->GET( getRequestURI(), + rHeaderNames, + rResource, + DAVRequestEnvironment( + getRequestURI(), + new DAVAuthListener_Impl( + xEnv, m_aURL ), + rRequestHeaders, xEnv ) ); } catch (DAVException const& e) { @@ -522,8 +523,6 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( } } while ( bRetry ); - -return xStream; } diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx b/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx index 613953173dbf..1abde0fe2d8e 100644 --- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx +++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx @@ -125,12 +125,13 @@ public: DAVResource & rResource, const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ); +/// used as HEAD substitute when HEAD is not implemented on server /// @throws DAVException -css::uno::Reference< css::io::XInputStream > -GET( DAVRequestHeaders & rRequestHeaders, - const std::vector< OUString > & rHeaderNames, // empty == 'all' - DAVResource & rResource, - const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ); +void +GET0( DAVRequestHeaders & rRequestHeaders, + const std::vector< OUString > & rHeaderNames, // empty == 'all' + DAVResource & rResource, + const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ); /// @throws DAVException void diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index d421d9ade8b1..4698f7078166 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -115,10 +115,7 @@ void lcl_sendPartialGETRequest( bool , } try { -uno::Reference< io::XInputStream > xIn = xResAccess->GET( aPartialGet, - aHeaderNames, - aResource, -
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) New commits: commit 8683c862ba6f7897e5f41294394f5f3bb18fcf16 Author: Giuseppe Castagno AuthorDate: Sun Oct 2 10:58:52 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:49:53 2021 +0100 ucb: webdav-curl: tdf#101094 (35): Add OPTIONS as pre-check in direct WebDAV open() method The function call will act as a precheck on Web resource access error when accessing the open directly without the normal file open procedure, e.g. accessing Web resource property values first. An example of this direct open call are the extension fetching and the extension update check. [ port of commit 909b6b84944e17141109272d917dcf4887483e5a ] Change-Id: Ic04903cfc1b056e150a080fc32428d43e3f842e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123494 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 331ca1a085e0..d421d9ade8b1 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -2163,7 +2163,15 @@ uno::Any Content::open( removeCachedPropertyNames( xResAccess->getURL() ); // check if the resource was present on the server -if( aStaticDAVOptionsCache.isResourceFound( aTargetURL ) ) +// first update it, if necessary +// if the open is called directly, without the default open sequence, +// e.g. the one used when opening a file looking for properties +// first this call will have no effect, since OPTIONS would have already been called +// as a consequence of getPropertyValues() +DAVOptions aDAVOptions; +getResourceOptions( xEnv, aDAVOptions, xResAccess ); + +if( aDAVOptions.isResourceFound() ) { uno::Reference< io::XInputStream > xIn = xResAccess->GET( aHeaders, aResource, xEnv );
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/CurlSession.cxx |2 +- ucb/source/ucp/webdav-curl/DAVTypes.cxx|1 + ucb/source/ucp/webdav-curl/DAVTypes.hxx| 24 3 files changed, 14 insertions(+), 13 deletions(-) New commits: commit c7d95240b90001c7e253aa65ed8dc804a2719849 Author: Giuseppe Castagno AuthorDate: Sat Oct 1 12:35:57 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:49:21 2021 +0100 ucb: webdav-curl: tdf#101094 (34): Fix test and missing field value in comparision operator [ port of commit d751af3f84909996d44b9354ce9ed34891d374e1 ] Change-Id: I2b425741672e09eec3e42eb7af34cac9c20164eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123493 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx index eab01e77d07b..9700540d6565 100644 --- a/ucb/source/ucp/webdav-curl/CurlSession.cxx +++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx @@ -1113,7 +1113,7 @@ auto CurlSession::OPTIONS(OUString const& rURIReference, { SAL_INFO("ucb.ucp.webdav.curl", "OPTIONS: " << rURIReference); -rOptions.reset(); +rOptions.init(); ::std::vector const headerNames{ "allow", "dav" }; DAVResource result; diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx b/ucb/source/ucp/webdav-curl/DAVTypes.cxx index 6e5e51ef25d5..39543c3dcf98 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx @@ -64,6 +64,7 @@ bool DAVOptions::operator==( const DAVOptions& rOpts ) const m_isClass2 == rOpts.m_isClass2 && m_isClass3 == rOpts.m_isClass3 && m_isLocked == rOpts.m_isLocked && +m_isHeadAllowed == rOpts.m_isHeadAllowed && m_aAllowedMethods == rOpts.m_aAllowedMethods && m_nStaleTime == rOpts.m_nStaleTime && m_sURL == rOpts.m_sURL && diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx b/ucb/source/ucp/webdav-curl/DAVTypes.hxx index 23cdd9f694d0..7959cf150bce 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx @@ -91,13 +91,13 @@ namespace http_dav_ucp virtual ~DAVOptions(); -bool isResourceFound() const { return m_isResourceFound; }; +bool isResourceFound() { return m_isResourceFound; }; void setResourceFound( bool ResourceFound = true ) { m_isResourceFound = ResourceFound; }; -bool isClass1() const { return m_isClass1; }; +bool isClass1() { return m_isClass1; }; void setClass1( bool Class1 = true ) { m_isClass1 = Class1; }; -bool isClass2() const { return m_isClass2; }; +bool isClass2() { return m_isClass2; }; void setClass2( bool Class2 = true ) { m_isClass2 = Class2; }; bool isClass3() { return m_isClass3; }; @@ -109,20 +109,20 @@ namespace http_dav_ucp sal_uInt32 getStaleTime() const { return m_nStaleTime ; }; void setStaleTime( const sal_uInt32 nStaleTime ) { m_nStaleTime = nStaleTime; }; -OUString & getURL() { return m_sURL; }; -void setURL( OUString & sURL ) { m_sURL = sURL; }; +const OUString & getURL() { return m_sURL; }; +void setURL( const OUString & sURL ) { m_sURL = sURL; }; -OUString & getRedirectedURL() { return m_sRedirectedURL; }; -void setRedirectedURL( OUString & sRedirectedURL ) { m_sRedirectedURL = sRedirectedURL; }; +const OUString & getRedirectedURL() { return m_sRedirectedURL; }; +void setRedirectedURL( const OUString & sRedirectedURL ) { m_sRedirectedURL = sRedirectedURL; }; -void setAllowedMethods( OUString & aAllowedMethods ) { m_aAllowedMethods = aAllowedMethods; } ; -OUString & getAllowedMethods() { return m_aAllowedMethods; } ; -bool isLockAllowed() const { return ( m_aAllowedMethods.indexOf( "LOCK" ) != -1 ); }; +void setAllowedMethods( const OUString & aAllowedMethods ) { m_aAllowedMethods = aAllowedMethods; } ; +const OUString & getAllowedMethods() { return m_aAllowedMethods; } ; +bool isLockAllowed() { return ( m_aAllowedMethods.indexOf( "LOCK" ) != -1 ); }; void setLocked( bool locked = true ) { m_isLocked = locked; } ; -bool isLocked() const { return m_isLocked; }; +bool isLocked() { return m_isLocked; }; -void reset() { +void init() { m_isResourceFound = false; m_isClass1 = false; m_isClass2 = false;
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVTypes.cxx | 29 + ucb/source/ucp/webdav-curl/DAVTypes.hxx |8 +++ ucb/source/ucp/webdav-curl/webdavcontent.cxx | 56 +++ ucb/source/ucp/webdav-curl/webdavcontent.hxx |3 - 4 files changed, 88 insertions(+), 8 deletions(-) New commits: commit 00fbb60bfecb8ef52b61f1720017106addf6c14d Author: Giuseppe Castagno AuthorDate: Sat Aug 27 17:31:06 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:47:37 2021 +0100 ucb: webdav-curl: tdf#101094 (32): Use a partial GET as a fall-back for HEAD... ... partial GET means a GET with no data returned, to test for resource 'real' availability in case HEAD fails or is disabled. At the same time disable use of HEAD method on the resource for the whole access procedure. This change is needed to manage web servers that don't permit the use of either HEAD or OPTIONS methods. To accomodate pure web sites that enable only GET to fetch contents. [ port of commit 2a148e2b5ea11fd371042e836fa95438ffa738e7 ] Change-Id: Ie0e2b6edd0860cbf704082500b91631543e7da38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123488 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx b/ucb/source/ucp/webdav-curl/DAVTypes.cxx index fd4cf2283ecd..6e5e51ef25d5 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx @@ -26,6 +26,7 @@ DAVOptions::DAVOptions() : m_isClass1( false ), m_isClass2( false ), m_isClass3( false ), +m_isHeadAllowed( true ), m_isLocked( false ), m_aAllowedMethods(), m_nStaleTime( 0 ), @@ -40,6 +41,7 @@ DAVOptions::DAVOptions( const DAVOptions & rOther ) : m_isClass1( rOther.m_isClass1 ), m_isClass2( rOther.m_isClass2 ), m_isClass3( rOther.m_isClass3 ), +m_isHeadAllowed( rOther.m_isHeadAllowed ), m_isLocked( rOther.m_isLocked ), m_aAllowedMethods( rOther.m_aAllowedMethods ), m_nStaleTime( rOther.m_nStaleTime ), @@ -175,5 +177,32 @@ bool DAVOptionsCache::isResourceFound( const OUString & rURL ) return true; } +bool DAVOptionsCache::isHeadAllowed( const OUString & rURL ) +{ +osl::MutexGuard aGuard( m_aMutex ); +OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(rURL) ) ); +normalizeURLLastChar( aEncodedUrl ); + +DAVOptionsMap::iterator it; +it = m_aTheCache.find( aEncodedUrl ); +if ( it != m_aTheCache.end() ) +{ +// first check for stale +TimeValue t1; +osl_getSystemTime( ); +if( (*it).second.getStaleTime() < t1.Seconds ) +{ +m_aTheCache.erase( it ); +return true; // to force again OPTIONS method +} + +// check if the resource was present on server +return (*it).second.isHeadAllowed(); +} +// this value is needed because some web server don't implement +// OPTIONS method, so the resource is considered found, +// until detected otherwise +return true; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx b/ucb/source/ucp/webdav-curl/DAVTypes.hxx index 7000945bbf43..be6eedc2d4c0 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx @@ -71,6 +71,8 @@ namespace http_dav_ucp boolm_isClass1; boolm_isClass2; boolm_isClass3; +// for server that do not implement it +boolm_isHeadAllowed; // Internally used to maintain locked stated of the resource, only // if it's a Class 2 resource boolm_isLocked; @@ -101,6 +103,9 @@ namespace http_dav_ucp bool isClass3() { return m_isClass3; }; void setClass3( bool Class3 = true ) { m_isClass3 = Class3; }; +bool isHeadAllowed() { return m_isHeadAllowed; }; +void setHeadAllowed( bool HeadAllowed = true ) { m_isHeadAllowed = HeadAllowed; }; + sal_uInt32 getStaleTime() const { return m_nStaleTime ; }; void setStaleTime( const sal_uInt32 nStaleTime ) { m_nStaleTime = nStaleTime; }; @@ -123,6 +128,7 @@ namespace http_dav_ucp m_isClass1 = false; m_isClass2 = false; m_isClass3 = false; +m_isHeadAllowed = true; m_isLocked = false; m_aAllowedMethods.clear(); m_nStaleTime = 0; @@ -168,6 +174,8 @@ namespace http_dav_ucp */ bool isResourceFound( const OUString & rURL ); +bool isHeadAllowed( const OUString & rURL ); + private: /// remove the last '/' in aUrl, if it exists diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index f0a0f9baeb0c..a9e3ef868201 100644 --- a/ucb
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) New commits: commit 6e423be3a811bd44902290b0db48754ef1a59f1b Author: Giuseppe Castagno AuthorDate: Mon Sep 12 22:01:37 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:46:43 2021 +0100 ucb: webdav-curl: tdf#101094 (30): Better explanation of OPTIONS errors in debug build [ port of commit e137caed30052359783f2b112eee72553be1bd4f ] Change-Id: I758ce62c8e87407bab783c75fb8c9218dccc3f00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123486 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 385fa3e27a3a..6f24f1269e89 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3915,13 +3915,14 @@ void Content::getResourceOptions( // not same as not found, this instead happens when the server doesn't exist or doesn't aswer at all // probably a new bit stating 'timed out' should be added to opts var? // in any case abort the command +SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException: DAV_HTTP_TIMEOUT or DAV_HTTP_CONNECT for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); cancelCommandExecution( e, xEnv ); // unreachable } break; case DAVException::DAV_HTTP_AUTH: { -SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException Authentication error for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException: DAV_HTTP_AUTH for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); // - the remote site is a WebDAV with special configuration: read/only for read operations // and read/write for write operations, the user is not allowed to lock/write and // she cancelled the credentials request. @@ -3935,7 +3936,7 @@ void Content::getResourceOptions( { case SC_FORBIDDEN: { -SAL_WARN( "ucb.ucp.webdav","OPTIONS - Forbidden for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +SAL_WARN( "ucb.ucp.webdav","OPTIONS - SC_FORBIDDEN for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); rDAVOptions.setResourceFound(); // it may exists, will be checked by HEAD or GET method, surely it's not DAV // cache it, so OPTIONS won't be called again, this URL does not support it aStaticDAVOptionsCache.addDAVOptions( rDAVOptions, @@ -3944,7 +3945,7 @@ void Content::getResourceOptions( break; case SC_BAD_REQUEST: { -SAL_WARN( "ucb.ucp.webdav","OPTIONS - Bad request for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +SAL_WARN( "ucb.ucp.webdav","OPTIONS - SC_BAD_REQUEST for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); rDAVOptions.setResourceFound(); // it may exists, will be checked by HEAD or GET method, surely it's not DAV // cache it, so OPTIONS won't be called again, this URL does not support it aStaticDAVOptionsCache.addDAVOptions( rDAVOptions, @@ -3956,7 +3957,7 @@ void Content::getResourceOptions( { // OPTIONS method must be implemented in DAV // resource is NON_DAV, or not advertising it -SAL_WARN( "ucb.ucp.webdav","OPTIONS - Method not implemented or not allowed for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +SAL_WARN( "ucb.ucp.webdav","OPTIONS - SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); rDAVOptions.setResourceFound(); // means it exists, but it's not DAV // cache it, so OPTIONS won't be called again, this URL does not support it
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) New commits: commit dad80891bfd5050024c6dd4fbb558d1a5d6fe474 Author: Giuseppe Castagno AuthorDate: Mon Aug 29 09:10:42 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:46:25 2021 +0100 ucb: webdav-curl: WebDAV: Make some SAL_WARN log wording a bit better [ port of commit 4a70eac6045c4d3d5773ad0807dcde5a25391836 ] Change-Id: Ie0ec0bea4f1f482c2f80899c45c95ee6c0c70795 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123485 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index b96a58b3fb83..385fa3e27a3a 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3063,13 +3063,13 @@ Content::ResourceType Content::resourceTypeForLocks( case SC_METHOD_NOT_ALLOWED: // <http://tools.ietf.org/html/rfc7231#section-6.5.5> // they all mean the resource is NON_DAV SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() DAVException (SC_FORBIDDEN, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" - << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); + << m_xIdentifier->getContentIdentifier() << ">, DAV ExceptionCode: " << e.getError() << ", HTTP error: " << e.getStatus() ); eResourceTypeForLocks = NON_DAV; break; default: //fallthrough SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() DAVException - URL: <" - << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); + << m_xIdentifier->getContentIdentifier() << ">, DAV ExceptionCode: " << e.getError() << ", HTTP error: " << e.getStatus() ); eResourceTypeForLocks = UNKNOWN; } } @@ -3223,7 +3223,7 @@ void Content::lock( case SC_NOT_IMPLEMENTED:// <http://tools.ietf.org/html/rfc7231#section-6.6.2> case SC_METHOD_NOT_ALLOWED: // <http://tools.ietf.org/html/rfc7231#section-6.5.5> SAL_WARN( "ucb.ucp.webdav", "lock() DAVException (SC_NOT_FOUND, SC_PRECONDITION_FAILED, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" - << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); + << m_xIdentifier->getContentIdentifier() << ">, DAV ExceptionCode: " << e.getError() << ", HTTP error: " << e.getStatus() ); // act as nothing happened // that's because when a resource is first created // the lock is sent before the put, so the resource @@ -3252,8 +3252,8 @@ void Content::lock( ; } -SAL_WARN( "ucb.ucp.webdav","lock(): DAVException - URL: <" - << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); +SAL_WARN( "ucb.ucp.webdav","lock() DAVException - URL: <" + << m_xIdentifier->getContentIdentifier() << ">, DAV ExceptionCode: " << e.getError() << ", HTTP error: " << e.getStatus() ); cancelCommandExecution( e, Environment, false ); // Unreachable } @@ -3315,7 +3315,7 @@ void Content::unlock( case SC_NOT_IMPLEMENTED:// <http://tools.ietf.org/html/rfc7231#section-6.6.2> case SC_METHOD_NOT_ALLOWED: // <http://tools.ietf.org/html/rfc7231#section-6.5.5> SAL_WARN( "ucb.ucp.webdav", "unlock() DAVException (SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" -
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 34 ++- ucb/source/ucp/webdav-curl/webdavcontent.hxx |3 ++ 2 files changed, 36 insertions(+), 1 deletion(-) New commits: commit 9703240ea9c8932b32f16fd30c059d5e034fe9a0 Author: Giuseppe Castagno AuthorDate: Sat Aug 27 12:29:21 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:46:02 2021 +0100 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 Reviewed-by: Michael Stahl 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 ); };
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 29 +++ ucb/source/ucp/webdav-curl/webdavcontent.hxx |1 ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx |6 3 files changed, 36 insertions(+) New commits: commit 1cb59f9187f6dfd255bb0d47bdb5ca8be09ea47e Author: Giuseppe Castagno AuthorDate: Wed Aug 3 18:12:58 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:45:44 2021 +0100 ucb: webdav-curl: Related: tdf#82677, remove cached element when appropriate [ port of commit 90ded4cbf1ffbde2ef7926fb225759896ef075bf ] Change-Id: I7ffe75dc7a85088086f33b22eb1338ea22c1f363 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123483 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index e69633f0d207..237c51851af0 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -583,6 +583,8 @@ uno::Any SAL_CALL Content::execute( xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) ); } aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); +// clean cached value of PROPFIND property names +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->DESTROY( Environment ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -862,6 +864,9 @@ void Content::addProperty( const css::ucb::PropertyCommandArgument , xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) ); } aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); +// clean cached value of PROPFIND property names +// PROPPATCH can change them +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -969,6 +974,9 @@ void Content::removeProperty( const OUString& Name, xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) ); } aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); +// clean cached value of PROPFIND property names +// PROPPATCH can change them +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -1450,6 +1458,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( try { DAVResource resource; +// clean cached value of PROPFIND property names +// PROPPATCH can change them +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->HEAD( aHeaderNames, resource, xEnv ); m_bDidGetOrHead = true; @@ -1886,6 +1897,9 @@ uno::Sequence< uno::Any > Content::setPropertyValues( { try { +// clean cached value of PROPFIND property names +// PROPPATCH can change them +removeCachedPropertyNames( xResAccess->getURL() ); // Set property values at server. aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); @@ -1947,6 +1961,9 @@ uno::Sequence< uno::Any > Content::setPropertyValues( targetURI.SetScheme( sourceURI.GetScheme() ); +// clean cached value of PROPFIND property names +removeCachedPropertyNames( sourceURI.GetURI() ); +removeCachedPropertyNames( targetURI.GetURI() ); aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); xResAccess->MOVE( @@ -2093,6 +2110,7 @@ uno::Any Content::open( DAVResource aResource; std::vector< OUString > aHeaders; +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->GET( xOut, aHeaders, aResource, xEnv ); m_bDidGetOrHead = true; @@ -2139,6 +2157,7 @@ uno::Any Content::open( DAVResource aResource; std::vector< OUString > aHeaders; +removeCachedPropertyNames( xResAccess->getURL() ); // check if the resource was present on the server if( aStaticDAVOptionsCache.isResourceFound( aTargetURL ) ) { @@ -2243,6 +2262,7 @@ void Content::post( new DAVResourceAccess( *m_xResAccess ) ); } +
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) New commits: commit e384a009c35542c51e0f991466af40b70a4fdb33 Author: Giuseppe Castagno AuthorDate: Sat Aug 20 15:53:17 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:45:19 2021 +0100 ucb: webdav-curl: Related: tdf#82677, add cache use in Content::getProperties() [ port of commit 00e1f840be4a1ff202d82377b3cbf233b352b1c3 ] Change-Id: I8c7f372404239276101fb7f64ba3415ef922e7e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123482 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx b/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx index ca1fde461ebf..e44e08812b73 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx @@ -257,6 +257,8 @@ bool ContentProvider::getProperty( } +static PropertyNamesCache aStaticPropertyNamesCache; + // Content implementation. @@ -295,7 +297,21 @@ uno::Sequence< beans::Property > Content::getProperties( try { std::vector< DAVResourceInfo > props; -xResAccess->PROPFIND( DAVZERO, props, xEnv ); +OUString aTheURL( xResAccess->getURL() ); +PropertyNames aPropsNames( aTheURL ); + +if( !aStaticPropertyNamesCache.getCachedPropertyNames( aTheURL, aPropsNames ) ) +{ + +xResAccess->PROPFIND( DAVZERO, props, xEnv ); +aPropsNames.setPropertiesNames( props ); + +aStaticPropertyNamesCache.addCachePropertyNames( aPropsNames, 10 ); +} +else +{ +props = aPropsNames.getPropertiesNames(); +} // Note: vector always contains exactly one resource info, because // we used a depth of DAVZERO for PROPFIND.
[Libreoffice-commits] core.git: solenv/clang-format ucb/Library_ucpdav1.mk ucb/source
solenv/clang-format/excludelist |2 ucb/Library_ucpdav1.mk |1 ucb/source/ucp/webdav-curl/DAVResource.hxx |5 + ucb/source/ucp/webdav-curl/PropfindCache.cxx | 91 +++ ucb/source/ucp/webdav-curl/PropfindCache.hxx | 81 ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx |1 6 files changed, 181 insertions(+) New commits: commit 7541727dfc5938910ce58c73c4dfbcd727dcb7f1 Author: Giuseppe Castagno AuthorDate: Sat Aug 20 15:45:07 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:44:58 2021 +0100 ucb: webdav-curl: Related: tdf#82677, implement a PROPFIND 'propname' request cache PROPFIND 'propname' is the special usage to retrieve all the properties available on the URI resource, their names only. See <https://tools.ietf.org/html/rfc4918#section-9.1> for PROPFIND 'propname' definition. Add cache usage in Content::getProperties as well. The caching model is simple: a simple lifetime limit of 10 seconds to declare the property name list stale and request another list, accessing the Net. This should reduce the number of PROPFIND calls on the Net. [ port of commit 98bd24f8b479132ca3f2d884749b738e9e6203e3 ] Change-Id: I48ae38f706370557698dd80e31840b44e05bfef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123481 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index af38ed914cb2..2608eb588055 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -14006,6 +14006,8 @@ ucb/source/ucp/webdav-curl/DAVTypes.hxx ucb/source/ucp/webdav-curl/DateTimeHelper.cxx ucb/source/ucp/webdav-curl/DateTimeHelper.hxx ucb/source/ucp/webdav-curl/PropertyMap.hxx +ucb/source/ucp/webdav-curl/PropfindCache.cxx +ucb/source/ucp/webdav-curl/PropfindCache.hxx ucb/source/ucp/webdav-curl/SerfLockStore.cxx ucb/source/ucp/webdav-curl/SerfLockStore.hxx ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk index ee1c944b1fbd..b8cbb2be48e1 100644 --- a/ucb/Library_ucpdav1.mk +++ b/ucb/Library_ucpdav1.mk @@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\ ucb/source/ucp/webdav-curl/DAVSessionFactory \ ucb/source/ucp/webdav-curl/DAVTypes \ ucb/source/ucp/webdav-curl/DateTimeHelper \ + ucb/source/ucp/webdav-curl/PropfindCache \ ucb/source/ucp/webdav-curl/SerfLockStore \ ucb/source/ucp/webdav-curl/UCBDeadPropertyValue \ ucb/source/ucp/webdav-curl/webdavcontent \ diff --git a/ucb/source/ucp/webdav-curl/DAVResource.hxx b/ucb/source/ucp/webdav-curl/DAVResource.hxx index 8bbe89587acc..4b031f0a2a57 100644 --- a/ucb/source/ucp/webdav-curl/DAVResource.hxx +++ b/ucb/source/ucp/webdav-curl/DAVResource.hxx @@ -49,6 +49,11 @@ struct DAVResource struct DAVResourceInfo { std::vector < OUString > properties; + +bool operator==( const struct DAVResourceInfo& a ) const +{ +return (properties == a.properties ); +} }; } // namespace http_dav_ucp diff --git a/ucb/source/ucp/webdav-curl/PropfindCache.cxx b/ucb/source/ucp/webdav-curl/PropfindCache.cxx new file mode 100644 index ..4bf9bf933f0b --- /dev/null +++ b/ucb/source/ucp/webdav-curl/PropfindCache.cxx @@ -0,0 +1,91 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include "PropfindCache.hxx" + +namespace http_dav_ucp +{ + +// PropertyNames implementation + +PropertyNames::PropertyNames() : +m_nStaleTime( 0 ), +m_sURL(), +m_aPropertiesNames() +{ +} + +PropertyNames::PropertyNames( const OUString& rURL ) : +m_nStaleTime( 0 ), +m_sURL( rURL ), +m_aPropertiesNames() +{ +} + +//PropertyNamesCache implementation + +PropertyNamesCache::PropertyNamesCache() +{ +} + +PropertyNamesCache::~PropertyNamesCache() +{ +} + +bool PropertyNamesCache::getCachedPropertyNames( const OUString& rURL, PropertyNames& rCacheElement ) +{ +// search the URL in the static map +osl::MutexGuard aGuard( m_aMutex ); +PropNameCache::const_iterator it; +it = m_aTheCache.find( rURL ); +if ( it == m_aTheCache.end() ) +return false; +else +{ +// check if the element is stale, before restoring +TimeValue t1; +osl_getSystemTime( ); +if ( (*
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVTypes.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ee7a590994c3853945fd7fa0c41e4755e741f2b9 Author: Giuseppe Castagno AuthorDate: Sat Aug 20 21:00:03 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:44:32 2021 +0100 ucb: webdav-curl: tdf#101094 (26): Fix possible early relase of cache mutex [ port of commit 6431e91eca9e44684066a32ed3d6411509dac781 ] Change-Id: I90391c38bf9d0f4acf68ce29b2382ad855aa56ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123480 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx b/ucb/source/ucp/webdav-curl/DAVTypes.cxx index a7864350fbac..fd4cf2283ecd 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx @@ -100,7 +100,7 @@ bool DAVOptionsCache::getDAVOptions( const OUString & rURL, DAVOptions & rDAVOpt if ( (*it).second.getStaleTime() < t1.Seconds ) { // if stale, remove from cache, do not restore -removeDAVOptions( rURL ); +m_aTheCache.erase( it ); return false; // return false instead }
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVTypes.hxx | 22 +- ucb/source/ucp/webdav-curl/webdavcontent.cxx |5 - 2 files changed, 13 insertions(+), 14 deletions(-) New commits: commit be53d60f85706eeae3a9300e75cae6ed1cd4e642 Author: Giuseppe Castagno AuthorDate: Tue Aug 16 16:09:46 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:44:06 2021 +0100 ucb: webdav-curl: tdf#101094 (25): Make a std::less explicit, add/remove TODOs... ... and a bit of function member signature change. [ port of commit 5300b55a1dbcbea6ea244e66e3bc91a0218db5c9 ] Change-Id: Ia9d8f78c2fb39bd0943d4c2fb7d9b11cbee1034a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123479 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx b/ucb/source/ucp/webdav-curl/DAVTypes.hxx index b7bc7004b613..7000945bbf43 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx @@ -89,20 +89,20 @@ namespace http_dav_ucp virtual ~DAVOptions(); -bool isResourceFound() { return m_isResourceFound; }; +bool isResourceFound() const { return m_isResourceFound; }; void setResourceFound( bool ResourceFound = true ) { m_isResourceFound = ResourceFound; }; -bool isClass1() { return m_isClass1; }; +bool isClass1() const { return m_isClass1; }; void setClass1( bool Class1 = true ) { m_isClass1 = Class1; }; -bool isClass2() { return m_isClass2; }; +bool isClass2() const { return m_isClass2; }; void setClass2( bool Class2 = true ) { m_isClass2 = Class2; }; bool isClass3() { return m_isClass3; }; void setClass3( bool Class3 = true ) { m_isClass3 = Class3; }; -sal_uInt32 getStaleTime() { return m_nStaleTime ; }; -void setStaleTime( sal_uInt32 nStaleTime ) { m_nStaleTime = nStaleTime; }; +sal_uInt32 getStaleTime() const { return m_nStaleTime ; }; +void setStaleTime( const sal_uInt32 nStaleTime ) { m_nStaleTime = nStaleTime; }; OUString & getURL() { return m_sURL; }; void setURL( OUString & sURL ) { m_sURL = sURL; }; @@ -112,11 +112,11 @@ namespace http_dav_ucp void setAllowedMethods( OUString & aAllowedMethods ) { m_aAllowedMethods = aAllowedMethods; } ; OUString & getAllowedMethods() { return m_aAllowedMethods; } ; -bool isLockAllowed() { return ( m_aAllowedMethods.indexOf( "LOCK" ) != -1 ); }; -bool isUnlockAllowed() { return ( m_aAllowedMethods.indexOf( "UNLOCK" ) != -1 ); }; +bool isLockAllowed() const { return ( m_aAllowedMethods.indexOf( "LOCK" ) != -1 ); }; +bool isUnlockAllowed() const { return ( m_aAllowedMethods.indexOf( "UNLOCK" ) != -1 ); }; void setLocked( bool locked = true ) { m_isLocked = locked; } ; -bool isLocked() { return m_isLocked; }; +bool isLocked() const { return m_isLocked; }; void reset() { m_isResourceFound = false; @@ -135,7 +135,11 @@ namespace http_dav_ucp }; -typedef std::map< OUString, DAVOptions > DAVOptionsMap; +// TODO: the OUString key element in std::map needs to be changed with a URI representation +// along with a specific compare (std::less) implementation, as suggested in +// <https://tools.ietf.org/html/rfc3986#section-6>, to find by URI and not by string comparison +typedef std::map< OUString, DAVOptions, + std::less< OUString > > DAVOptionsMap; class DAVOptionsCache { diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 7429eb075fcf..e69633f0d207 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -867,8 +867,6 @@ void Content::addProperty( const css::ucb::PropertyCommandArgument , osl::Guard< osl::Mutex > aGuard( m_aMutex ); m_xResAccess.reset( new DAVResourceAccess( *xResAccess ) ); } -// TODO PLACEHOLDER: -// remove target URL options from cache, since PROPPATCH may change them // Notify propertyset info change listeners. beans::PropertySetInfoChangeEvent evt( @@ -1891,8 +1889,6 @@ uno::Sequence< uno::Any > Content::setPropertyValues( // Set property values at server. aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); -// TODO PLACEHOLDER: -// remove target URL options from cache, since PROPPATCH may change it for ( const auto& rProppatchValue : aProppatchValues ) { @@ -3031,7 +3027,6 @@ Content::ResourceType Content::resourceTypeForLocks(
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) New commits: commit f157d2de9f241ecc56a00f58bb5ea0b8205e53f9 Author: Giuseppe Castagno AuthorDate: Tue Aug 16 11:02:59 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:43:26 2021 +0100 ucb: webdav-curl: tdf#101094 (24): Simplify cache removal: DESTROY, PROPPATCH, MOVE Plus another PUT forgotten on a previuos commit. [ port of commit 1ed01e1bcc929d363ad5f3c4d2cf262a20134412 plus move Uris back into try block ] Change-Id: Ieda94cc855f8a6b648dda404dfad411795c3dc33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123478 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 8917b749a537..7429eb075fcf 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -582,6 +582,7 @@ uno::Any SAL_CALL Content::execute( osl::Guard< osl::Mutex > aGuard( m_aMutex ); xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) ); } +aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); xResAccess->DESTROY( Environment ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -860,6 +861,7 @@ void Content::addProperty( const css::ucb::PropertyCommandArgument , osl::Guard< osl::Mutex > aGuard( m_aMutex ); xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) ); } +aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -968,6 +970,7 @@ void Content::removeProperty( const OUString& Name, osl::Guard< osl::Mutex > aGuard( m_aMutex ); xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) ); } +aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -1886,6 +1889,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( try { // Set property values at server. +aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); // TODO PLACEHOLDER: // remove target URL options from cache, since PROPPATCH may change it @@ -1940,17 +1944,17 @@ uno::Sequence< uno::Any > Content::setPropertyValues( = new ::ucbhelper::ContentIdentifier( aNewURL ); uno::Reference< ucb::XContentIdentifier > xOldId = xIdentifier; -CurlUri const sourceURI( xOldId->getContentIdentifier() ); -CurlUri targetURI( xNewId->getContentIdentifier() ); - try { +CurlUri const sourceURI( xOldId->getContentIdentifier() ); +CurlUri targetURI( xNewId->getContentIdentifier() ); + targetURI.SetScheme( sourceURI.GetScheme() ); -xResAccess->MOVE( -sourceURI.GetPath(), targetURI.GetURI(), false, xEnv ); aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); +xResAccess->MOVE( +sourceURI.GetPath(), targetURI.GetURI(), false, xEnv ); // @@@ Should check for resources that could not be moved // (due to source access or target overwrite) and send @@ -1985,8 +1989,6 @@ uno::Sequence< uno::Any > Content::setPropertyValues( } catch ( DAVException const & e ) { -aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); -aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); // Do not set new title! aNewTitle.clear(); @@ -2602,14 +2604,13 @@ void Content::insert( OUStringaTargetUrl = xResAccess->getURL(); try { -xResAccess->PUT( xInputStream, Environment ); // remove options from cache, PUT may change it // it will be refreshed when needed aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); +xResAccess->PUT( xInputStream, Environment ); } catch ( DAVException const & e ) { -aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); cancelCommandExecution( e, Environment, true ); // Unreachable }
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 20 1 file changed, 8 insertions(+), 12 deletions(-) New commits: commit 5bce551ffe4cf1292e05ec3fe7f8c92adb38 Author: Giuseppe Castagno AuthorDate: Sun Aug 14 13:18:44 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:43:01 2021 +0100 ucb: webdav-curl: tdf#101094 (23): Simplify cache removal: MOVE, COPY [ port of commit 63af1c52c534840d1f55e3041351d24b85edcaa4 plus move Uris back into try block ] Change-Id: I8cc7f6e14fcac294531b5be8fdbaf78610a3adfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123477 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 5b1fbd5635e7..8917b749a537 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -2184,7 +2184,7 @@ uno::Any Content::open( ucb::IOErrorCode_NOT_EXISTING, aArgs ) ), xEnv ); -// Unreachable +// Unreachable } } catch ( DAVException const & e ) @@ -2640,12 +2640,12 @@ void Content::transfer( xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) ); } -CurlUri sourceURI( rArgs.SourceURL ); -CurlUri targetURI( xIdentifier->getContentIdentifier() ); - OUString aTargetURI; try { +CurlUri sourceURI( rArgs.SourceURL ); +CurlUri targetURI( xIdentifier->getContentIdentifier() ); + aTargetURI = targetURI.GetPathBaseNameUnescaped(); // Check source's and target's URL scheme @@ -2765,13 +2765,13 @@ void Content::transfer( // destination resource. If the Overwrite header is set to // "F" then the operation will fail. +aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); +aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); aSourceAccess.MOVE( sourceURI.GetPath(), targetURI.GetURI(), rArgs.NameClash == ucb::NameClash::OVERWRITE, Environment ); -aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); -aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); if ( xSource.is() ) { @@ -2794,13 +2794,13 @@ void Content::transfer( // destination resource. If the Overwrite header is set to // "F" then the operation will fail. +aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); +aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); aSourceAccess.COPY( sourceURI.GetPath(), targetURI.GetURI(), rArgs.NameClash == ucb::NameClash::OVERWRITE, Environment ); -aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); -aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); // DAV resources store all additional props on server! // // Copy own and all children's Additional Core Properties. @@ -2820,14 +2820,10 @@ void Content::transfer( } catch ( ucb::IllegalIdentifierException const & ) { -aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); -aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); // queryContent } catch ( DAVException const & e ) { -aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); -aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); // [RFC 2518] - WebDAV // 412 (Precondition Failed) - The server was unable to maintain // the liveness of the properties listed in the propertybehavior
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx | 16 ++-- ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx |1 + ucb/source/ucp/webdav-curl/webdavcontent.cxx |4 3 files changed, 19 insertions(+), 2 deletions(-) New commits: commit 0e9cea7ccdac443a51c81ce6ec3e1115a09b00be Author: Giuseppe Castagno AuthorDate: Thu Aug 11 22:20:46 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:42:36 2021 +0100 ucb: webdav-curl: Related: tdf#99499, add a limit to the number of http redirections Check for maximum number of redirections according to <https://tools.ietf.org/html/rfc7231#section-6.4>. A practical limit can be 5, due to old RFC: <https://tools.ietf.org/html/rfc2068#section-10.3>, this limit is reported also in more recent RFCs, see final paragraph of RFC7231, 6.4. [ port of commit 18009fe8fbe3982141ddca3f1fcd0900a63150a6 ] Change-Id: I3a6d1510627434cdff9e4f0af8194a8e6a33c28b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123476 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx index c81d326207d1..cead9980b4a6 100644 --- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx @@ -129,6 +129,7 @@ DAVResourceAccess::DAVResourceAccess( : m_aURL( rURL ), m_xSessionFactory( rSessionFactory ), m_xContext( rContext ) +, m_nRedirectLimit( 5 ) { } @@ -140,7 +141,8 @@ DAVResourceAccess::DAVResourceAccess( const DAVResourceAccess & rOther ) m_xSession( rOther.m_xSession ), m_xSessionFactory( rOther.m_xSessionFactory ), m_xContext( rOther.m_xContext ), - m_aRedirectURIs( rOther.m_aRedirectURIs ) + m_aRedirectURIs( rOther.m_aRedirectURIs ), + m_nRedirectLimit( rOther.m_nRedirectLimit ) { } @@ -155,6 +157,7 @@ DAVResourceAccess & DAVResourceAccess::operator=( m_xSessionFactory = rOther.m_xSessionFactory; m_xContext = rOther.m_xContext; m_aRedirectURIs = rOther.m_aRedirectURIs; +m_nRedirectLimit = rOther.m_nRedirectLimit; return *this; } @@ -1094,7 +1097,7 @@ void DAVResourceAccess::getUserRequestHeaders( } } - +// This function member implements the control on cyclical redirections bool DAVResourceAccess::detectRedirectCycle( ::std::u16string_view const rRedirectURL) { @@ -1102,6 +1105,15 @@ bool DAVResourceAccess::detectRedirectCycle( CurlUri const aUri( rRedirectURL ); +// Check for maximum number of redirections +// according to <https://tools.ietf.org/html/rfc7231#section-6.4>. +// A practical limit may be 5, due to earlier specifications: +// <https://tools.ietf.org/html/rfc2068#section-10.3> +// it can be raised keeping in mind the added net activity. +if( static_cast< size_t >( m_nRedirectLimit ) <= m_aRedirectURIs.size() ) +return true; + +// try to detect a cyclical redirection return std::any_of(m_aRedirectURIs.begin(), m_aRedirectURIs.end(), [](const CurlUri& rUri) { return aUri == rUri; }); } diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx b/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx index 86a392e23cf1..051e53c4c8f5 100644 --- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx +++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx @@ -52,6 +52,7 @@ class DAVResourceAccess rtl::Reference< DAVSessionFactory > m_xSessionFactory; css::uno::Reference< css::uno::XComponentContext > m_xContext; std::vector m_aRedirectURIs; +sal_uInt32 m_nRedirectLimit; public: DAVResourceAccess() = default; diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 876a23b7a930..5b1fbd5635e7 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3959,6 +3959,10 @@ void Content::getResourceOptions( } } break; +// The 'DAVException::DAV_HTTP_REDIRECT' means we reached the maximum +// number of redirections, consider the resource type as UNKNOWN +// possibly a normal web site, not DAV +case DAVException::DAV_HTTP_REDIRECT: default: // leave the resource type as UNKNOWN, for now // it means this will be managed as a standard http site SAL_WARN( "ucb.ucp.webdav","OPTIONS - DAVException for URL <" << m_xIdentifier->getContentIdentifier() << ">, DAV error: "
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) New commits: commit 928fbadb267be88cc558b55ddb33ec151be6e222 Author: Giuseppe Castagno AuthorDate: Thu Aug 11 14:19:03 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:42:12 2021 +0100 ucb: webdav-curl: tdf#101094 (22): Simplify cache removal: MKCOL, PUT [ port of commit 8ff5e67dea29d9ceb100a67a69f6deb4c6f18e13 ] Change-Id: If24272566bfb5fba32b9df9bd0f8e1c7fe18c585 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123475 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 212c8732b91e..876a23b7a930 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -2485,23 +2485,21 @@ void Content::insert( aURL += aEscapedTitle; -// save the URL to clean cache -OUStringaTargetUrl = aURL; try { xResAccess->setURL( aURL ); if ( bCollection ) { +aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); xResAccess->MKCOL( Environment ); -aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); } else { -xResAccess->PUT( xInputStream, Environment ); // remove options from cache, PUT may change it // it will be refreshed when needed -aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); +aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); +xResAccess->PUT( xInputStream, Environment ); } // no error , set the resourcetype to unknown type // the resource may have transitioned from NOT FOUND or UNKNOWN to something else @@ -2512,7 +2510,6 @@ void Content::insert( } catch ( DAVException const & except ) { -aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); if ( bCollection ) { if ( except.getStatus() == SC_METHOD_NOT_ALLOWED )
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 21 - 1 file changed, 4 insertions(+), 17 deletions(-) New commits: commit ccbb358db241b8b2564f3d5ac29915d3deeb Author: Giuseppe Castagno AuthorDate: Wed Aug 10 14:05:08 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:41:51 2021 +0100 ucb: webdav-curl: tdf#101094 (21): Simplify cache removal: LOCK, UNLOCK [ port of commit 508f78298833f45fd9e2e789aa26cca125719baf ] Change-Id: I81185c11ed3ad216b13fcbafee45ea3a48cf0a12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123474 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 46442074d8b2..212c8732b91e 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3116,8 +3116,6 @@ void Content::lock( aURL = m_xIdentifier->getContentIdentifier(); } -OUStringaTargetUrl = aURL; - try { std::unique_ptr< DAVResourceAccess > xResAccess; @@ -3139,12 +3137,9 @@ void Content::lock( //-1, // infinite lock uno::Sequence< OUString >() ); -// update the URL -aTargetUrl = xResAccess->getURL(); - +// OPTIONS may change as a consequence of the lock operation +aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); xResAccess->LOCK( aLock, Environment ); -// OPTIONS may have changed as a consequence of the lock operation -aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -3153,7 +3148,6 @@ void Content::lock( } catch ( DAVException const & e ) { -aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); // check if the exception thrown is 'already locked' // this exception is mapped directly to the ucb correct one, without // going into the cancelCommandExecution() user interaction @@ -3253,8 +3247,6 @@ void Content::lock( void Content::unlock( const uno::Reference< ucb::XCommandEnvironment >& Environment ) { -// save the URL to clean cache -OUStringaTargetUrl = m_xIdentifier->getContentIdentifier(); try { @@ -3264,8 +3256,6 @@ void Content::unlock( xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) ); } -// update the URL -aTargetUrl = xResAccess->getURL(); // check if the target URL is a Class1 DAV DAVOptions aDAVOptions; getResourceOptions( Environment, aDAVOptions, xResAccess ); @@ -3273,10 +3263,10 @@ void Content::unlock( // at least class one is needed if( aDAVOptions.isClass1() ) { -xResAccess->UNLOCK( Environment ); // remove options from cache, unlock may change it // it will be refreshed when needed -aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); +aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); +xResAccess->UNLOCK( Environment ); } { @@ -3316,9 +3306,6 @@ void Content::unlock( } break; default: -// remove options from cache, -// it will be refreshed when needed -aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); //fallthrough ; }
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 16 1 file changed, 12 insertions(+), 4 deletions(-) New commits: commit a10851aca6e14a00b892c78d1cc51476547acf29 Author: Giuseppe Castagno AuthorDate: Wed Aug 3 19:42:27 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:41:25 2021 +0100 ucb: webdav-curl: tdf#101094 (20) OPTIONS: Check for Class1 DAV before unlock [ port of commit d14977d33bc3edb6a2c41db4d685d099bfe8d51e ] Change-Id: I559d71f49e582af50ef88ea42beba48d38180134 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123473 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index de9cd6248a66..46442074d8b2 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3266,10 +3266,18 @@ void Content::unlock( // update the URL aTargetUrl = xResAccess->getURL(); -xResAccess->UNLOCK( Environment ); -// remove options from cache, unlock may change it -// it will be refreshed when needed -aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); +// check if the target URL is a Class1 DAV +DAVOptions aDAVOptions; +getResourceOptions( Environment, aDAVOptions, xResAccess ); + +// at least class one is needed +if( aDAVOptions.isClass1() ) +{ +xResAccess->UNLOCK( Environment ); +// remove options from cache, unlock may change it +// it will be refreshed when needed +aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); +} { osl::Guard< osl::Mutex > aGuard( m_aMutex );
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 944853b03bc5a03ee424354669addb4fa9925fbe Author: Giuseppe Castagno AuthorDate: Wed Jan 13 14:55:57 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:41:01 2021 +0100 ucb: webdav-curl: Related: tdf#96410 eXo Platform WebDAV: where lock fails... ...because apparently eXo Platform WebDAV does not support or supports poorly this section <http://tools.ietf.org/html/rfc4918#section-7.3> of RFC4918. It returns HTTP error 404 instead. [ port of commit 4475c191de479e7a5ddb20d14bc3aa32b0ab84d3 ] Change-Id: I58c91330806abbde5968ed22e98b9ff80c98c505 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123472 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 483d409cb93b..de9cd6248a66 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3199,6 +3199,10 @@ void Content::lock( //grab the error code switch( e.getStatus() ) { +// The 'case SC_NOT_FOUND' just below tries to solve a problem in eXo Platform +// WebDAV connector which apparently fail on resource first creation +// rfc4918 section-7.3 (see link below) +case SC_NOT_FOUND: // <http://tools.ietf.org/html/rfc7231#section-6.5.4> // The 'case SC_PRECONDITION_FAILED' just below tries to solve a problem // in SharePoint when locking the resource on first creation fails due to this: // <https://msdn.microsoft.com/en-us/library/jj575265%28v=office.12%29.aspx#id15> @@ -3208,7 +3212,7 @@ void Content::lock( // part of base http 1.1 RFCs case SC_NOT_IMPLEMENTED:// <http://tools.ietf.org/html/rfc7231#section-6.6.2> case SC_METHOD_NOT_ALLOWED: // <http://tools.ietf.org/html/rfc7231#section-6.5.5> -SAL_WARN( "ucb.ucp.webdav", "lock() DAVException (SC_PRECONDITION_FAILED, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" +SAL_WARN( "ucb.ucp.webdav", "lock() DAVException (SC_NOT_FOUND, SC_PRECONDITION_FAILED, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); // act as nothing happened // that's because when a resource is first created
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 32 +++ 1 file changed, 32 insertions(+) New commits: commit 567f8f716bb644494fa74b9a5030c5a047c8a189 Author: Giuseppe Castagno AuthorDate: Mon Jul 25 12:56:27 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:40:13 2021 +0100 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 Reviewed-by: Michael Stahl 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 ) ||
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 43c1de58c3115dd0495d0326975d520a333845b8 Author: Giuseppe Castagno AuthorDate: Wed Jan 27 17:41:30 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:39:51 2021 +0100 ucb: webdav-curl: tdf#101094 (17) OPTIONS: Options cache removal: COPY [ port of commit bedae6b06c51c641c38fa7dd3e25dd2aaafb30cf ] Change-Id: I1618a7a5ec4e52fdd9e99b17b2b36e5ef77decae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123469 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 6e0b57cb5b01..3f42acc56223 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -865,6 +865,8 @@ void Content::addProperty( const css::ucb::PropertyCommandArgument , osl::Guard< osl::Mutex > aGuard( m_aMutex ); m_xResAccess.reset( new DAVResourceAccess( *xResAccess ) ); } +// TODO PLACEHOLDER: +// remove target URL options from cache, since PROPPATCH may change them // Notify propertyset info change listeners. beans::PropertySetInfoChangeEvent evt( @@ -1885,6 +1887,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues( { // Set property values at server. xResAccess->PROPPATCH( aProppatchValues, xEnv ); +// TODO PLACEHOLDER: +// remove target URL options from cache, since PROPPATCH may change it for ( const auto& rProppatchValue : aProppatchValues ) { @@ -2757,6 +2761,8 @@ void Content::transfer( rArgs.NameClash == ucb::NameClash::OVERWRITE, Environment ); +aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); +aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); // DAV resources store all additional props on server! // // Copy own and all children's Additional Core Properties.
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) New commits: commit dbe4b01ca7d0069f45d655c04ca595b42b71c631 Author: Giuseppe Castagno AuthorDate: Wed Jan 27 17:35:36 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:39:26 2021 +0100 ucb: webdav-curl: tdf#101094 (16) OPTIONS: Options cache removal: MOVE [ port of commit 2359e5a002f4df58548803320991064e6a6d968c ] Change-Id: I27a68855198fe220a1f4141bb89673992c12e1f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123468 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index d9f925b2151d..6e0b57cb5b01 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -1936,14 +1936,18 @@ uno::Sequence< uno::Any > Content::setPropertyValues( = new ::ucbhelper::ContentIdentifier( aNewURL ); uno::Reference< ucb::XContentIdentifier > xOldId = xIdentifier; +CurlUri const sourceURI( xOldId->getContentIdentifier() ); +CurlUri targetURI( xNewId->getContentIdentifier() ); + try { -CurlUri const sourceURI( xOldId->getContentIdentifier() ); -CurlUri targetURI( xNewId->getContentIdentifier() ); targetURI.SetScheme( sourceURI.GetScheme() ); xResAccess->MOVE( sourceURI.GetPath(), targetURI.GetURI(), false, xEnv ); +aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); +aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); + // @@@ Should check for resources that could not be moved // (due to source access or target overwrite) and send // this information through the interaction handler. @@ -1977,6 +1981,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues( } catch ( DAVException const & e ) { +aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); +aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); // Do not set new title! aNewTitle.clear(); @@ -2592,11 +2598,12 @@ void Content::transfer( xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) ); } +CurlUri sourceURI( rArgs.SourceURL ); +CurlUri targetURI( xIdentifier->getContentIdentifier() ); + OUString aTargetURI; try { -CurlUri sourceURI( rArgs.SourceURL ); -CurlUri targetURI( xIdentifier->getContentIdentifier() ); aTargetURI = targetURI.GetPathBaseNameUnescaped(); // Check source's and target's URL scheme @@ -2721,6 +2728,8 @@ void Content::transfer( rArgs.NameClash == ucb::NameClash::OVERWRITE, Environment ); +aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); +aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); if ( xSource.is() ) { @@ -2767,10 +2776,14 @@ void Content::transfer( } catch ( ucb::IllegalIdentifierException const & ) { +aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); +aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); // queryContent } catch ( DAVException const & e ) { +aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); +aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); // [RFC 2518] - WebDAV // 412 (Precondition Failed) - The server was unable to maintain // the liveness of the properties listed in the propertybehavior
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 8c4302a503053251b6360c128a1dcd556f09c5df Author: Giuseppe Castagno AuthorDate: Wed Jan 27 17:04:56 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:38:58 2021 +0100 ucb: webdav-curl: tdf#101094 (15) OPTIONS: Options cache removal: MKCOL [ port of commit 1596379bc00a32bc3b4e76a53aa884112b21764b ] Change-Id: If217fde550ef55375e4743de00dcb325a89674c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123467 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index cc7578a2ca49..d9f925b2151d 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -2441,7 +2441,10 @@ void Content::insert( xResAccess->setURL( aURL ); if ( bCollection ) +{ xResAccess->MKCOL( Environment ); +aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); +} else { xResAccess->PUT( xInputStream, Environment );
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 12 1 file changed, 12 insertions(+) New commits: commit c155b4137678455294db605e0332b097ef51dc1a Author: Giuseppe Castagno AuthorDate: Mon Jan 11 11:11:19 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:38:36 2021 +0100 ucb: webdav-curl: tdf#101094 (14) OPTIONS: Options cache removal: PUT [ port of commit e0eb85785b68867f1476553723dbfc6dc407106b ] Change-Id: I2c4109b44ba291fdc01289b2706f746512d7e3e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123466 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index fdec5e34b4bc..cc7578a2ca49 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -2434,6 +2434,8 @@ void Content::insert( aURL += aEscapedTitle; +// save the URL to clean cache +OUStringaTargetUrl = aURL; try { xResAccess->setURL( aURL ); @@ -2443,6 +2445,9 @@ void Content::insert( else { xResAccess->PUT( xInputStream, Environment ); +// remove options from cache, PUT may change it +// it will be refreshed when needed +aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); } // no error , set the resourcetype to unknown type // the resource may have transitioned from NOT FOUND or UNKNOWN to something else @@ -2453,6 +2458,7 @@ void Content::insert( } catch ( DAVException const & except ) { +aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); if ( bCollection ) { if ( except.getStatus() == SC_METHOD_NOT_ALLOWED ) @@ -2541,12 +2547,18 @@ void Content::insert( // Unreachable } +// save the URL since it may change due to redirection +OUStringaTargetUrl = xResAccess->getURL(); try { xResAccess->PUT( xInputStream, Environment ); +// remove options from cache, PUT may change it +// it will be refreshed when needed +aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); } catch ( DAVException const & e ) { +aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); cancelCommandExecution( e, Environment, true ); // Unreachable }
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVTypes.cxx |3 +++ ucb/source/ucp/webdav-curl/DAVTypes.hxx |7 +++ ucb/source/ucp/webdav-curl/webdavcontent.cxx | 26 +- 3 files changed, 35 insertions(+), 1 deletion(-) New commits: commit 51579e00fef7baf5e248b1e9a2bf0e9fa8ef1a60 Author: Giuseppe Castagno AuthorDate: Sun Jul 24 12:12:35 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:37:30 2021 +0100 ucb: webdav-curl: tdf#101094 (13) OPTIONS: Options cache removal: LOCK, UNLOCK [ port of commit dfb714183f31d8a235797ef1ad3c517966ed4985 ] Change-Id: I1cf4689847f4f033d6f8cc40265b98b9614363e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123464 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx b/ucb/source/ucp/webdav-curl/DAVTypes.cxx index bddbe50829b0..839b9e845846 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx @@ -26,6 +26,7 @@ DAVOptions::DAVOptions() : m_isClass1( false ), m_isClass2( false ), m_isClass3( false ), +m_isLocked( false ), m_aAllowedMethods(), m_nStaleTime( 0 ), m_sURL(), @@ -39,6 +40,7 @@ DAVOptions::DAVOptions( const DAVOptions & rOther ) : m_isClass1( rOther.m_isClass1 ), m_isClass2( rOther.m_isClass2 ), m_isClass3( rOther.m_isClass3 ), +m_isLocked( rOther.m_isLocked ), m_aAllowedMethods( rOther.m_aAllowedMethods ), m_nStaleTime( rOther.m_nStaleTime ), m_sURL( rOther.m_sURL ), @@ -59,6 +61,7 @@ bool DAVOptions::operator==( const DAVOptions& rOpts ) const m_isClass1 == rOpts.m_isClass1 && m_isClass2 == rOpts.m_isClass2 && m_isClass3 == rOpts.m_isClass3 && +m_isLocked == rOpts.m_isLocked && m_aAllowedMethods == rOpts.m_aAllowedMethods && m_nStaleTime == rOpts.m_nStaleTime && m_sURL == rOpts.m_sURL && diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx b/ucb/source/ucp/webdav-curl/DAVTypes.hxx index a4180c6dffc7..d5453295c733 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx @@ -71,6 +71,9 @@ namespace http_dav_ucp boolm_isClass1; boolm_isClass2; boolm_isClass3; +// Internally used to maintain locked stated of the resource, only +// if it's a Class 2 resource +boolm_isLocked; // contains the methods allowed on this resource OUStringm_aAllowedMethods; @@ -112,11 +115,15 @@ namespace http_dav_ucp bool isLockAllowed() { return ( m_aAllowedMethods.indexOf( "LOCK" ) != -1 ); }; bool isUnlockAllowed() { return ( m_aAllowedMethods.indexOf( "UNLOCK" ) != -1 ); }; +void setLocked( bool locked = true ) { m_isLocked = locked; } ; +bool isLocked() { return m_isLocked; }; + void reset() { m_isResourceFound = false; m_isClass1 = false; m_isClass2 = false; m_isClass3 = false; +m_isLocked = false; m_aAllowedMethods.clear(); m_nStaleTime = 0; m_sURL.clear(); diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index ba220778c973..fdec5e34b4bc 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3041,6 +3041,8 @@ void Content::lock( aURL = m_xIdentifier->getContentIdentifier(); } +OUStringaTargetUrl = aURL; + try { std::unique_ptr< DAVResourceAccess > xResAccess; @@ -3062,7 +3064,12 @@ void Content::lock( //-1, // infinite lock uno::Sequence< OUString >() ); +// update the URL +aTargetUrl = xResAccess->getURL(); + xResAccess->LOCK( aLock, Environment ); +// OPTIONS may have changed as a consequence of the lock operation +aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -3071,6 +3078,7 @@ void Content::lock( } catch ( DAVException const & e ) { +aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl ); // check if the exception thrown is 'already locked' // this exception is mapped directly to the ucb correct one, without // going into the cancelCommandExecution() user interaction @@ -3166,6 +3174,9 @@ void Content::lock( void Content::unlock( const uno::Reference< ucb::XCommandEnvironment >& Environment ) { +// save the URL to clean cache +OUStringaTargetUrl = m_xIdentifier->getContentIdentifier(); + try { std::unique_ptr< DAVResourceAccess > xResAccess; @@ -3174,7 +3185,12 @@
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 173 +-- 1 file changed, 110 insertions(+), 63 deletions(-) New commits: commit 1f783d3e5e734dbdef2ec39f1ff1370dad4f332b Author: Giuseppe Castagno AuthorDate: Sun Jan 10 17:43:12 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:37:08 2021 +0100 ucb: webdav-curl: tdf#101094 (12) OPTIONS: Add options cache ctrl in getResourceOptions [ port of commit 37ada6f457e19b6ee2d2adb0b0ab3acb20705b51 ] Change-Id: I3cfd71c0c90b828de7d953d5ff3f0e445b3f156f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123463 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index d41ce66a266f..ba220778c973 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3739,78 +3739,125 @@ void Content::getResourceOptions( DAVOptions& rDAVOptions, const std::unique_ptr< DAVResourceAccess > & rResAccess ) { -try -{ -rResAccess->OPTIONS( rDAVOptions, xEnv ); -// IMPORTANT:the correctly implemented server will answer without errors, even if the resource is not present -} -catch ( DAVException const & e ) +OUString aRedirURL; +OUString aTargetURL = rResAccess->getURL(); +// first check if in cache, if not, then send method to server +if ( !aStaticDAVOptionsCache.getDAVOptions( aTargetURL, rDAVOptions ) ) { -rResAccess->resetUri(); - -switch( e.getError() ) +try { -case DAVException::DAV_HTTP_TIMEOUT: -case DAVException::DAV_HTTP_CONNECT: -{ -// something bad happened to the connection -// not same as not found, this instead happens when the server does'n exist or does'n aswer at all -// probably a new bit stating 'timed out' should be added to opts var? -// in any case abort the command -cancelCommandExecution( e, xEnv ); -// unreachable -} -break; -case DAVException::DAV_HTTP_AUTH: -{ -SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException Authentication error for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); -// - the remote site is a WebDAV with special configuration: read/only for read operations -// and read/write for write operations, the user is not allowed to lock/write and -// she cancelled the credentials request. -// this is not actually an error, it means only that for current user this is a standard web, -// though possibly DAV enabled +rResAccess->OPTIONS( rDAVOptions, xEnv ); +// IMPORTANT:the correctly implemented server will answer without errors, even if the resource is not present +sal_uInt32 nLifeTime = ( rDAVOptions.isClass1() || + rDAVOptions.isClass2() || + rDAVOptions.isClass3() ) ? +m_nOptsCacheLifeDAV : // a WebDAV site +m_nOptsCacheLifeImplWeb; // a site implementing OPTIONS but + // it's not DAV +// check if redirected +aRedirURL = rResAccess->getURL(); +if( aRedirURL == aTargetURL) +{ // no redirection +aRedirURL.clear(); } -break; -case DAVException::DAV_HTTP_ERROR: +// cache this URL's option +rDAVOptions.setURL( aTargetURL ); +rDAVOptions.setRedirectedURL( aRedirURL ); +aStaticDAVOptionsCache.addDAVOptions( rDAVOptions, + nLifeTime ); +} +catch ( DAVException const & e ) +{ +// first, remove from cache, will be added if needed, depending on the error received +aStaticDAVOptionsCache.removeDAVOptions( aTargetURL ); +rResAccess->resetUri(); + +rDAVOptions.setURL( aTargetURL ); +rDAVOptions.setRedirectedURL( aRedirURL ); +switch( e.getError() ) { -switch( e.getStatus() ) +case DAVException::DAV_HTTP_TIMEOUT: +case DAVException::DAV_HTTP_CONNECT: { -case SC_FORBIDDEN: -{ -SAL_WARN( "ucb.ucp.webdav","OPTIONS - Forbidden for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); -rDAVOptions.setReso
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 37 +++ ucb/source/ucp/webdav-curl/webdavcontent.hxx | 17 2 files changed, 54 insertions(+) New commits: commit 7f5f568b9c31df2391dabd4abb5711a109e5480a Author: Giuseppe Castagno AuthorDate: Sun Jan 10 17:32:53 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:36:38 2021 +0100 ucb: webdav-curl: tdf#101094 (11): Add WebDAV options cache configuration param. Added in officecfg five new properties to be able to set cache lifetime if needed. The new properties are available in advanced, expert configuration only, in org.openoffice.Inet.Settings. Default values are as follows (value is in seconds): OptsCacheLifeImplWeb = 300 when the web resource is Web only, implementing OPTIONS. Min. 0 sec (no caching) max. 3600 sec (1h). OptsCacheLifeDAV = 60 when the web resource is WebDAV. Min. 0 sec (no caching) max. 3600 sec (1h). OptsCacheLifeDAVLocked = 600 when the web resource is WebDAV and it's locked by this LO instance (e.g. lock store has a lock to it). Min. 0 sec (no caching) max. 3600 sec (1h). OptsCacheLifeNotImpl = 3600 when the web resource does not implement OPTIONS method. Min. 0 sec (no caching) max. 43200 sec (12h). OptsCacheLifeNotFound = 15 when the requested web resource is not found on server. Min. 0 sec (no caching) max. 30 sec. [ port of commit 2c0b4ff238f39b5fcce09c7d36e80ac1e7cb713e ] Change-Id: I5a4c9c91b7d3a8840bfaf8326e35f86415dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123462 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 706f3a0fb25a..d41ce66a266f 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -185,6 +186,12 @@ void lcl_sendPartialGETRequest( bool , } } +// Static value, to manage a simple OPTIONS cache +// Key is the URL, element is the DAVOptions resulting from an OPTIONS call. +// Cached DAVOptions have a lifetime that depends on the errors received or not received +// and on the value of received options. +static DAVOptionsCache aStaticDAVOptionsCache; + // Content Implementation. @@ -206,6 +213,7 @@ Content::Content( { try { +initOptsCacheLifeTime(); m_xResAccess.reset( new DAVResourceAccess( rxContext, rSessionFactory, @@ -238,6 +246,7 @@ Content::Content( { try { +initOptsCacheLifeTime(); m_xResAccess.reset( new DAVResourceAccess( rxContext, rSessionFactory, Identifier->getContentIdentifier() ) ); } @@ -3697,6 +3706,34 @@ Content::ResourceType Content::getResourceType( } +void Content::initOptsCacheLifeTime() +{ +// see description in +// officecfg/registry/schema/org/openoffice/Inet.xcs +// for use of these field values. +sal_uInt32 nAtime; +nAtime = officecfg::Inet::Settings::OptsCacheLifeImplWeb::get( m_xContext ); +m_nOptsCacheLifeImplWeb = std::max( sal_uInt32( 0 ), +std::min( nAtime, sal_uInt32( 3600 ) ) ); + +nAtime = officecfg::Inet::Settings::OptsCacheLifeDAV::get( m_xContext ); +m_nOptsCacheLifeDAV = std::max( sal_uInt32( 0 ), +std::min( nAtime, sal_uInt32( 3600 ) ) ); + +nAtime = officecfg::Inet::Settings::OptsCacheLifeDAVLocked::get( m_xContext ); +m_nOptsCacheLifeDAVLocked = std::max( sal_uInt32( 0 ), +std::min( nAtime, sal_uInt32( 3600 ) ) ); + +nAtime = officecfg::Inet::Settings::OptsCacheLifeNotImpl::get( m_xContext ); +m_nOptsCacheLifeNotImpl = std::max( sal_uInt32( 0 ), + std::min( nAtime, sal_uInt32( 43200 ) ) ); + +nAtime = officecfg::Inet::Settings::OptsCacheLifeNotFound::get( m_xContext ); +m_nOptsCacheLifeNotFound = std::max( sal_uInt32( 0 ), + std::min( nAtime, sal_uInt32( 30 ) ) ); +} + + void Content::getResourceOptions( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv, DAVOptions& rDAVOptions, diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.hxx b/ucb/source/ucp/webdav-curl/webdavcontent.hxx index 209f43516a3c..7c1f45661822 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.hxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.hxx @@ -86,6 +86,23 @@ class Content : public ::ucbhelper::ContentImplHelper, bool m_bColl
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVTypes.cxx | 81 +++- ucb/source/ucp/webdav-curl/DAVTypes.hxx | 25 + 2 files changed, 105 insertions(+), 1 deletion(-) New commits: commit e329cda88021fe7c540a6050a654aee7491d0975 Author: Giuseppe Castagno AuthorDate: Sun Jan 10 10:05:02 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:36:19 2021 +0100 ucb: webdav-curl: tdf#101094 (10) OPTIONS: Add a simple options cache class Added behavioral unit tests as well. [ port of commit b641d83bb9f8adba1a487ca0e04d7151f96c3eea ] Change-Id: Ie8867aeb45dcc8d343b156608e8a30970f76f6f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123292 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx b/ucb/source/ucp/webdav-curl/DAVTypes.cxx index b71f61a1a3d3..bddbe50829b0 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx @@ -10,6 +10,7 @@ #include "DAVTypes.hxx" +#include "CurlUri.hxx" #include "../inc/urihelper.hxx" #include @@ -18,7 +19,7 @@ using namespace http_dav_ucp; using namespace com::sun::star; -// DAVCapabilities implementation +// DAVOptions implementation DAVOptions::DAVOptions() : m_isResourceFound( false ), @@ -65,4 +66,82 @@ bool DAVOptions::operator==( const DAVOptions& rOpts ) const } +// DAVOptionsCache implementation + +DAVOptionsCache::DAVOptionsCache() +{ +} + + +DAVOptionsCache::~DAVOptionsCache() +{ +} + + +bool DAVOptionsCache::getDAVOptions( const OUString & rURL, DAVOptions & rDAVOptions ) +{ +osl::MutexGuard aGuard( m_aMutex ); +OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(rURL) ) ); +normalizeURLLastChar( aEncodedUrl ); + +// search the URL in the static map +DAVOptionsMap::iterator it; +it = m_aTheCache.find( aEncodedUrl ); +if ( it == m_aTheCache.end() ) +return false; +else +{ +// check if the capabilities are stale, before restoring +TimeValue t1; +osl_getSystemTime( ); +if ( (*it).second.getStaleTime() < t1.Seconds ) +{ +// if stale, remove from cache, do not restore +removeDAVOptions( rURL ); +return false; +// return false instead +} +rDAVOptions = (*it).second; +return true; +} +} + + +void DAVOptionsCache::removeDAVOptions( const OUString & rURL ) +{ +osl::MutexGuard aGuard( m_aMutex ); +OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(rURL) ) ); +normalizeURLLastChar( aEncodedUrl ); + +DAVOptionsMap::iterator it; +it = m_aTheCache.find( aEncodedUrl ); +if ( it != m_aTheCache.end() ) +{ +m_aTheCache.erase( it ); +} +} + + +void DAVOptionsCache::addDAVOptions( DAVOptions & rDAVOptions, const sal_uInt32 nLifeTime ) +{ +osl::MutexGuard aGuard( m_aMutex ); + +OUString aURL( rDAVOptions.getURL() ); + +OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(aURL) ) ); +normalizeURLLastChar( aEncodedUrl ); +rDAVOptions.setURL( aEncodedUrl ); + +// unchanged, it may be used to access a server +OUString aRedirURL( rDAVOptions.getRedirectedURL() ); +rDAVOptions.setRedirectedURL( aRedirURL ); + +TimeValue t1; +osl_getSystemTime( ); +rDAVOptions.setStaleTime( t1.Seconds + nLifeTime ); + +m_aTheCache[ aEncodedUrl ] = rDAVOptions; +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx b/ucb/source/ucp/webdav-curl/DAVTypes.hxx index e1d53909b4b9..a4180c6dffc7 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx @@ -123,10 +123,35 @@ namespace http_dav_ucp m_sRedirectedURL.clear(); }; +DAVOptions & operator=( const DAVOptions& rOpts ) = default; //TODO -Werror=deprecated-copy bool operator==( const DAVOptions& rOpts ) const; }; +typedef std::map< OUString, DAVOptions > DAVOptionsMap; + +class DAVOptionsCache +{ +DAVOptionsMap m_aTheCache; +osl::Mutex m_aMutex; +public: +explicit DAVOptionsCache(); +~DAVOptionsCache(); + +bool getDAVOptions( const OUString & rURL, DAVOptions & rDAVOptions ); +void removeDAVOptions( const OUString & rURL ); +void addDAVOptions( DAVOptions & rDAVOptions, const sal_uInt32 nLifeTime ); + +private: + +/// remove the last '/' in aUrl, if it exists +static void normalizeURLLastChar( OUString& aUrl ) { +if ( aUrl.getLength() > 1 && + ( ( aUrl.lastIndexOf( '/' ) + 1 ) == aUrl.getLength() ) ) +aUrl = aUrl.copy(0, aUrl.getLength() -
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx | 26 ++- 1 file changed, 16 insertions(+), 10 deletions(-) New commits: commit 78992a2b63cdfbc278a104973c22b1e707ecfd12 Author: Giuseppe Castagno AuthorDate: Mon Jan 11 16:35:34 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:35:58 2021 +0100 ucb: webdav-curl: tdf#101094 (9) OPTIONS: Add options check in Content::getProperties [ port of commit be47f60b51c053c6329637e829ce16e2e90610fe ] Change-Id: I8fd0dbc1f9847e799c244821bfe4e628c39c2017 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123291 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx b/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx index d89f9431b6d4..e45156c35a0d 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx @@ -286,18 +286,24 @@ uno::Sequence< beans::Property > Content::getProperties( if ( !bTransient ) { // Obtain all properties supported for this resource from server. -try +DAVOptions aDAVOptions; +getResourceOptions( xEnv, aDAVOptions, xResAccess ); +// only Class 1 is needed for PROPFIND +if ( aDAVOptions.isClass1() ) { -std::vector< DAVResourceInfo > props; -xResAccess->PROPFIND( DAVZERO, props, xEnv ); +try +{ +std::vector< DAVResourceInfo > props; +xResAccess->PROPFIND( DAVZERO, props, xEnv ); -// Note: vector always contains exactly one resource info, because -// we used a depth of DAVZERO for PROPFIND. -aPropSet.insert( (*props.begin()).properties.begin(), - (*props.begin()).properties.end() ); -} -catch ( DAVException const & ) -{ +// Note: vector always contains exactly one resource info, because +// we used a depth of DAVZERO for PROPFIND. +aPropSet.insert( (*props.begin()).properties.begin(), + (*props.begin()).properties.end() ); +} +catch ( DAVException const & ) +{ +} } }
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 8ce2732f0a867807a9d0e70ec0966e7779d13412 Author: Giuseppe Castagno AuthorDate: Thu Jan 14 18:11:28 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:35:04 2021 +0100 ucb: webdav-curl: tdf#101094 (7) OPTIONS: Remove resourceTypeForLocks before unlock Not needed, unlock() checks if a lock is present first. If present, it means that LOCK is available, inferring the presence of UNLOCK availability. [ port of commit fd586445a47d50ebfff67a7d5e4a329cf064cb92 ] Change-Id: I639c558c6e6f322f37d267bbc31309504745e02c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123289 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index b499327878d1..96ac6dde122a 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -658,8 +658,9 @@ uno::Any SAL_CALL Content::execute( { // unlock -if ( resourceTypeForLocks( Environment ) == DAV ) -unlock( Environment ); +// do not check for a DAV resource +// the lock store will be checked before sending +unlock( Environment ); } else if ( aCommand.Name == "createNewContent" && isFolder( Environment ) )
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx |4 1 file changed, 4 insertions(+) New commits: commit 9eb6733c8fa9d69d3f2314fc1a3f510c324bd663 Author: Giuseppe Castagno AuthorDate: Sat Jul 23 12:55:20 2016 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:34:43 2021 +0100 ucb: webdav-curl: tdf#101094 (6) OPTIONS: Do not retry on HTTP error 501 HTTP error 501 the server tells us the used method is not implemented, non need to retry. [ port of commit 6dcd231892d80d2f130d1b9ebb9cf7dfa1115df1 ] Change-Id: I5325f6527c7bb5c8f87d4301fd13eb6c71a318f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123288 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx index 8787250c98f6..c81d326207d1 100644 --- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx @@ -1139,8 +1139,12 @@ bool DAVResourceAccess::handleException(DAVException const& e, int const errorCo // if we have a bad connection try again. Up to three times. case DAVException::DAV_HTTP_ERROR: // retry up to three times, if not a client-side error. +// exception: error 501, server side error that +// tells us the used method is not implemented +// on the server, it's nonsense to insist... if ( ( e.getStatus() < 400 || e.getStatus() >= 500 || e.getStatus() == 413 ) && + ( e.getStatus() != 501 ) && errorCount < 3 ) { return true;
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 170 --- 1 file changed, 127 insertions(+), 43 deletions(-) New commits: commit 70f197cc6728482b0a42f4b1e90c55879346fdfb Author: Giuseppe Castagno AuthorDate: Sun Jan 10 15:16:13 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:34:19 2021 +0100 ucb: webdav-curl: tdf#101094 (5) OPTIONS: Add options check in Content::getResourceType Added some verbose SAL_INFO to detail server responses to PROPFIND. Corrected a wrong comment and beautified a bit code I introduced in commit 3b26a2a403ca5e99b0dd07d042d47501c091af16. [ port of commit 211cb2dec3501a9ea224512ebedbc7cd1c46cd45 ] Change-Id: I7917408dcc09e42cb23d29b28e02904594023dd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123287 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 3ffde115c8ed..b499327878d1 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -1353,6 +1353,36 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( 1 == resources.size() ) { +#if defined SAL_LOG_INFO +{//debug +// print received resources +std::vector< DAVPropertyValue >::const_iterator it = resources[0].properties.begin(); +std::vector< DAVPropertyValue >::const_iterator end = resources[0].properties.end(); +while ( it != end ) +{ +OUString aPropValue; +boolbValue; +uno::Sequence< ucb::LockEntry > aSupportedLocks; +if( (*it).Value >>= aPropValue ) +SAL_INFO( "ucb.ucp.webdav", "PROPFIND (getPropertyValues) - returned property: " << (*it).Name << ":" << aPropValue ); +else if( (*it).Value >>= bValue ) +SAL_INFO( "ucb.ucp.webdav", "PROPFIND (getPropertyValues) - returned property: " << (*it).Name << ":" << + ( bValue ? "true" : "false" ) ); +else if( (*it).Value >>= aSupportedLocks ) +{ +SAL_INFO( "ucb.ucp.webdav", "PROPFIND (getPropertyValues) - returned property: " << (*it).Name << ":" ); +for ( sal_Int32 n = 0; n < aSupportedLocks.getLength(); ++n ) +{ +SAL_INFO( "ucb.ucp.webdav"," scope: " + << (aSupportedLocks[n].Scope == ucb::LockScope_SHARED ? "shared" : "exclusive") + << ", type: " + << (aSupportedLocks[n].Type != ucb::LockType_WRITE ? "" : "write") ); +} +} +++it; +} +} +#endif if (xProps) xProps->addProperties( aPropNames, @@ -3473,65 +3503,119 @@ Content::ResourceType Content::getResourceType( } ResourceType eResourceType = UNKNOWN; +DAVOptions aDAVOptions; { -try +getResourceOptions( xEnv, aDAVOptions, rResAccess ); + +// at least class one is needed +if( aDAVOptions.isClass1() ) { -// Try to fetch some frequently used property value, e.g. those -// used when loading documents... along with identifying whether -// this is a DAV resource. -std::vector< DAVResource > resources; -std::vector< OUString > aPropNames; -uno::Sequence< beans::Property > aProperties( 5 ); -aProperties[ 0 ].Name = "IsFolder"; -aProperties[ 1 ].Name = "IsDocument"; -aProperties[ 2 ].Name = "IsReadOnly"; -aProperties[ 3 ].Name = "MediaType"; -aProperties[ 4 ].Name = DAVProperties::SUPPORTEDLOCK; +try
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 99 +++ ucb/source/ucp/webdav-curl/webdavcontent.hxx | 13 +++ 2 files changed, 112 insertions(+) New commits: commit 2b0c3c6c83f630f0bde1866b368dced7489a2d2f Author: Giuseppe Castagno AuthorDate: Sun Jan 10 10:42:47 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:32:45 2021 +0100 ucb: webdav-curl: tdf#101094 (4) OPTIONS: Add member function getResourceOptions [ port of commit 2777b6380c17bad8a966454947b9d991f9592224 ] Change-Id: I8c54b564a8c92dcd395e104976f7a7071b5264eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123285 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index ec16224b1066..a90f1970f513 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3565,4 +3565,103 @@ Content::ResourceType Content::getResourceType( return ret; } + +void Content::getResourceOptions( +const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv, +DAVOptions& rDAVOptions, +const std::unique_ptr< DAVResourceAccess > & rResAccess ) +{ +try +{ +rResAccess->OPTIONS( rDAVOptions, xEnv ); +// IMPORTANT:the correctly implemented server will answer without errors, even if the resource is not present +} +catch ( DAVException const & e ) +{ +rResAccess->resetUri(); + +switch( e.getError() ) +{ +case DAVException::DAV_HTTP_TIMEOUT: +case DAVException::DAV_HTTP_CONNECT: +{ +// something bad happened to the connection +// not same as not found, this instead happens when the server does'n exist or does'n aswer at all +// probably a new bit stating 'timed out' should be added to opts var? +// in any case abort the command +cancelCommandExecution( e, xEnv ); +// unreachable +} +break; +case DAVException::DAV_HTTP_AUTH: +{ +SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException Authentication error for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +// - the remote site is a WebDAV with special configuration: read/only for read operations +// and read/write for write operations, the user is not allowed to lock/write and +// she cancelled the credentials request. +// this is not actually an error, it means only that for current user this is a standard web, +// though possibly DAV enabled +} +break; +case DAVException::DAV_HTTP_ERROR: +{ +switch( e.getStatus() ) +{ +case SC_FORBIDDEN: +{ +SAL_WARN( "ucb.ucp.webdav","OPTIONS - Forbidden for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +rDAVOptions.setResourceFound(); // means it exists, but it's not DAV +} +break; +case SC_BAD_REQUEST: +{ +SAL_WARN( "ucb.ucp.webdav","OPTIONS - Bad request for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +rDAVOptions.setResourceFound(); // means it exists, but it's not DAV +} +break; +case SC_NOT_IMPLEMENTED: +case SC_METHOD_NOT_ALLOWED: +{ +// OPTIONS method must be implemented in DAV +// resource is NON_DAV, or not advertising it +SAL_WARN( "ucb.ucp.webdav","OPTIONS - Method not implemented or not allowed for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +rDAVOptions.setResourceFound(); // means it exists, but it's not DAV +} +break; +case SC_NOT_FOUND: +{ +SAL_WARN( "ucb.ucp.webdav", "OPTIONS - Resource not found for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +} +break; +default: +break; +} +} +break; +default: // leave the resource type as UNKNOWN, for
[Libreoffice-commits] core.git: solenv/clang-format ucb/Library_ucpdav1.mk ucb/source
solenv/clang-format/excludelist |1 ucb/Library_ucpdav1.mk |1 ucb/source/ucp/webdav-curl/DAVTypes.cxx | 68 + ucb/source/ucp/webdav-curl/DAVTypes.hxx | 124 4 files changed, 182 insertions(+), 12 deletions(-) New commits: commit f472792a3ec03797b55e83d2de759caba3e57f79 Author: Giuseppe Castagno AuthorDate: Sat Jan 9 17:32:26 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:31:35 2021 +0100 ucb: webdav-curl: tdf#101094 (1) OPTIONS: New class to store retrieved OPTIONS This class describes the DAV options useful to LO. Added behavioural unit tests as well. [ port of commit f950b49393ee6539f2a7b3c306aa4fc119f24a84 ] Change-Id: Idfcd66229a2bbbdf4452da731a5b921527447358 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123282 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index a70248a605ea..af38ed914cb2 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -14001,6 +14001,7 @@ ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx ucb/source/ucp/webdav-curl/DAVSession.hxx ucb/source/ucp/webdav-curl/DAVSessionFactory.cxx +ucb/source/ucp/webdav-curl/DAVTypes.cxx ucb/source/ucp/webdav-curl/DAVTypes.hxx ucb/source/ucp/webdav-curl/DateTimeHelper.cxx ucb/source/ucp/webdav-curl/DateTimeHelper.hxx diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk index bedea713b179..ee1c944b1fbd 100644 --- a/ucb/Library_ucpdav1.mk +++ b/ucb/Library_ucpdav1.mk @@ -46,6 +46,7 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\ ucb/source/ucp/webdav-curl/DAVProperties \ ucb/source/ucp/webdav-curl/DAVResourceAccess \ ucb/source/ucp/webdav-curl/DAVSessionFactory \ + ucb/source/ucp/webdav-curl/DAVTypes \ ucb/source/ucp/webdav-curl/DateTimeHelper \ ucb/source/ucp/webdav-curl/SerfLockStore \ ucb/source/ucp/webdav-curl/UCBDeadPropertyValue \ diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx b/ucb/source/ucp/webdav-curl/DAVTypes.cxx new file mode 100644 index ..b71f61a1a3d3 --- /dev/null +++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +#include "DAVTypes.hxx" + +#include "../inc/urihelper.hxx" + +#include + + +using namespace http_dav_ucp; +using namespace com::sun::star; + +// DAVCapabilities implementation + +DAVOptions::DAVOptions() : +m_isResourceFound( false ), +m_isClass1( false ), +m_isClass2( false ), +m_isClass3( false ), +m_aAllowedMethods(), +m_nStaleTime( 0 ), +m_sURL(), +m_sRedirectedURL() +{ +} + + +DAVOptions::DAVOptions( const DAVOptions & rOther ) : +m_isResourceFound( rOther.m_isResourceFound ), +m_isClass1( rOther.m_isClass1 ), +m_isClass2( rOther.m_isClass2 ), +m_isClass3( rOther.m_isClass3 ), +m_aAllowedMethods( rOther.m_aAllowedMethods ), +m_nStaleTime( rOther.m_nStaleTime ), +m_sURL( rOther.m_sURL ), +m_sRedirectedURL( rOther.m_sRedirectedURL) +{ +} + + +DAVOptions::~DAVOptions() +{ +} + + +bool DAVOptions::operator==( const DAVOptions& rOpts ) const +{ +return +m_isResourceFound == rOpts.m_isResourceFound && +m_isClass1 == rOpts.m_isClass1 && +m_isClass2 == rOpts.m_isClass2 && +m_isClass3 == rOpts.m_isClass3 && +m_aAllowedMethods == rOpts.m_aAllowedMethods && +m_nStaleTime == rOpts.m_nStaleTime && +m_sURL == rOpts.m_sURL && +m_sRedirectedURL == rOpts.m_sRedirectedURL; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx b/ucb/source/ucp/webdav-curl/DAVTypes.hxx index 3928d42e921e..e1d53909b4b9 100644 --- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx +++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx @@ -20,28 +20,128 @@ #pragma once +#include +#include +#include +#include +#include #include #include namespace http_dav_ucp { +/* Excerpt from RFC 4918 + <https://tools.ietf.org/html/rfc4918#section-18> -enum Depth { DAVZERO = 0, DAVONE = 1, DAVINFINITY = -1 }; + 18.1 Class 1 -enum ProppatchOperation { PROPSET = 0, PROPREMOVE = 1 }; + A class 1 compliant resource MUST meet all "MUST" requirements in all + sections of this document. -struct ProppatchValue -{ -ProppatchOperation operation; -
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) New commits: commit e1bb4425e442eacdc1ca3518d62116e739ba7eb0 Author: Giuseppe Castagno AuthorDate: Mon Feb 1 16:02:16 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:30:33 2021 +0100 ucb: webdav-curl: In case of Web site access, add Content-Type to HEAD request. This remove a necessity for another HEAD request when MediaType is requested while accessing a Web site, a cleaner implementation of d61352f58a7f750d3b0b0a9c2d6498fbb7a6e10d. This behavior is active only on a standard Web site, when PROPFIND failed earlier on the program flow, without retrieving the property DAV:getcontenttype. [ port of commit 9325c18044a8adc852e2d1b42a5a479ab6195da8 ] Change-Id: Iebdae815d096be8ef45b969d7c4d84acc26694b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123280 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 8bb0e5e82b15..ec16224b1066 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -1379,9 +1379,6 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( bNetworkAccessAllowed ) { -if( eType != DAV ) -m_bDidGetOrHead = false; - // All properties obtained already? std::vector< OUString > aMissingProps; if ( !( xProps @@ -1397,6 +1394,14 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( rProperties, aHeaderNames ); +if( eType != DAV ) +{ +// in case of not DAV PROFIND (previously in program flow) failed +// so we need to add the only prop that's common +// to DAV and NON_DAV: MediaType, that maps to Content-Type +aHeaderNames.push_back( "Content-Type" ); +} + if ( !aHeaderNames.empty() ) { try
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 09730ea0ccfe63982cdb869d5eaa906982283bf1 Author: Giuseppe Castagno AuthorDate: Fri Jan 29 15:39:17 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:29:28 2021 +0100 ucb: webdav-curl: Related tdf#95217: Force HEAD method in Web access if PROPFIND failed [ port of commit d61352f58a7f750d3b0b0a9c2d6498fbb7a6e10d ] Change-Id: Id945be7a1f71c830f3ab15c54fbf65a32be71a2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123278 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index f06169f323ba..040b0df99214 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -1379,6 +1379,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( bNetworkAccessAllowed ) { +if( eType != DAV ) +m_bDidGetOrHead = false; + // All properties obtained already? std::vector< OUString > aMissingProps; if ( !( xProps
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/ContentProperties.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit a50dbf49906f4aab367b2556be99779b2b05866d Author: Giuseppe Castagno AuthorDate: Fri Jan 29 16:11:26 2016 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:28:57 2021 +0100 ucb: webdav-curl: Related tdf#95217: Http header names are case insensitive [ port of commit e973b342826e54f147251b132c3325d30749e312 ] Change-Id: I7473625894c023c526a8ffeccd7ec6d67629ff76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123277 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.cxx b/ucb/source/ucp/webdav-curl/ContentProperties.cxx index ea5357fcd88e..54d6bcc75df2 100644 --- a/ucb/source/ucp/webdav-curl/ContentProperties.cxx +++ b/ucb/source/ucp/webdav-curl/ContentProperties.cxx @@ -406,7 +406,7 @@ void ContentProperties::addProperty( const OUString & rName, (*m_xProps)[ OUString( "Size" ) ] = PropertyValue( uno::makeAny( aValue.toInt64() ), true ); } -else if ( rName == "Content-Length" ) +else if ( rName.equalsIgnoreAsciiCase( "Content-Length" ) ) { // Do NOT map Content-Length entity header to DAV:getcontentlength! // Only DAV resources have this property. @@ -424,7 +424,7 @@ void ContentProperties::addProperty( const OUString & rName, (*m_xProps)[ OUString( "MediaType" ) ] = PropertyValue( rValue, true ); } -else if ( rName == "Content-Type" ) +else if ( rName.equalsIgnoreAsciiCase( "Content-Type" ) ) { // Do NOT map Content-Type entity header to DAV:getcontenttype! // Only DAV resources have this property. @@ -447,7 +447,7 @@ void ContentProperties::addProperty( const OUString & rName, (*m_xProps)[ OUString( "DateModified" ) ] = PropertyValue( uno::makeAny( aDate ), true ); } -else if ( rName == "Last-Modified" ) +else if ( rName.equalsIgnoreAsciiCase( "Last-Modified" ) ) { // Do not map Last-Modified entity header to DAV:getlastmodified! // Only DAV resources have this property.
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) New commits: commit 6c0c0ce22e8b9085ed0993a2445560206b05724e Author: Giuseppe Castagno AuthorDate: Sat Nov 21 20:41:06 2015 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:28:31 2021 +0100 ucb: webdav-curl: Related tdf#90700 Add configuration for web connection timeout. Currently the connection timeout is governed by operating system default. LO timeouts will be used in place of the TCP socket operating system ones, only in operating system where this is currently possible. The timeouts to use can be changed in LO configuration: 'Tools > Options > Advanced > Expert Configuration'. Propriety names are ConnectTimeout and ReadTimeout. ConnectTimeout contains the timeout (in seconds) used when making a connection (max 180 s, min 2 s, default 20 s). ReadTimeout contains the timeout (in seconds) used when reading from a socket (max 180 s, min 20 s, default 60 s). [ port of commit 14220052ef2b8675ee12aad63b0402f023d9760a omitting Session change which isn't directly possible ] Change-Id: I276851958f587346a36ee5f173b3e4fb88a944b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123276 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index e2ed80e3c5ed..f06169f323ba 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3303,6 +3303,7 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) //case DAVException::DAV_HTTP_AUTHPROXY: //break; +case DAVException::DAV_HTTP_TIMEOUT: case DAVException::DAV_HTTP_CONNECT: aException <<= ucb::InteractiveNetworkConnectException( @@ -3312,10 +3313,6 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) e.getData() ); break; -// @@@ No matching InteractiveNetwork*Exception -//case DAVException::DAV_HTTP_TIMEOUT: -//break; - // @@@ No matching InteractiveNetwork*Exception // case DAVException::DAV_HTTP_REDIRECT: // break; @@ -3405,6 +3402,7 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) bool Content::shouldAccessNetworkAfterException( const DAVException & e ) { if ( ( e.getStatus() == SC_NOT_FOUND ) || + ( e.getError() == DAVException::DAV_HTTP_TIMEOUT ) || ( e.getError() == DAVException::DAV_HTTP_LOOKUP ) || ( e.getError() == DAVException::DAV_HTTP_CONNECT ) || ( e.getError() == DAVException::DAV_HTTP_AUTH ) ||
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 47 --- 1 file changed, 28 insertions(+), 19 deletions(-) New commits: commit 11a457538a300d8df0c5c03d3cb590e94e6d99fa Author: Giuseppe Castagno AuthorDate: Fri Dec 4 17:10:06 2015 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:28:03 2021 +0100 ucb: webdav-curl: tdf#95792: fix saving file the first time on some WebDAV servers. Some WebDAV servers don't implement section 7.3 of RFC4918: <http://tools.ietf.org/html/rfc4918#section-7.3> This lack of implementation breaks 'Save As...' functionality when the target is a WebDAV server, by not locking the URL ('reserve the name for use', in RFC4918 parlance). The server not implementing this usually answers with one of '405 Method Not Allowed', '501 Not Implemented' or '412 Precondition Failed' http error codes. The fix should manage this lack of implementation. [ port of commit 4c82edfb3a9286a0bfef3f006e468e5c331987eb ] Change-Id: I343368bb91bd143aa26d8449b48f3b5300d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123275 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index e579a30c517c..e2ed80e3c5ed 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -2888,16 +2888,16 @@ Content::ResourceType Content::resourceTypeForLocks( << m_xIdentifier->getContentIdentifier() << "> was not found. "); eResourceTypeForLocks = NOT_FOUND; break; -// some servers returns this, instead +// some servers returns SC_FORBIDDEN, instead // TODO: probably remove it, when OPTIONS implemented -// the meaning of SC_FORBIDDEN is, according to http://tools.ietf.org/html/rfc7231#section-6.5.3 +// the meaning of SC_FORBIDDEN is, according to <http://tools.ietf.org/html/rfc7231#section-6.5.3>: // The 403 (Forbidden) status code indicates that the server understood // the request but refuses to authorize it case SC_FORBIDDEN: -// this returned errors are part of base http 1.1 RFCs -// see: -case SC_NOT_IMPLEMENTED:// http://tools.ietf.org/html/rfc7231#section-6.6.2 -case SC_METHOD_NOT_ALLOWED: // http://tools.ietf.org/html/rfc7231#section-6.5.5 +// Errors SC_NOT_IMPLEMENTED and SC_METHOD_NOT_ALLOWED are +// part of base http 1.1 RFCs +case SC_NOT_IMPLEMENTED:// <http://tools.ietf.org/html/rfc7231#section-6.6.2> +case SC_METHOD_NOT_ALLOWED: // <http://tools.ietf.org/html/rfc7231#section-6.5.5> // they all mean the resource is NON_DAV SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() DAVException (SC_FORBIDDEN, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); @@ -3001,7 +3001,7 @@ void Content::lock( { SAL_WARN( "ucb.ucp.webdav", "lock(): DAVException Authentication error - URL: <" << m_xIdentifier->getContentIdentifier() << ">" ); -// this could mean: +// DAVException::DAV_HTTP_AUTH exception can mean: // - interaction handler for credential management not present (happens, depending // on the LO framework processing) // - the remote site is a WebDAV with special configuration: read/only for read operations @@ -3023,20 +3023,28 @@ void Content::lock( //grab the error code switch( e.getStatus() ) { -// this returned error is part of base http 1.1 RFCs -case SC_NOT_IMPLEMENTED: -case SC_METHOD_NOT_ALLOWED: -SAL_WARN( "ucb.ucp.webdav", "lock() DAVException (SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" +// The 'case SC_PRECONDITION_FAILED' just below tries to solve a problem +// in SharePoint when locking the resource on first creation fails due to this: +// <https://msdn.microsoft.c
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx |8 1 file changed, 8 insertions(+) New commits: commit 96b1a6878cbcb05f962abe5c9bb073f4dff6f4dc Author: Giuseppe Castagno AuthorDate: Sun Nov 22 17:14:09 2015 +0100 Commit: Michael Stahl CommitDate: Mon Nov 1 18:27:38 2021 +0100 ucb: webdav-curl: Fix tdf#90700 Notify connect timeout early. Throws exception to manage timeout early in the first connection sequence. [ port of commit 95958755cbbf8c6026b878703400d5d9ec1e6c98 ] Change-Id: Ib6d306100ab04a3a21c37108d5c88185acf2524a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123274 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 01d8a40df7ee..e579a30c517c 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3505,6 +3505,14 @@ Content::ResourceType Content::getResourceType( *networkAccessAllowed = *networkAccessAllowed && shouldAccessNetworkAfterException(e); } +// 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 ) || + ( e.getError() == DAVException::DAV_HTTP_CONNECT ) ) +{ +cancelCommandExecution( e, xEnv ); +// unreachable +} // cancel command execution is case that no user authentication data has been provided. if ( e.getError() == DAVException::DAV_HTTP_NOAUTH )
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 22 ++ 1 file changed, 22 insertions(+) New commits: commit 98c05dd05318e6c8a77801d85c015539d933ffa6 Author: Giuseppe Castagno AuthorDate: Wed Aug 19 12:13:35 2015 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:26:43 2021 +0100 ucb: webdav-curl: tdf#83531 Opening WebDAV URL WebDav fails if write is restricted Happened because LOCK method was not allowed without credentials. [ port of commit 0326352470aee1a774bb5aa314c4f3625c1372b3 ] Change-Id: Id94b96856737e50715c2a18427ba22c3776a8da9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123272 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index f9933c639074..43884cdbab47 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -2997,6 +2997,28 @@ void Content::lock( false ); } break; +case DAVException::DAV_HTTP_AUTH: +{ +SAL_WARN( "ucb.ucp.webdav", "lock: DAVException Authentication error - URL: <" + << m_xIdentifier->getContentIdentifier() << ">" ); +// this could mean: +// - interaction handler for credential management not present (happens, depending +// on the LO framework processing) +// - the remote site is a WebDAV with special configuration: read/only for read operations +// and read/write for write operations, the user is not allowed to lock/write and +// she cancelled the credentials request. +// this is not actually an error, but the exception is sent directly from here, avoiding the automatic +// management that takes part in cancelCommandExecution() below +// Unfortunately there is no InteractiveNetwork*Exception available to signal this +// since it mostly happens on read/only part of webdav, this appears to be the most correct exception available +throw +ucb::InteractiveNetworkWriteException( +"Authentication error while trying to lock! Write only WebDAV perhaps?", +static_cast< cppu::OWeakObject * >( this ), +task::InteractionClassification_ERROR, +e.getData() ); +} +break; case DAVException::DAV_HTTP_ERROR: //grab the error code switch( e.getStatus() )
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 286 ++- ucb/source/ucp/webdav-curl/webdavcontent.hxx | 12 ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx |3 3 files changed, 236 insertions(+), 65 deletions(-) New commits: commit b5d91ff10fda72bc9758e7087f8a1a24d2d27022 Author: Giuseppe Castagno AuthorDate: Fri Aug 28 18:52:36 2015 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:26:14 2021 +0100 ucb: webdav-curl: tdf#82744: fix WebDAV lock/unlock behaviour - part 3 Changes done to the code in sfx2, ucbhelper, ucb, unotools in no particular order - add method helpers to call the ucb lock/unlock - add lock/unlock 'real' management - make DateChange property retrieval working for WebDAV as well - add check for changed content of a WebDAV file, in order to reload it correctly when 'Edit Mode' command is activated from GUI - Unlock WebDAV file while saving only if explicitly enabled Needed in order to avoid the small window of file unlocked state that opens while saving a file. When saving LO actually does as follows: - unlock the prevoius version of the file - prepares operations to save the modified version - lock the new file - save the new version - the lock method is enabled if the DAV resource supports it. In case the lock is not supported, for example example DAV with lock disabled, the lock method is disabled. Exception: when the resource is first created and the lock is not supported: a lock command is sent anyway, because if the resource is not yet present, there is no method to detect the lock/unlock availability in this case. - cppcheck:noExplicitConstructor [ port of commit b4576f3da4d90139fc5140962d13cb91dab98797 excluding the obsolete FTP scheme thing ] Change-Id: I16bb4e2fa9899fd31af7c223390f3fb213330fa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123228 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index d0756cdb634d..f9933c639074 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -197,7 +197,9 @@ Content::Content( rtl::Reference< DAVSessionFactory > const & rSessionFactory ) : ContentImplHelper( rxContext, pProvider, Identifier ), m_eResourceType( UNKNOWN ), + m_eResourceTypeForLocks( UNKNOWN ), m_pProvider( pProvider ), + m_rSessionFactory( rSessionFactory ), m_bTransient( false ), m_bCollection( false ), m_bDidGetOrHead( false ) @@ -228,6 +230,7 @@ Content::Content( bool isCollection ) : ContentImplHelper( rxContext, pProvider, Identifier ), m_eResourceType( UNKNOWN ), + m_eResourceTypeForLocks( UNKNOWN ), m_pProvider( pProvider ), m_bTransient( true ), m_bCollection( isCollection ), @@ -635,23 +638,28 @@ uno::Any SAL_CALL Content::execute( // lock -// supportsExclusiveWriteLock() does not work if the file is being created. -// The lack of lock functionality is taken care of inside lock(), -// a temporary measure. -// This current implementation will result in a wasted lock request issued to web site -// that don't support it. -// TODO: need to rewrite the managing of the m_bTransient flag, when the resource is non yet existent -// and the first lock on a non existed resource first creates it then lock it. -lock( Environment ); +ResourceType eType = resourceTypeForLocks( Environment ); +// when the resource is not yet present the lock is used to create it +// see: http://tools.ietf.org/html/rfc4918#section-7.3 +// If the resource doesn't exists and the lock is not enabled (DAV with +// no lock or a simple web) the error will be dealt with inside lock() method +if ( eType == NOT_FOUND || +eType == DAV ) +{ +lock( Environment ); +if ( eType == NOT_FOUND ) +{ +m_eResourceType = UNKNOWN; // lock may have created it, need to check again +m_eResourceTypeForLocks = UNKNOWN; +} +} } -else if ( aCommand.Name == "unlock" && - supportsExclusiveWriteLock( Environment ) ) +else if ( aCommand.Name == "unlock" ) { // unlock - - -unlock( Environment ); +if ( resourceTypeForLocks( Environment ) == DAV ) +unlock( Environment ); } else if ( aCommand.Name == "createNewContent" && isFolder( Environment ) ) @@ -749,6 +757,7 @@ uno::Any SAL_CALL Content::execute( } SAL_INFO("ucb.ucp.webdav", "<<<<< Con
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-curl/webdavcontent.cxx | 112 +++ ucb/source/ucp/webdav-curl/webdavcontent.hxx |1 2 files changed, 96 insertions(+), 17 deletions(-) New commits: commit 115edb7a91f0c1c9b2aeb343680f47924730d121 Author: Giuseppe Castagno AuthorDate: Thu Oct 7 12:47:27 2021 +0200 Commit: Michael Stahl CommitDate: Mon Nov 1 18:25:26 2021 +0100 ucb: webdav-curl: tdf#82744: fix WebDAV lock/unlock behaviour - part 1 There are some areas in ucb outside the issue scope that should later be addressed, among them: - in ucb/webdav make flag m_bTransient working right, currently lock option for WebDAV server not supporting it is suboptimal: there are not needed lock requests; - change the method the modified file is checked against the old one, using DAV:etag instead of the DateTime; - some http status code returned by the server don't seem to be managed; - during WebDAV operation some redundant request of properties is carried out. Probably some clean up to remove these not needed transactions is to be done. Accessing only those really supported by the referenced href would be better. Changes done to the code in ucb, in no particular order - remove current WebDAV lock management - have the lock/unlock working correctly when the webdav resource is first created: in the case of creation is the first lock on the non existent resource that actually creates it - fix a problem while fetching WebDAV properties. If a single WebDAV non-cached property was requested, it would not be fetched from the server without this fix. - change the lock owner name. This should probably be different. Something to be discussed. This same string can be read by all the applications accessing the lock. Spec reference is: RFC4918 [2007]: '14.17. owner XML Element' link (as of 20150713): http://tools.ietf.org/html/rfc4918#section-14.17 - manage WebDAV locked file exception directly while locking. The ucb::InteractiveLockingLockedException is thrown directly when detected by the lock command, to avoid the user interaction activated by the cancelCommandExecution method. - terminate gracefully if WebDAV lock/unlock is not supported [ port of commit 26e6d4b05ab444e6a7529ffcac7fbe592fc94833 ] Change-Id: I0a4c926dc1e32cc620ad6e9acfc9c9c56928fa49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123226 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 3bebf9125fed..d63fc7356669 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -199,7 +199,6 @@ Content::Content( m_eResourceType( UNKNOWN ), m_pProvider( pProvider ), m_bTransient( false ), - m_bLocked( false ), m_bCollection( false ), m_bDidGetOrHead( false ) { @@ -231,7 +230,6 @@ Content::Content( m_eResourceType( UNKNOWN ), m_pProvider( pProvider ), m_bTransient( true ), - m_bLocked( false ), m_bCollection( isCollection ), m_bDidGetOrHead( false ) { @@ -252,8 +250,6 @@ Content::Content( // virtual Content::~Content() { -if (m_bLocked) -unlock(uno::Reference< ucb::XCommandEnvironment >()); } @@ -532,10 +528,6 @@ uno::Any SAL_CALL Content::execute( aRet = open( aOpenCommand, Environment ); -if ( (aOpenCommand.Mode == ucb::OpenMode::DOCUMENT || - aOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE) && -supportsExclusiveWriteLock( Environment ) ) -lock( Environment ); } else if ( aCommand.Name == "insert" ) { @@ -638,13 +630,18 @@ uno::Any SAL_CALL Content::execute( post( aArg, Environment ); } -else if ( aCommand.Name == "lock" && - supportsExclusiveWriteLock( Environment ) ) +else if ( aCommand.Name == "lock" ) { // lock - +// supportsExclusiveWriteLock() does not work if the file is being created. +// The lack of lock functionality is taken care of inside lock(), +// a temporary measure. +// This current implementation will result in a wasted lock request issued to web site +// that don't support it. +// TODO: need to rewrite the managing of the m_bTransient flag, when the resource is non yet existent +// and the first lock on a non existed resource first creates it then lock it. lock( Environment ); } else if ( aCommand.Name == "unlock" && @@ -1325,8 +1322,18 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { const OUString &
Re: Prublem building LO master in clang 3.6
On 01/16/2017 10:33 AM, Stephan Bergmann wrote: ... We removed plugin support for Clang < 3.4 with <https://cgit.freedesktop.org/libreoffice/core/commit/?id=733198de1b7fc3907609217147704f493f6146e6>, and I'd like to bump the baseline again in the future, depending on the oldest version that people are using (for a good reason). Any specific reason you're using Clang 3.6? Not specifically. I'm still on Ubuntu 14.04 and didn't have the time to install a more recent version (apparently 3.8 should be available on my distro). Thanks. -- Kind Regards, Giuseppe Castagno aka beppec56 Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Prublem building LO master in clang 3.6
Hi all, tryiong to build LO recent master in clang 3.6 I got an error building plugins: CC=clang-3.6 CXX=clang++-3.6 CLANGDIR=/usr/lib/llvm-3.6 --disable-ccache --with-vendor=Acca Esse, I-10067 --with-external-tar=/srv5/git/LO/externals --enable-python=system --with-gdrive-client-id= --with-gdrive-client-secret= --with-lang=en-US --enable-dbgutil --enable-werror --enable-online-update --disable-mergelibs --without-system-poppler --without-system-openssl --without-system-libpng --without-system-libxml --without-system-jpeg --without-system-postgresql --with-build-version=2017-01-14 12:33:12 - Rev. master:5930cf8 based on master:5930cf8 --enable-compiler-plugins ... [build CXX] compilerplugins/clang/salbool.cxx /srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/clang/salbool.cxx:111:15: error: no member named 'isLookupContext' in 'clang::DeclContext' if (!ctx->isLookupContext()) { ~~~ ^ 1 error generated. /srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/Makefile-clang.mk:92: recipe for target '/srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/obj/salbool.o' failed make: *** [/srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/obj/salbool.o] Error 1 Thanks -- Kind Regards, Giuseppe Castagno aka beppec56 Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: ucb/qa
ucb/qa/cppunit/webdav/webdav_local_neon.cxx |3 ++- ucb/qa/cppunit/webdav/webdav_options.cxx| 16 +--- 2 files changed, 11 insertions(+), 8 deletions(-) New commits: commit acf531be6a423f9b74997b29a8cafe82aa18423c Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Tue Nov 1 11:11:09 2016 +0100 Cosmetic: Namespaces, better make use of the 'using-directive' Change-Id: If27709a2d8d8f231be9be0231d522f2a71e5fcae Reviewed-on: https://gerrit.libreoffice.org/30457 Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Tested-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/qa/cppunit/webdav/webdav_local_neon.cxx b/ucb/qa/cppunit/webdav/webdav_local_neon.cxx index b509229..cbe0e07 100644 --- a/ucb/qa/cppunit/webdav/webdav_local_neon.cxx +++ b/ucb/qa/cppunit/webdav/webdav_local_neon.cxx @@ -12,6 +12,7 @@ #include #include "NeonUri.hxx" +using namespace webdav_ucp; namespace { @@ -35,7 +36,7 @@ namespace { //try URL decomposition OUString aURL( "http://user%40anothern...@server.biz:8040/aService/asegment/nextsegment/check.this?test=true=http://anotherserver.com/%3Fcheck=theapplication%26os=linuxintel%26lang=en-US%26version=5.2.0; ); -webdav_ucp::NeonUri aURI( aURL ); +NeonUri aURI( aURL ); CPPUNIT_ASSERT_EQUAL( OUString( "http" ), aURI.GetScheme() ); CPPUNIT_ASSERT_EQUAL( OUString( "server.biz" ), aURI.GetHost() ); CPPUNIT_ASSERT_EQUAL( OUString( "user%40anothername" ), aURI.GetUserInfo() ); diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx index 9bdc1c5..709e2bc 100644 --- a/ucb/qa/cppunit/webdav/webdav_options.cxx +++ b/ucb/qa/cppunit/webdav/webdav_options.cxx @@ -13,6 +13,8 @@ #include "DAVException.hxx" #include "DAVTypes.hxx" +using namespace webdav_ucp; + namespace { @@ -27,7 +29,7 @@ namespace void tearDown( ) override; -void DAVTypesCheckInit( webdav_ucp::DAVOptions const & aDavType ); +void DAVTypesCheckInit( DAVOptions const & aDavType ); void DAVTypesTest(); void DAVOptsCacheTests(); @@ -51,7 +53,7 @@ namespace { } -void webdav_opts_test::DAVTypesCheckInit( webdav_ucp::DAVOptions const & aDavType ) +void webdav_opts_test::DAVTypesCheckInit( DAVOptions const & aDavType ) { // check if the class is at reset state // using accessors @@ -73,7 +75,7 @@ namespace void webdav_opts_test::DAVTypesTest() { //our DAVOptions -webdav_ucp::DAVOptions aDavOpt; +DAVOptions aDavOpt; DAVTypesCheckInit( aDavOpt ); aDavOpt.setClass1(); @@ -275,7 +277,7 @@ namespace aDavOpt.init(); DAVTypesCheckInit( aDavOpt ); // equality check -webdav_ucp::DAVOptions aDavOptTarget; +DAVOptions aDavOptTarget; CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget ); aDavOpt.setClass1(); @@ -341,11 +343,11 @@ namespace void webdav_opts_test::DAVOptsCacheTests() { // define a local cache to test -webdav_ucp::DAVOptionsCache aDAVOptsCache; +DAVOptionsCache aDAVOptsCache; // the value to cache -webdav_ucp::DAVOptions aDavOpt; +DAVOptions aDavOpt; // the returned value to test -webdav_ucp::DAVOptions aDavOptCached; +DAVOptions aDavOptCached; // init the values OUString aAllowedMethods = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK"; OUString aURL = "http://my.server.org/a%20fake%20url/to%20test/another-url;; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: Problem building in clang 3.6 (Ubuntu 14.04)
On 11/01/2016 12:07 PM, Noel Grandin wrote: hopefully "fixed" now with 5e997f4dba1cfcde554ff413a615e101b9c72ee5 clang 3.6 build in progress. Thanks. -- Kind Regards, Giuseppe Castagno aka beppec56 Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: Problem building in clang 3.6 (Ubuntu 14.04)
On 10/31/2016 10:55 AM, Noel Grandin wrote: should be fixed with https://cgit.freedesktop.org/libreoffice/core/commit/?id=eaf32cd43c4d45db6c3b284d53169c81f522744e after the above, the error changed into this: [build CXX] compilerplugins/clang/vclwidgets.cxx [build CXX] compilerplugins/clang/unnecessaryoverride.cxx /srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/clang/unnecessaryoverride.cxx:275:44: error: no viable conversion from '(lambda at /srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/clang/unnecessaryoverride.cxx:230:32)' to 'BaseMatchesCallback *' (aka 'bool (*)(const clang::CXXBaseSpecifier *, clang::CXXBasePath &, void *)') methodDecl->getParent()->lookupInBases(BaseMatchesCallback, nullptr, aPaths); ^~~ /usr/lib/llvm-3.6/include/clang/AST/DeclCXX.h:1527:43: note: passing argument to parameter 'BaseMatches' here bool lookupInBases(BaseMatchesCallback *BaseMatches, void *UserData, ^ 1 error generated. /srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/Makefile-clang.mk:92: recipe for target '/srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/obj/unnecessaryoverride.o' failed make: *** [/srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/obj/unnecessaryoverride.o] Error 1 beppe@dsklnx2:/srv5/git/LO/lo-gerrit-clang-dbgutil -- Kind Regards, Giuseppe Castagno aka beppec56 Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Problem building in clang 3.6 (Ubuntu 14.04)
Hi all, Ubuntu 14.04, clang 3.6, relevant build log: [build CXX] compilerplugins/clang/reservedid.cxx [build CXX] compilerplugins/clang/unnecessaryoverride.cxx /srv5/git/LO/lo-gerrit-clang-dbgutil/compilerplugins/clang/unnecessaryoverride.cxx:269:71: error: too few arguments to function call, expected 3, have 2 methodDecl->getParent()->lookupInBases(BaseMatchesCallback, aPaths); ~~^ /usr/lib/llvm-3.6/include/clang/AST/DeclCXX.h:1527:3: note: 'lookupInBases' declared here bool lookupInBases(BaseMatchesCallback *BaseMatches, void *UserData, ^ /usr/lib/llvm-3.6/bin/../lib/clang/3.6.0/include/stdbool.h:37:15: note: expanded from macro 'bool' #define bool bool ^ 1 error generated. -- Kind Regards, Giuseppe Castagno Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 56 +-- 1 file changed, 28 insertions(+), 28 deletions(-) New commits: commit cac08e96c753f3aabf3332914da97a49abe1e395 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Thu Oct 27 10:03:46 2016 +0200 Cosmetic: Move function member around... ...so it's nearer to the other function member that uses the class variables it initializes. Change-Id: I199621fbcad36313e0948627d47445a1de211d02 Reviewed-on: https://gerrit.libreoffice.org/30313 Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Tested-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 96b86f7..96a7371 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -285,34 +285,6 @@ Content::~Content() } -void Content::initOptsCacheLifeTime() -{ -// see description in -// officecfg/registry/schema/org/openoffice/Inet.xcs -// for use of these filed values. -sal_uInt32 nAtime; -nAtime = officecfg::Inet::Settings::OptsCacheLifeImplWeb::get( m_xContext ); -m_nOptsCacheLifeImplWeb = std::max( sal_uInt32( 0 ), -std::min( nAtime, sal_uInt32( 3600 ) ) ); - -nAtime = officecfg::Inet::Settings::OptsCacheLifeDAV::get( m_xContext ); -m_nOptsCacheLifeDAV = std::max( sal_uInt32( 0 ), -std::min( nAtime, sal_uInt32( 3600 ) ) ); - -nAtime = officecfg::Inet::Settings::OptsCacheLifeDAVLocked::get( m_xContext ); -m_nOptsCacheLifeDAVLocked = std::max( sal_uInt32( 0 ), -std::min( nAtime, sal_uInt32( 3600 ) ) ); - -nAtime = officecfg::Inet::Settings::OptsCacheLifeNotImpl::get( m_xContext ); -m_nOptsCacheLifeNotImpl = std::max( sal_uInt32( 0 ), - std::min( nAtime, sal_uInt32( 43200 ) ) ); - -nAtime = officecfg::Inet::Settings::OptsCacheLifeNotFound::get( m_xContext ); -m_nOptsCacheLifeNotFound = std::max( sal_uInt32( 0 ), - std::min( nAtime, sal_uInt32( 30 ) ) ); -} - - // XInterface methods. @@ -4032,6 +4004,34 @@ Content::ResourceType Content::getResourceType( } +void Content::initOptsCacheLifeTime() +{ +// see description in +// officecfg/registry/schema/org/openoffice/Inet.xcs +// for use of these filed values. +sal_uInt32 nAtime; +nAtime = officecfg::Inet::Settings::OptsCacheLifeImplWeb::get( m_xContext ); +m_nOptsCacheLifeImplWeb = std::max( sal_uInt32( 0 ), +std::min( nAtime, sal_uInt32( 3600 ) ) ); + +nAtime = officecfg::Inet::Settings::OptsCacheLifeDAV::get( m_xContext ); +m_nOptsCacheLifeDAV = std::max( sal_uInt32( 0 ), +std::min( nAtime, sal_uInt32( 3600 ) ) ); + +nAtime = officecfg::Inet::Settings::OptsCacheLifeDAVLocked::get( m_xContext ); +m_nOptsCacheLifeDAVLocked = std::max( sal_uInt32( 0 ), +std::min( nAtime, sal_uInt32( 3600 ) ) ); + +nAtime = officecfg::Inet::Settings::OptsCacheLifeNotImpl::get( m_xContext ); +m_nOptsCacheLifeNotImpl = std::max( sal_uInt32( 0 ), + std::min( nAtime, sal_uInt32( 43200 ) ) ); + +nAtime = officecfg::Inet::Settings::OptsCacheLifeNotFound::get( m_xContext ); +m_nOptsCacheLifeNotFound = std::max( sal_uInt32( 0 ), + std::min( nAtime, sal_uInt32( 30 ) ) ); +} + + void Content::getResourceOptions( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv, DAVOptions& rDAVOptions, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: external/nss
external/nss/ExternalProject_nss.mk |1 + 1 file changed, 1 insertion(+) New commits: commit da5d20562479174504c3795aa9e7ca0856883e81 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Thu Oct 13 11:10:00 2016 +0200 Linux: Build NSS in debug mode only in '--enable-dbgutil' mode. With this commit, NSS debug mode is enabled only if you compile with --enable-dbgutil using ./autogen.sh command. Only for the Linux platform builds. Change-Id: Ia8626f36692fd38e8b1dbd774e4bc0ccedc59072 Reviewed-on: https://gerrit.libreoffice.org/29781 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk index 258e845..07cc472 100644 --- a/external/nss/ExternalProject_nss.mk +++ b/external/nss/ExternalProject_nss.mk @@ -67,6 +67,7 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject $(if $(filter MACOSX,$(OS)),\ $(if $(filter-out POWERPC,$(CPUNAME)),MACOS_SDK_DIR=$(MACOSX_SDK_PATH)) \ NSS_USE_SYSTEM_SQLITE=1) \ + $(if $(filter LINUX,$(OS)),$(if $(ENABLE_DBGUTIL),,BUILD_OPT=1)) \ $(if $(filter SOLARIS,$(OS)),NS_USE_GCC=1) \ $(if $(CROSS_COMPILING),\ $(if $(filter MACOSXPOWERPC,$(OS)$(CPUNAME)),CPU_ARCH=ppc) \ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/qa
ucb/qa/cppunit/webdav/webdav_options.cxx | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit 80cd32f78deca3fea2f731af02a2ad83134261f3 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Wed Oct 26 08:57:51 2016 +0200 WebDAV: Small cosmetic to unit checks. Change server name in URI test strings. Pass by const lvalue reference [loplugin:passstuffbyref]. Change-Id: Ic0134f0690a8e6b9abb7d0764efaeeaf3a167bcf Reviewed-on: https://gerrit.libreoffice.org/30284 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx index ce3aba7..b1a71ba 100644 --- a/ucb/qa/cppunit/webdav/webdav_options.cxx +++ b/ucb/qa/cppunit/webdav/webdav_options.cxx @@ -27,7 +27,7 @@ namespace void tearDown( ) override; -void DAVTypesCheckInit( webdav_ucp::DAVOptions aDavType ); +void DAVTypesCheckInit( webdav_ucp::DAVOptions& aDavType ); void DAVTypesTest(); void DAVOptsCacheTests(); @@ -51,7 +51,7 @@ namespace { } -void webdav_opts_test::DAVTypesCheckInit( webdav_ucp::DAVOptions aDavType ) +void webdav_opts_test::DAVTypesCheckInit( webdav_ucp::DAVOptions& aDavType ) { // check if the class is at reset state // using accessors @@ -223,7 +223,7 @@ namespace aHTTPResponseStatusText.clear(); aDavOpt.setHttpResponseStatusText( aHTTPResponseStatusText ); -OUString aURL = "http://a%20fake%20url/to%20test;; +OUString aURL = "http://my.server.org/a%20fake%20url/to%20test;; aDavOpt.setURL( aURL ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() ); @@ -240,7 +240,7 @@ namespace aURL.clear(); aDavOpt.setURL( aURL ); -aURL = "http://a%20fake%20url/to%20test/another-url;; +aURL = "http://my.server.org/a%20fake%20url/to%20test/another-url;; aDavOpt.setRedirectedURL( aURL ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() ); @@ -257,7 +257,7 @@ namespace //check the init() function aAllowedMethods = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK"; -aURL = "http://a%20fake%20url/to%20test/another-url;; +aURL = "http://my.server.org/a%20fake%20url/to%20test/another-url;; aHTTPResponseStatusText = "404 Not Found"; aDavOpt.setClass1(); aDavOpt.setClass2(); @@ -348,8 +348,8 @@ namespace webdav_ucp::DAVOptions aDavOptCached; // init the values OUString aAllowedMethods = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK"; -OUString aURL = "http://a%20fake%20url/to%20test/another-url;; -OUString aRedirectedURL = "http://a%20fake%20url/to%20test/another-url/redirected;; +OUString aURL = "http://my.server.org/a%20fake%20url/to%20test/another-url;; +OUString aRedirectedURL = "http://my.server.org/a%20fake%20url/to%20test/another-url/redirected;; aDavOpt.setURL( aURL ); aDavOpt.setRedirectedURL( aRedirectedURL ); aDavOpt.setClass1(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
It seems LO doesn't handle correctly complex HTTP queries
Hi all, working on bug <https://bugs.documentfoundation.org/show_bug.cgi?id=99499> I came across a couple of complex HTTP queries that IMHO LO doesn't handle correctly. One query full URI is: <http://www.digikey.com/web%20export/common/mkt/en/help.png?requestedName=help?requestedName=help?requestedName=help?requestedName=help?requestedName=help> while LO WebDAV percent-encodes into: <http://www.digikey.com/web%20export/common/mkt/en/help.png%3FrequestedName=help%3FrequestedName=help%3FrequestedName=help%3FrequestedName=help?requestedName=help> That is, LO detects a HTTP query start at the first '?' from the end of the URI and not at the first '?' after the last segment of the path, as it should be according to <https://tools.ietf.org/html/rfc3986#section-3>, and <https://tools.ietf.org/html/rfc3986#section-3.4>. Furthermore, it doesn't seems to encode correctly the query body, but I still have to dig deeper for that. I think that the WebDAV UCP provider should not change the HTTP query it receives, but the query should be correctly set and percent-encoded by the client application (e.g. framework). This means that the '?' character should be percent-encoded as %3F into the path part of the URI before being presented to WebDAV provider, this to prevent possibly wrong interpretation. I'd like to change the way the WebDAV provider deals with HTTP query, that implies the correct percent-encoding of '?' into %3F in UCB provider clients. The query re-encoding is done here: <http://opengrok.libreoffice.org/xref/core/ucb/source/ucp/inc/urihelper.hxx#45> Any thoughts? References: The HTTP query is defined in <https://tools.ietf.org/html/rfc7230#section-2.7>. Which in turn links to <https://tools.ietf.org/html/rfc3986#section-3.4> -- Kind Regards, Giuseppe Castagno Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/DAVException.hxx |5 + ucb/source/ucp/webdav-neon/webdavcontent.cxx | 74 +-- ucb/source/ucp/webdav-neon/webdavcontent.hxx |4 + 3 files changed, 77 insertions(+), 6 deletions(-) New commits: commit 59d6d5579528a66e55b75987d2d959968db485a8 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Fri Oct 14 17:13:20 2016 +0200 tdf#102499 (9): Fix eXo Platform WebDAV on 'Save Remote File' Change-Id: I2d2aceed3804f653b79d48eeb02468fc77374eb7 Reviewed-on: https://gerrit.libreoffice.org/29884 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/DAVException.hxx b/ucb/source/ucp/webdav-neon/DAVException.hxx index a7e57ca..c6f50a2 100644 --- a/ucb/source/ucp/webdav-neon/DAVException.hxx +++ b/ucb/source/ucp/webdav-neon/DAVException.hxx @@ -104,6 +104,11 @@ const sal_uInt16 SC_INSUFFICIENT_STORAGE = 507; // unofficial status codes only used internally by LO // used to cache the connection time out event const sal_uInt16 USC_CONNECTION_TIMED_OUT= 908; +// name resolution failed +const sal_uInt16 USC_LOOKUP_FAILED = 909; +const sal_uInt16 USC_AUTH_FAILED = 910; +const sal_uInt16 USC_AUTHPROXY_FAILED= 911; + class DAVException : public std::exception diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 00ccdb9..96b86f7 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -3856,7 +3856,7 @@ Content::ResourceType Content::getResourceType( } else { -getResourceOptions( xEnv, aDAVOptions, rResAccess ); +getResourceOptions( xEnv, aDAVOptions, rResAccess, networkAccessAllowed ); // at least class one is needed if( aDAVOptions.isClass1() ) @@ -4035,7 +4035,8 @@ Content::ResourceType Content::getResourceType( void Content::getResourceOptions( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv, DAVOptions& rDAVOptions, -const std::unique_ptr< DAVResourceAccess > & rResAccess ) +const std::unique_ptr< DAVResourceAccess > & rResAccess, +bool * networkAccessAllowed ) throw ( css::uno::Exception, std::exception ) { OUString aRedirURL; @@ -4095,8 +4096,25 @@ void Content::getResourceOptions( // used only internally, so the text doesn't really matter.. aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, m_nOptsCacheLifeNotFound ); -cancelCommandExecution( e, xEnv ); -// unreachable +if ( networkAccessAllowed != nullptr ) +{ +*networkAccessAllowed = *networkAccessAllowed +&& shouldAccessNetworkAfterException(e); +} +} +break; +case DAVException::DAV_HTTP_LOOKUP: +{ +SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException: DAV_HTTP_LOOKUP for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +aDAVOptions.setHttpResponseStatusCode( USC_LOOKUP_FAILED ); +// used only internally, so the text doesn't really matter.. +aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, + m_nOptsCacheLifeNotFound ); +if ( networkAccessAllowed != nullptr ) +{ +*networkAccessAllowed = *networkAccessAllowed +&& shouldAccessNetworkAfterException(e); +} } break; case DAVException::DAV_HTTP_AUTH: @@ -4107,6 +4125,29 @@ void Content::getResourceOptions( // she cancelled the credentials request. // this is not actually an error, it means only that for current user this is a standard web, // though possibly DAV enabled +aDAVOptions.setHttpResponseStatusCode( USC_AUTH_FAILED ); +// used only internally, so the text doesn't really matter.. +aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, + m_nOptsCacheLifeNotFound ); +if ( networkAccessAllowed != nullptr ) +{ +
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 24 1 file changed, 24 insertions(+) New commits: commit bb27b2ff87e534b6f4fb9583271db29d6bbae8b6 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Fri Oct 21 15:53:53 2016 +0200 tdf#102499 (8): Return empty property when not present. Change-Id: If5afa4f33ac5b5dfec123960c2e9660183576256 Reviewed-on: https://gerrit.libreoffice.org/30142 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 53d27a7..00ccdb9 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -1745,6 +1745,30 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( m_bCollection ) ); } +// Add a default for the properties requested but not found. +// Determine still missing properties, add a default. +// Some client function doesn't expect a void uno::Any, +// but instead wants some sort of default. +std::vector< OUString > aMissingProps; +if ( !xProps->containsAllNames( +rProperties, aMissingProps ) ) +{ +// +for ( std::vector< rtl::OUString >::const_iterator it = aMissingProps.begin(); + it != aMissingProps.end(); ++it ) +{ +// For the time being only a couple of properties need to be added +if ( (*it) == "DateModified" || (*it) == "DateCreated" ) +{ +util::DateTime aDate; +xProps->addProperty( +(*it), +uno::makeAny( aDate ), +true ); +} +} +} + sal_Int32 nCount = rProperties.getLength(); for ( sal_Int32 n = 0; n < nCount; ++n ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: unotools/source
unotools/source/misc/mediadescriptor.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 52350c15b37573e160f25d39565f577fc7189955 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Wed Oct 19 09:51:40 2016 +0200 tdf#103274 (11): Add default XCommandEnvironment reference Change-Id: I8145e167ef58d83666c2f18adf869a30c859ee8f Reviewed-on: https://gerrit.libreoffice.org/30036 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/unotools/source/misc/mediadescriptor.cxx b/unotools/source/misc/mediadescriptor.cxx index e123474..2813a8d 100644 --- a/unotools/source/misc/mediadescriptor.cxx +++ b/unotools/source/misc/mediadescriptor.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -376,7 +377,9 @@ bool MediaDescriptor::isStreamReadOnly() const bReadOnly = true; else { -::ucbhelper::Content aContent(xContent, css::uno::Reference< css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext()); +::ucbhelper::Content aContent(xContent, + utl::UCBContentHelper::getDefaultCommandEnvironment(), + comphelper::getProcessComponentContext()); aContent.getPropertyValue(CONTENTPROP_ISREADONLY) >>= bReadOnly; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: solenv/gbuild solenv/Module_solenv.mk solenv/qa
solenv/Module_solenv.mk |2 ++ solenv/gbuild/extensions/post_GbuildToIde.mk |3 +-- solenv/qa/python/gbuildtoide.py |6 +- 3 files changed, 4 insertions(+), 7 deletions(-) New commits: commit 6e261cb19e5751eb0553ad0c5b357b1a5747518c Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Thu Oct 20 12:26:51 2016 + Revert "prep WinResTarget for WNT in testdir" Still random failures in Gerrit Windows builds. This reverts commit f5c54089b50718abf7c35aa81b150c509809d5c4. Change-Id: Iec48d2388691577ccd675b9a73941cedceebd527 Reviewed-on: https://gerrit.libreoffice.org/30103 Reviewed-by: Björn Michaelsen <bjoern.michael...@canonical.com> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Tested-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/solenv/Module_solenv.mk b/solenv/Module_solenv.mk index d179771..f471374 100644 --- a/solenv/Module_solenv.mk +++ b/solenv/Module_solenv.mk @@ -22,9 +22,11 @@ $(eval $(call gb_Module_add_targets,solenv,\ endif ifneq ($(DISABLE_PYTHON),TRUE) +ifneq ($(OS),WNT) # disable on Windows for now, causes gerrit/jenkins failures $(eval $(call gb_Module_add_subsequentcheck_targets,solenv,\ PythonTest_solenv_python \ )) endif +endif # vim: set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/solenv/gbuild/extensions/post_GbuildToIde.mk b/solenv/gbuild/extensions/post_GbuildToIde.mk index 74a867c..c8087ba 100644 --- a/solenv/gbuild/extensions/post_GbuildToIde.mk +++ b/solenv/gbuild/extensions/post_GbuildToIde.mk @@ -18,8 +18,7 @@ foo: true define gb_LinkTarget__command -mkdir -p $(WORKDIR)/GbuildToIde/$(dir $(2)) $(WORKDIR)/Headers/$(dir $(2)) -$(if $(filter WNT,$(OS)),mkdir -p $(dir $(call gb_WinResTarget_get_target,dummy))) +mkdir -p $(WORKDIR)/GbuildToIde/$(dir $(2)) printf '{"LINKTARGET": "%s"' '$(2)' > $(WORKDIR)/GbuildToIde/$(2) printf ', "ILIBTARGET": "%s"' '$(ILIBTARGET)' >> $(WORKDIR)/GbuildToIde/$(2) printf ', "COBJECTS": "%s"' '$(COBJECTS)' >> $(WORKDIR)/GbuildToIde/$(2) diff --git a/solenv/qa/python/gbuildtoide.py b/solenv/qa/python/gbuildtoide.py index 591a5fc..11e66a8 100644 --- a/solenv/qa/python/gbuildtoide.py +++ b/solenv/qa/python/gbuildtoide.py @@ -18,17 +18,13 @@ import tempfile class CheckGbuildToIde(unittest.TestCase): def setUp(self): self.tempwork = tempfile.mkdtemp() -if os.environ['OS'] == 'WNT': -self.tempworkmixed = self.tempwork.replace('\\','/') -else: -self.tempworkmixed = self.tempwork def tearDown(self): subprocess.check_call(['rm', '-rf', self.tempwork]) def test_gbuildtoide(self): os.chdir(os.path.join(os.environ['SRCDIR'], 'solenv', 'qa', 'python', 'selftest')) -subprocess.check_call(['make', 'gbuildtoide', 'WORKDIR=%s' % self.tempworkmixed]) +subprocess.check_call(['make', 'gbuildtoide', 'WORKDIR=%s' % self.tempwork]) jsonfiles = os.listdir(os.path.join(self.tempwork, 'GbuildToIde', 'Library')) gbuildlibs = [] for jsonfilename in jsonfiles: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Problem building in Gerrit, Windows only.
Hi all, a patch of mine: <https://gerrit.libreoffice.org/#/c/30036/4> always fails in Gerrit Windows build machine in test PythonTest_solenv_python: <http://ci.libreoffice.org/job/lo_gerrit/1657/Config=windows_msc_dbgutil_32/console> Unfortunately I'm not able to reproduce it on my Window 10 build machine (Win10 64bit, VS2013 64bit, LO 32bit) , where that same test doesn't fail. I need help, because I have no idea what's going on. May be make internal error, as stated in these build log lines: " make[3]: Entering directory '/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/windows_msc_dbgutil_32/solenv/qa/python/selftest' make[3]: *** internal error: invalid --jobserver-fds string 'gmake_semaphore_5488'. Stop. make[3]: Leaving directory '/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/windows_msc_dbgutil_32/solenv/qa/python/selftest' " can give some hint? Following is the make version I use on Windows 10: " $ d:/lode/opt/bin/make --version GNU Make 4.0 Built for Windows32 Copyright (C) 1988-2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. " Help appreciated, thanks. -- Kind Regards, Giuseppe Castagno Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/dialog/filedlghelper.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 75239b77139434db9be5e0e7e133e3661c5404b0 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Wed Oct 19 12:29:30 2016 +0200 tdf#103274 (10): Add default XCommandEnvironment reference Change-Id: Ic91553a513656b412bccd73a483ca7d7f131b657 Reviewed-on: https://gerrit.libreoffice.org/30047 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index b4a79d7..c976b8d 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2031,7 +2031,9 @@ namespace sPathCheck += "."; try { -::ucbhelper::Content aContent( sPathCheck, uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() ); +::ucbhelper::Content aContent( sPathCheck, + utl::UCBContentHelper::getDefaultCommandEnvironment(), + comphelper::getProcessComponentContext() ); bValid = aContent.isFolder(); } catch( const Exception& ) {} ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: writerperfect/source
writerperfect/source/impress/KeynoteImportFilter.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 17b94a616d63759294a9530dca5139972172aadf Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Wed Oct 19 09:25:14 2016 +0200 tdf#103274 (9): Add default XCommandEnvironment reference Change-Id: If1b7bc913e392f511caf0684baa5bc3ce2c6933d Reviewed-on: https://gerrit.libreoffice.org/30035 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx index 1547d1d..cf274c8 100644 --- a/writerperfect/source/impress/KeynoteImportFilter.cxx +++ b/writerperfect/source/impress/KeynoteImportFilter.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -132,7 +133,9 @@ throw(css::uno::RuntimeException, std::exception) */ if (xContent.is()) { -ucbhelper::Content aContent(xContent, Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext()); +ucbhelper::Content aContent(xContent, + utl::UCBContentHelper::getDefaultCommandEnvironment(), +comphelper::getProcessComponentContext()); try { if (aContent.isFolder()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 71dfc1113e45caff3d2ff43261a81c8cadae340a Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Oct 16 10:11:13 2016 +0200 tdf#103274 (8): Add default XCommandEnvironment reference Change-Id: I583ed0714c0bf543c44c098613e1aab9d3b31452 Reviewed-on: https://gerrit.libreoffice.org/30007 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 55bbf0a..27e79f8 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3942,7 +3942,7 @@ OUString SAL_CALL SfxBaseModel::getTitle() { try { ::ucbhelper::Content aContent( pMedium->GetName(), -Reference(), +utl::UCBContentHelper::getDefaultCommandEnvironment(), comphelper::getProcessComponentContext() ); const Reference < beans::XPropertySetInfo > xProps = aContent.getProperties(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit aaa3072313267c17fa30b56ea7e81e6ac00339c1 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Oct 16 10:09:44 2016 +0200 tdf#103274 (7): Add default XCommandEnvironment reference Change-Id: I734f673c54956daf7070bf3e8faeac5102bac01f Reviewed-on: https://gerrit.libreoffice.org/29992 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 23c4478..55bbf0a 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2628,7 +2628,7 @@ void SfxBaseModel::loadCmisProperties( ) try { ::ucbhelper::Content aContent( pMedium->GetName( ), -Reference(), +utl::UCBContentHelper::getDefaultCommandEnvironment(), comphelper::getProcessComponentContext() ); Reference < beans::XPropertySetInfo > xProps = aContent.getProperties(); OUString aCmisProps( "CmisProperties" ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4009470eca063b7001941cc21580617f0288298c Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Oct 16 10:05:42 2016 +0200 tdf#103274 (6): Add default XCommandEnvironment reference Change-Id: I71d83f1094800c3156f9159b6628e4d53d723b95 Reviewed-on: https://gerrit.libreoffice.org/29991 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 0381dc0..23c4478 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2582,7 +2582,7 @@ bool SfxBaseModel::getBoolPropertyValue( const OUString& rName ) throw ( Runtime try { ::ucbhelper::Content aContent( pMedium->GetName( ), -Reference(), +utl::UCBContentHelper::getDefaultCommandEnvironment(), comphelper::getProcessComponentContext() ); Reference < beans::XPropertySetInfo > xProps = aContent.getProperties(); if ( xProps->hasPropertyByName( rName ) ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/objstor.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 296f8a579181a4ad0555e2e5eaa84db3ec2fafd1 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Oct 16 10:00:21 2016 +0200 tdf#103274 (5): Add default XCommandEnvironment reference Change-Id: I77e89d1250499687c6fadc4408c1bed409f8b167 Reviewed-on: https://gerrit.libreoffice.org/29982 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 4b6ea84..46fca81 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1703,7 +1703,7 @@ bool SfxObjectShell::SaveTo_Impl { try { -::ucbhelper::Content aContent( rMedium.GetName(), css::uno::Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() ); +::ucbhelper::Content aContent( rMedium.GetName(), utl::UCBContentHelper::getDefaultCommandEnvironment(), comphelper::getProcessComponentContext() ); css::uno::Reference < XPropertySetInfo > xProps = aContent.getProperties(); if ( xProps.is() ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/objstor.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 75ab2019a577813bcca2cdbe6aae38187cb52b50 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Oct 16 09:36:28 2016 +0200 tdf#103274 (4): Add default XCommandEnvironment reference Change-Id: I67ab0f37df9e8d239374d9a759f7c082b824c722 Reviewed-on: https://gerrit.libreoffice.org/29981 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index d4e82fa..4b6ea84 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -789,7 +789,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) try { -::ucbhelper::Content aContent( pMedium->GetName(), css::uno::Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() ); +::ucbhelper::Content aContent( pMedium->GetName(), utl::UCBContentHelper::getDefaultCommandEnvironment(), comphelper::getProcessComponentContext() ); css::uno::Reference < XPropertySetInfo > xProps = aContent.getProperties(); if ( xProps.is() ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: unotools/source
unotools/source/ucbhelper/ucbhelper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 50f08e87346f684666fce484f5b80f0189172366 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sat Oct 15 16:16:30 2016 +0200 tdf#103274 (3): Add default XCommandEnvironment reference Change-Id: I0a3d8fbea1143c3f7fee6f9f3cbdfc24399090ed Reviewed-on: https://gerrit.libreoffice.org/29980 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index 271a330..93ad0a67 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -78,7 +78,7 @@ ucbhelper::Content content(OUString const & url) { ucbhelper::Content content(INetURLObject const & url) { return ucbhelper::Content( url.GetMainURL(INetURLObject::NO_DECODE), -css::uno::Reference(), +utl::UCBContentHelper::getDefaultCommandEnvironment(), comphelper::getProcessComponentContext()); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/CppunitTest_sc_annotationshapeobj.mk sc/CppunitTest_sc_check_data_pilot_field.mk sc/CppunitTest_sc_check_data_pilot_table.mk sc/CppunitTest_sc_check_xcell_ranges_que
sc/CppunitTest_sc_annotationshapeobj.mk |1 + sc/CppunitTest_sc_check_data_pilot_field.mk |1 + sc/CppunitTest_sc_check_data_pilot_table.mk |1 + sc/CppunitTest_sc_check_xcell_ranges_query.mk |1 + sc/CppunitTest_sc_editfieldobj_cell.mk|1 + sc/CppunitTest_sc_editfieldobj_header.mk |1 + sc/CppunitTest_sc_viewpaneobj.mk |1 + unotools/source/ucbhelper/ucbhelper.cxx |2 +- 8 files changed, 8 insertions(+), 1 deletion(-) New commits: commit 1c304b206e77f19fcca2cf61a854100c28196e7b Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Oct 16 10:17:55 2016 +0200 tdf#103274: Add default XCommandEnvironment reference Change-Id: I4c9e4945e9fd4bb4fc2fe29e5a2a800cc5f298ae Reviewed-on: https://gerrit.libreoffice.org/29966 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sc/CppunitTest_sc_annotationshapeobj.mk b/sc/CppunitTest_sc_annotationshapeobj.mk index 382614f..b2bbd9d 100644 --- a/sc/CppunitTest_sc_annotationshapeobj.mk +++ b/sc/CppunitTest_sc_annotationshapeobj.mk @@ -95,6 +95,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_annotationshapeobj,\ unotools/util/utl \ unoxml/source/rdf/unordf \ unoxml/source/service/unoxml \ +uui/util/uui \ xmloff/util/xo \ svtools/util/svt \ )) diff --git a/sc/CppunitTest_sc_check_data_pilot_field.mk b/sc/CppunitTest_sc_check_data_pilot_field.mk index 06db60a..6f1e631 100644 --- a/sc/CppunitTest_sc_check_data_pilot_field.mk +++ b/sc/CppunitTest_sc_check_data_pilot_field.mk @@ -95,6 +95,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_check_data_pilot_field,\ unotools/util/utl \ unoxml/source/rdf/unordf \ unoxml/source/service/unoxml \ +uui/util/uui \ svtools/util/svt \ )) diff --git a/sc/CppunitTest_sc_check_data_pilot_table.mk b/sc/CppunitTest_sc_check_data_pilot_table.mk index fe6d588..e536dfe 100644 --- a/sc/CppunitTest_sc_check_data_pilot_table.mk +++ b/sc/CppunitTest_sc_check_data_pilot_table.mk @@ -95,6 +95,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_check_data_pilot_table,\ unotools/util/utl \ unoxml/source/rdf/unordf \ unoxml/source/service/unoxml \ +uui/util/uui \ svtools/util/svt \ )) diff --git a/sc/CppunitTest_sc_check_xcell_ranges_query.mk b/sc/CppunitTest_sc_check_xcell_ranges_query.mk index aee68d9..afbd184 100644 --- a/sc/CppunitTest_sc_check_xcell_ranges_query.mk +++ b/sc/CppunitTest_sc_check_xcell_ranges_query.mk @@ -92,6 +92,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_check_xcell_ranges_query,\ unotools/util/utl \ unoxml/source/rdf/unordf \ unoxml/source/service/unoxml \ +uui/util/uui \ svtools/util/svt \ )) diff --git a/sc/CppunitTest_sc_editfieldobj_cell.mk b/sc/CppunitTest_sc_editfieldobj_cell.mk index bca3a58..c7395ee 100644 --- a/sc/CppunitTest_sc_editfieldobj_cell.mk +++ b/sc/CppunitTest_sc_editfieldobj_cell.mk @@ -94,6 +94,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_editfieldobj_cell,\ unotools/util/utl \ unoxml/source/rdf/unordf \ unoxml/source/service/unoxml \ +uui/util/uui \ svtools/util/svt \ )) diff --git a/sc/CppunitTest_sc_editfieldobj_header.mk b/sc/CppunitTest_sc_editfieldobj_header.mk index 78930d7..5097f4f 100644 --- a/sc/CppunitTest_sc_editfieldobj_header.mk +++ b/sc/CppunitTest_sc_editfieldobj_header.mk @@ -94,6 +94,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_editfieldobj_header,\ unotools/util/utl \ unoxml/source/rdf/unordf \ unoxml/source/service/unoxml \ +uui/util/uui \ svtools/util/svt \ )) diff --git a/sc/CppunitTest_sc_viewpaneobj.mk b/sc/CppunitTest_sc_viewpaneobj.mk index 33a360c..cde890c 100644 --- a/sc/CppunitTest_sc_viewpaneobj.mk +++ b/sc/CppunitTest_sc_viewpaneobj.mk @@ -98,6 +98,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_viewpaneobj,\ unotools/util/utl \ unoxml/source/rdf/unordf \ unoxml/source/service/unoxml \ +uui/util/uui \ xmloff/util/xo \ svtools/util/svt \ )) diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index aa751b6..271a330 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -71,7 +71,7 @@ OUString canonic(OUString const & url) { ucbhelper::Content content(OUString const & url) { return ucbhelper::Content( canonic(url), -css::uno::Reference(), +utl::UCBContentHelper::getDefaultCommandEnvironment(), comphelper::getProcessComponentContext()); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source
include/unotools/ucbhelper.hxx | 30 ++ sfx2/source/doc/docfile.cxx |7 +-- unotools/source/ucbhelper/ucbhelper.cxx | 18 ++ 3 files changed, 53 insertions(+), 2 deletions(-) New commits: commit 26c99e42db233e375a007c49e1e903359caa1ce3 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sat Oct 15 16:21:42 2016 +0200 tdf#103274: Add helper for a default XCommandEnvironment reference. This helper should be used where the empty XCommandEnvironment e.g. something like: css::uno::Reference< css::ucb::XCommandEnvironment >() is currently used. See comment in the committed code (include/unotools/ucbhelper.hxx) for details. A case use is presented in this commit, please see: sfx2/source/doc/docfile.cxx for details. Change-Id: Ieb97c0ed61f31ef8df532c8be0e7ff1035327915 Reviewed-on: https://gerrit.libreoffice.org/29927 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/include/unotools/ucbhelper.hxx b/include/unotools/ucbhelper.hxx index 1777a40..653d828 100644 --- a/include/unotools/ucbhelper.hxx +++ b/include/unotools/ucbhelper.hxx @@ -80,6 +80,36 @@ UNOTOOLS_DLLPUBLIC bool IsSubPath( UNOTOOLS_DLLPUBLIC bool EqualURLs( OUString const & url1, OUString const & url2); +/** +* Returns a default XCommandEnvironment to be used +* when creating a ucbhelper::Content. +* +* Due to the way the WebDAV UCP provider works, an interaction handler +* is always needed: +* 1) to activate the credential dialog or to provide the cached credentials +* whenever the server requests them; +* +* 2) in case of ssl connection (https) to activate the dialog to show the +* certificate if said certificate looks wrong or dubious. +* +* This helper provides the XCommandEnvironment with an interaction +* handler that intercepts: +* 1) css::ucb::AuthenticationRequest() +* 2) css::ucb::CertificateValidationRequest() +* 3) css::ucb::InteractiveIOException() +* 4) css::ucb::UnsupportedDataSinkException() +* +* Exception 1) and 2) will be passed to the UI handler, e.g. shown to +* the user for interaction. +* +* Exception 3) and 4) will be have a default 'Abort' result. +* See comphelper::StillReadWriteInteraction for details. +* comphelper::StillReadWriteInteraction was introduced in +* commit bbe51f039dffca2506ea542feb78571b6358b981. +*/ +UNOTOOLS_DLLPUBLIC +css::uno::Reference< css::ucb::XCommandEnvironment > getDefaultCommandEnvironment(); + } } #endif diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 2179f82..e41f716 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -394,8 +394,11 @@ util::DateTime SfxMedium::GetInitFileDate( bool bIgnoreOldValue ) { try { -uno::Reference< css::ucb::XCommandEnvironment > xDummyEnv; -::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() ); +// add a default css::ucb::XCommandEnvironment +// in order to have the WebDAV UCP provider manage http/https authentication correctly +::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), + utl::UCBContentHelper::getDefaultCommandEnvironment(), + comphelper::getProcessComponentContext() ); aContent.getPropertyValue("DateModified") >>= pImpl->m_aDateTime; pImpl->m_bGotDateTime = true; diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index acbc63f..aa751b6 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -120,6 +122,22 @@ DateTime convert(css::util::DateTime const & dt) { } +css::uno::Reference< css::ucb::XCommandEnvironment > utl::UCBContentHelper::getDefaultCommandEnvironment() +{ +css::uno::Reference< css::task::XInteractionHandler > xIH( +css::task::InteractionHandler::createWithParent( +comphelper::getProcessComponentContext(), nullptr ) ); + +css::uno::Reference< css::ucb::XProgressHandler > xProgress; +ucbhelper::CommandEnvironment* pCommandEnv = +new ::ucbhelper::CommandEnvironment( +new comphelper::SimpleFileAccessInteraction( xIH ), xProgress ); + +css::uno::Reference < css::ucb::XCommandEnvironment > xEnv( +static_cast< css::ucb::XCommandEnvironment* >(pCommandEnv), css::uno::UNO_QUER
UCP providers: behavior of Content.getPropertyValue() implementation
Hi all, I wonder what would be the right behavior when implementing the code in Content.getPropertyValue(); specifically what should be the behavior when a client ask for a property of a resource served by the UCP provider and there is an error in retrieving the resource (resource doesn't exist, communication error, you name it...)? 1) return an empty property? 2) or throw an exception? Thanks. -- Kind Regards, Giuseppe Castagno Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: sw/source
sw/source/filter/ww8/ww8par5.cxx | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) New commits: commit f8857f30cbf7124ca01355f32998c11cb1843950 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Thu Oct 13 14:42:33 2016 +0200 Related: tdf#90700, fix the link validity check in ww8 sw filter As written, it would never have worked with http links. This function seems only used in DOC import documents. Change-Id: Ibc02f41245ea4c9e9155fc838e67404b34c5fa8f Reviewed-on: https://gerrit.libreoffice.org/29772 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 4868450..327368f 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -2328,10 +2328,21 @@ bool CanUseRemoteLink(const OUString ) ::ucbhelper::Content aCnt(rGrfName, static_cast< ucb::XCommandEnvironment* >(pCommandEnv), comphelper::getProcessComponentContext()); -OUString aTitle; -aCnt.getPropertyValue("Title") >>= aTitle; -bUseRemote = !aTitle.isEmpty(); +if ( !INetURLObject( rGrfName ).isAnyKnownWebDAVScheme() ) +{ +OUString aTitle; +aCnt.getPropertyValue("Title") >>= aTitle; +bUseRemote = !aTitle.isEmpty(); +} +else +{ +// is a link to a WebDAV resource +// need to use MediaType to check for link usability +OUString aMediaType; +aCnt.getPropertyValue("MediaType") >>= aMediaType; +bUseRemote = !aMediaType.isEmpty(); +} } catch ( ... ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/DAVException.hxx |4 ucb/source/ucp/webdav-neon/webdavcontent.cxx | 26 ++ 2 files changed, 30 insertions(+) New commits: commit 97cc70d7285526ae2ee3b3bac425eb031c4c0321 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Thu Oct 13 09:34:19 2016 +0200 tdf#102499 (7): Caching connect timeout or cannot connect. An unofficial HTTP response status code is defined and used internally in LibreOffice WebDAV ucp provider in order to catch either the DAVException::DAV_HTTP_TIMEOUT state or the DAVException::DAV_HTTP_CONNECT state. Change-Id: Iec4927d18ace5384fed16a7ec2a2620dc8305c5b Reviewed-on: https://gerrit.libreoffice.org/29757 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/DAVException.hxx b/ucb/source/ucp/webdav-neon/DAVException.hxx index 424445c..a7e57ca 100644 --- a/ucb/source/ucp/webdav-neon/DAVException.hxx +++ b/ucb/source/ucp/webdav-neon/DAVException.hxx @@ -101,6 +101,10 @@ const sal_uInt16 SC_HTTP_VERSION_NOT_SUPPORTED = 505; // DAV extensions (<https://tools.ietf.org/html/rfc4918#section-11>) const sal_uInt16 SC_INSUFFICIENT_STORAGE = 507; +// unofficial status codes only used internally by LO +// used to cache the connection time out event +const sal_uInt16 USC_CONNECTION_TIMED_OUT= 908; + class DAVException : public std::exception { diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index a292128..cd32145c12 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -3943,6 +3943,26 @@ 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 ) +{ +// behave same as DAVException::DAV_HTTP_TIMEOUT or DAVException::DAV_HTTP_CONNECT was thrown +try +{ +// extract host name and connection port +NeonUri theUri( rURL ); +OUString aHostName = theUri.GetHost(); +sal_Int32 nPort = theUri.GetPort(); +throw DAVException( DAVException::DAV_HTTP_TIMEOUT, +NeonUri::makeConnectionEndPointString( aHostName, + nPort ) ); +} +catch ( DAVException& exp ) +{ +cancelCommandExecution( exp, xEnv ); +} +} + if ( aDAVOptions.getHttpResponseStatusCode() != SC_NOT_FOUND && aDAVOptions.getHttpResponseStatusCode() != SC_GONE ) // the cached OPTIONS can have SC_GONE { @@ -4045,6 +4065,12 @@ void Content::getResourceOptions( // probably a new bit stating 'timed out' should be added to opts var? // in any case abort the command 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 ); +// used only internally, so the text doesn't really matter.. +aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, + m_nOptsCacheLifeNotFound ); cancelCommandExecution( e, xEnv ); // unreachable } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/qa ucb/source
ucb/qa/cppunit/webdav/webdav_options.cxx | 33 +++ ucb/source/ucp/webdav-neon/DAVTypes.cxx | 46 +++ ucb/source/ucp/webdav-neon/DAVTypes.hxx |7 ++-- ucb/source/ucp/webdav-neon/webdavcontent.cxx |6 +-- 4 files changed, 54 insertions(+), 38 deletions(-) New commits: commit 1ca68d386bc0345240bf288bec023faaba2e07af Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Tue Oct 11 15:21:23 2016 +0200 tdf#102499 (6): Cache OPTIONS if not present or if lifetime different Add the OPTIONS information and response status code into the cache: - if the OPTIONS information is already cached, update the cache only if the lifetime is different; - if the OPTIONS information is not cached, cache it. Add some new functions in DAVOptions to support the change and remove a function no longer used. Change-Id: I2f28f0ee793ec7d898caa61cc0a4962334e6e068 Reviewed-on: https://gerrit.libreoffice.org/29733 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx index 0dad7f8..ce3aba7 100644 --- a/ucb/qa/cppunit/webdav/webdav_options.cxx +++ b/ucb/qa/cppunit/webdav/webdav_options.cxx @@ -65,6 +65,7 @@ namespace CPPUNIT_ASSERT_EQUAL( true, aDavType.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavType.getRedirectedURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavType.getStaleTime() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavType.getRequestedTimeLife() ); CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavType.getHttpResponseStatusCode() ); CPPUNIT_ASSERT_EQUAL( true, aDavType.getHttpResponseStatusText().isEmpty() ); } @@ -83,6 +84,7 @@ namespace CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() ); @@ -97,6 +99,7 @@ namespace CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() ); @@ -111,6 +114,7 @@ namespace CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() ); @@ -125,6 +129,7 @@ namespace CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() ); @@ -142,6 +147,7 @@ namespace CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() ); CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() ); CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() ); @@ -158,6 +164,7 @@ namespace CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isLockAllowed() ); CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() ); CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); +CPPUNIT_ASSERT_EQ
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/DAVTypes.cxx | 77 -- ucb/source/ucp/webdav-neon/DAVTypes.hxx |5 + ucb/source/ucp/webdav-neon/NeonSession.cxx | 113 ++- ucb/source/ucp/webdav-neon/webdavcontent.cxx | 100 --- 4 files changed, 237 insertions(+), 58 deletions(-) New commits: commit 16df731a30917a426df81d751a0bfd0ae5fcdd45 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Mon Sep 12 20:59:09 2016 +0200 tdf#102499 (5): Deal with HTTP unofficial response status codes A reference can be found here: <https://en.wikipedia.org/wiki/List_of_HTTP_status_codes> (retrieved 2016-09-13). Changes done: Add set of 'HEAD method not available' before using fall back GET method. Add new method in OPTIONS cache. Add response status code if fall-back GET didn't succeeded. Add copy-assignement operator to DAVOptions. Fix behaviour of GET fall back when HEAD missing. Change-Id: I6aad0e22bb444abf37b90186588f64f79b03cc3d Reviewed-on: https://gerrit.libreoffice.org/29680 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.cxx b/ucb/source/ucp/webdav-neon/DAVTypes.cxx index 3e48752..1990289 100644 --- a/ucb/source/ucp/webdav-neon/DAVTypes.cxx +++ b/ucb/source/ucp/webdav-neon/DAVTypes.cxx @@ -34,7 +34,6 @@ DAVOptions::DAVOptions() : { } - DAVOptions::DAVOptions( const DAVOptions & rOther ) : m_isClass1( rOther.m_isClass1 ), m_isClass2( rOther.m_isClass2 ), @@ -50,11 +49,25 @@ DAVOptions::DAVOptions( const DAVOptions & rOther ) : { } - DAVOptions::~DAVOptions() { } +DAVOptions & DAVOptions::operator=( const DAVOptions& rOpts ) +{ +m_isClass1 = rOpts.m_isClass1; +m_isClass2 = rOpts.m_isClass2; +m_isClass3 = rOpts.m_isClass3; +m_isLocked = rOpts.m_isLocked; +m_isHeadAllowed = rOpts.m_isHeadAllowed; +m_aAllowedMethods = rOpts.m_aAllowedMethods; +m_nStaleTime = rOpts.m_nStaleTime; +m_sURL = rOpts.m_sURL; +m_sRedirectedURL = rOpts.m_sRedirectedURL; +m_nHttpResponseStatusCode = rOpts.m_nHttpResponseStatusCode; +m_sHttpResponseStatusText = rOpts.m_sHttpResponseStatusText; +return *this; +} bool DAVOptions::operator==( const DAVOptions& rOpts ) const { @@ -79,12 +92,10 @@ DAVOptionsCache::DAVOptionsCache() { } - DAVOptionsCache::~DAVOptionsCache() { } - bool DAVOptionsCache::getDAVOptions( const OUString & rURL, DAVOptions & rDAVOptions ) { osl::MutexGuard aGuard( m_aMutex ); @@ -113,7 +124,6 @@ bool DAVOptionsCache::getDAVOptions( const OUString & rURL, DAVOptions & rDAVOpt } } - void DAVOptionsCache::removeDAVOptions( const OUString & rURL ) { osl::MutexGuard aGuard( m_aMutex ); @@ -128,7 +138,6 @@ void DAVOptionsCache::removeDAVOptions( const OUString & rURL ) } } - void DAVOptionsCache::addDAVOptions( DAVOptions & rDAVOptions, const sal_uInt32 nLifeTime ) { osl::MutexGuard aGuard( m_aMutex ); @@ -149,6 +158,39 @@ void DAVOptionsCache::addDAVOptions( DAVOptions & rDAVOptions, const sal_uInt32 m_aTheCache[ aEncodedUrl ] = rDAVOptions; } +void DAVOptionsCache::updateCachedOption( DAVOptions & rDAVOptions, const sal_uInt32 nLifeTime ) +{ +osl::MutexGuard aGuard( m_aMutex ); +OUString aURL( rDAVOptions.getURL() ); + +OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( NeonUri::unescape( aURL ) ) ); +normalizeURLLastChar( aEncodedUrl ); +rDAVOptions.setURL( aEncodedUrl ); + +// unchanged, it may be used to access a server +OUString aRedirURL( rDAVOptions.getRedirectedURL() ); +rDAVOptions.setRedirectedURL( aRedirURL ); + +// check if already cached +DAVOptionsMap::iterator it; +it = m_aTheCache.find( aEncodedUrl ); +if ( it != m_aTheCache.end() ) +{ +DAVOptions = (*it).second; +// exists, set new staletime, only if remaining time is higher +TimeValue t1; +osl_getSystemTime( ); + +if ( ( opts.getStaleTime() - t1.Seconds ) > nLifeTime ) +{ +opts.setStaleTime( t1.Seconds + nLifeTime ); +} +// update relevant fields +opts.setHttpResponseStatusCode( rDAVOptions.getHttpResponseStatusCode() ); +opts.setHttpResponseStatusText( rDAVOptions.getHttpResponseStatusText() ); +} +} + sal_uInt16 DAVOptionsCache::getHttpResponseStatusCode( const OUString & rURL, OUString & rHttpResponseStatusText ) { osl::MutexGuard aGuard( m_aMutex ); @@ -174,6 +216,29 @@ sal_uInt16 DAVOptionsCache::getHttpResponseStatusCode( const OUString & rURL, OU return 0; } +void DAVOptionsCache::setHeadAllowed( const OUString & rURL, const bool HeadAllowed ) +{ +osl::MutexGuard aGuard( m_aMutex ); +OUString aEn
[Libreoffice-commits] core.git: sw/source
sw/source/filter/ww8/ww8par5.cxx | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) New commits: commit a9f820679a70ec3fc4fe4f43c8fed175b362d1fd Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Wed Oct 5 20:11:51 2016 +0200 Related: tdf#102499 (4), default css::ucb::XCommandEnvironment. Make use of a dedicated interaction wrapper to serve ssl certificates correctly. See comphelper::SimpleFileAccessInteraction for details. Change-Id: Id78cd3f21223a797791598459af32eeec3539f2a Reviewed-on: https://gerrit.libreoffice.org/29541 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 0466c6e..9416764 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -24,11 +24,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include @@ -37,6 +39,7 @@ #include #include +#include #include #include @@ -2313,9 +2316,18 @@ bool CanUseRemoteLink(const OUString ) bool bUseRemote = false; try { +// Related: tdf#102499, add a default css::ucb::XCommandEnvironment +// in order to have https protocol manage certificates correctly +uno::Reference< task::XInteractionHandler > xIH( + task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr)); + +uno::Reference< ucb::XProgressHandler > xProgress; +::ucbhelper::CommandEnvironment* pCommandEnv = + new ::ucbhelper::CommandEnvironment(new comphelper::SimpleFileAccessInteraction( xIH ), xProgress); + ::ucbhelper::Content aCnt(rGrfName, -uno::Reference< ucb::XCommandEnvironment >(), -comphelper::getProcessComponentContext() ); + static_cast< ucb::XCommandEnvironment* >(pCommandEnv), + comphelper::getProcessComponentContext()); OUString aTitle; aCnt.getPropertyValue("Title") >>= aTitle; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/qa ucb/source
ucb/qa/cppunit/webdav/webdav_options.cxx | 84 ++--- ucb/source/ucp/webdav-neon/DAVTypes.cxx | 30 +-- ucb/source/ucp/webdav-neon/DAVTypes.hxx | 38 ++-- ucb/source/ucp/webdav-neon/NeonSession.cxx |3 ucb/source/ucp/webdav-neon/webdavcontent.cxx | 241 +-- 5 files changed, 214 insertions(+), 182 deletions(-) New commits: commit f423a9d695814b1babf5f2c3f42821190adc7e53 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Sep 25 17:48:27 2016 +0200 tdf#102499 (3): Change caching model for HTTP response status code Instead of caching only a single status flag, now both the HTTP response status code and the message accompanying it are cached. Change-Id: If7352f6b0cb7c7dab6af3cede96647308baa5ce2 Reviewed-on: https://gerrit.libreoffice.org/29538 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx index 3718733..0dad7f8 100644 --- a/ucb/qa/cppunit/webdav/webdav_options.cxx +++ b/ucb/qa/cppunit/webdav/webdav_options.cxx @@ -55,7 +55,6 @@ namespace { // check if the class is at reset state // using accessors -CPPUNIT_ASSERT_EQUAL( false, aDavType.isResourceFound() ); CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass1() ); CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass2() ); CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass3() ); @@ -66,6 +65,8 @@ namespace CPPUNIT_ASSERT_EQUAL( true, aDavType.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavType.getRedirectedURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavType.getStaleTime() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavType.getHttpResponseStatusCode() ); +CPPUNIT_ASSERT_EQUAL( true, aDavType.getHttpResponseStatusText().isEmpty() ); } void webdav_opts_test::DAVTypesTest() @@ -73,22 +74,8 @@ namespace //our DAVOptions webdav_ucp::DAVOptions aDavOpt; DAVTypesCheckInit( aDavOpt ); -aDavOpt.setResourceFound(); -//recheck... -CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isResourceFound() ); -CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() ); -CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() ); -CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() ); -CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() ); -CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() ); -CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); -CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); -CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); -CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); -aDavOpt.setResourceFound( false ); aDavOpt.setClass1(); -CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass1() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() ); @@ -98,10 +85,11 @@ namespace CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() ); aDavOpt.setClass1( false ); aDavOpt.setClass2(); -CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass2() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() ); @@ -111,10 +99,11 @@ namespace CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() ); aDavOpt.setClass2( false ); aDavOpt.setClass3(); -CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass3() ); @@ -124,10 +113,11 @@ namespace CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); +CPPUNIT_ASSERT_EQ
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx | 21 +++ ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx | 13 ++-- ucb/source/ucp/webdav-neon/DAVSession.hxx|8 +++ ucb/source/ucp/webdav-neon/NeonSession.cxx | 61 +++ ucb/source/ucp/webdav-neon/NeonSession.hxx | 14 + ucb/source/ucp/webdav-neon/webdavcontent.cxx | 15 ++--- 6 files changed, 106 insertions(+), 26 deletions(-) New commits: commit f7697a633cd56003fcb1d86bee7eb658020af506 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Mon Oct 3 16:20:43 2016 +0200 tdf#101094 (36): Fix behaviour of GET in fetching Headers only Implement a better way to GET only headers, as HEAD method substitute. Wrote a new version of GET, specifically for 'no payload' service because sometimes neon was returning an internal error about: 'Compressed response was truncated' but without a specific error state. Change-Id: I84a3e5635193c3f68d335eba7af41b05980f4192 Reviewed-on: https://gerrit.libreoffice.org/29502 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx index 3f68591..db488b0 100644 --- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx @@ -497,7 +497,8 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( } -uno::Reference< io::XInputStream > DAVResourceAccess::GET( +// used as HEAD substitute when HEAD is not implemented on server +void DAVResourceAccess::GET0( DAVRequestHeaders , const std::vector< OUString > & rHeaderNames, DAVResource & rResource, @@ -519,14 +520,14 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( ucb::WebDAVHTTPMethod_GET, rRequestHeaders ); -xStream = m_xSession->GET( getRequestURI(), - rHeaderNames, - rResource, - DAVRequestEnvironment( - getRequestURI(), - new DAVAuthListener_Impl( - xEnv, m_aURL ), - rRequestHeaders, xEnv ) ); +m_xSession->GET0( getRequestURI(), + rHeaderNames, + rResource, + DAVRequestEnvironment( + getRequestURI(), + new DAVAuthListener_Impl( + xEnv, m_aURL ), + rRequestHeaders, xEnv ) ); } catch ( const DAVException & e ) { @@ -537,8 +538,6 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( } } while ( bRetry ); - -return xStream; } diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx index aed404f..47f0bd0 100644 --- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx +++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx @@ -134,12 +134,13 @@ public: const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) throw ( DAVException ); -css::uno::Reference< css::io::XInputStream > -GET( DAVRequestHeaders & rRequestHeaders, - const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all' - DAVResource & rResource, - const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) -throw ( DAVException ); +// used as HEAD substitute when HEAD is not implemented on server +void +GET0( DAVRequestHeaders & rRequestHeaders, + const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all' + DAVResource & rResource, + const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void GET( css::uno::Reference< css::io::XOutputStream > & rStream, diff --git a/ucb/source/ucp/webdav-neon/DAVSession.hxx b/ucb/source/ucp/webdav-neon/DAVSession.hxx index e6b7a1a..b251a78 100644 --- a/ucb/source/ucp/webdav-neon/DAVSession.hxx +++ b/ucb/source/ucp/webdav-neon/DAVSession.hxx @@ -123,6 +123,14 @@ public: const DAVRequestEnvironment & rEnv ) throw( std::exception ) = 0; +// used as HEAD substitute when HEAD is not implemented on server +virtual void +GET0( const OUString & inPath, + const std::vector< OUString > & inHeaderNames, +
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) New commits: commit 909b6b84944e17141109272d917dcf4887483e5a Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Oct 2 10:58:52 2016 +0200 tdf#101094 (35): Add OPTIONS as pre-check in direct WebDAV open() method The function call will act as a precheck on Web resource access error when accessing the open directly without the normal file open procedure, e.g. accessing Web resource property values first. An example of this direct open call are the extension fetching and the extension update check. Change-Id: I765a2fe29f432a07a649e5a35440ae351c681af9 Reviewed-on: https://gerrit.libreoffice.org/29454 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index e6153ff..8f0a83c 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -2292,7 +2292,15 @@ uno::Any Content::open( removeCachedPropertyNames( xResAccess->getURL() ); // check if the resource was present on the server -if( aStaticDAVOptionsCache.isResourceFound( aTargetURL ) ) +// first update it, if necessary +// if the open is called directly, without the default open sequence, +// e.g. the one used when opening a file looking for properties +// first this call will have no effect, since OPTIONS would have already been called +// as a consequence of getPropertyValues() +DAVOptions aDAVOptions; +getResourceOptions( xEnv, aDAVOptions, xResAccess ); + +if( aDAVOptions.isResourceFound() ) { uno::Reference< io::XInputStream > xIn = xResAccess->GET( aHeaders, aResource, xEnv ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/qa ucb/source
ucb/qa/cppunit/webdav/webdav_options.cxx | 78 ++--- ucb/source/ucp/webdav-neon/DAVTypes.cxx|1 ucb/source/ucp/webdav-neon/DAVTypes.hxx| 24 ucb/source/ucp/webdav-neon/NeonSession.cxx |2 4 files changed, 63 insertions(+), 42 deletions(-) New commits: commit d751af3f84909996d44b9354ce9ed34891d374e1 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sat Oct 1 12:35:57 2016 +0200 tdf#101094 (34): Fix test and missing field value in comparision operator Change-Id: I6be4a7861f2a978c260defd54dcbc8d124017439 Reviewed-on: https://gerrit.libreoffice.org/29431 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx index 924eaf9..3718733 100644 --- a/ucb/qa/cppunit/webdav/webdav_options.cxx +++ b/ucb/qa/cppunit/webdav/webdav_options.cxx @@ -27,7 +27,7 @@ namespace void tearDown( ) override; -void DAVTypesCheckReset( webdav_ucp::DAVOptions aDavType ); +void DAVTypesCheckInit( webdav_ucp::DAVOptions aDavType ); void DAVTypesTest(); void DAVOptsCacheTests(); @@ -51,7 +51,7 @@ namespace { } -void webdav_opts_test::DAVTypesCheckReset( webdav_ucp::DAVOptions aDavType ) +void webdav_opts_test::DAVTypesCheckInit( webdav_ucp::DAVOptions aDavType ) { // check if the class is at reset state // using accessors @@ -60,6 +60,7 @@ namespace CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass2() ); CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass3() ); CPPUNIT_ASSERT_EQUAL( false, aDavType.isLocked() ); +CPPUNIT_ASSERT_EQUAL( true, aDavType.isHeadAllowed() ); CPPUNIT_ASSERT_EQUAL( true, aDavType.getAllowedMethods().isEmpty() ); CPPUNIT_ASSERT_EQUAL( false, aDavType.isLockAllowed() ); CPPUNIT_ASSERT_EQUAL( true, aDavType.getURL().isEmpty() ); @@ -71,18 +72,19 @@ namespace { //our DAVOptions webdav_ucp::DAVOptions aDavOpt; -DAVTypesCheckReset( aDavOpt ); +DAVTypesCheckInit( aDavOpt ); aDavOpt.setResourceFound(); //recheck... CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isResourceFound() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() ); -CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); -CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); aDavOpt.setResourceFound( false ); aDavOpt.setClass1(); @@ -90,11 +92,12 @@ namespace CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass1() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() ); -CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); -CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); aDavOpt.setClass1( false ); aDavOpt.setClass2(); @@ -102,8 +105,12 @@ namespace CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() ); CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass2() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() ); -CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() ); CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() ); +CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() ); +CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() ); aDavOpt.setClass2( false ); aDavOpt.setClass3(); @@ -111,11 +118,12 @@ namespace CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() ); CPPUNIT_ASSERT_EQUAL( false
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/webdavcontent.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit c506954ce9a466fbc5204b3b5e2190ed907dfffe Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Sep 25 15:57:31 2016 +0200 tdf#101094 (33): Fix: use the correct exception Change-Id: I41e7cc0a1e176e44cb1b3fb87269eb6e052c6478 Reviewed-on: https://gerrit.libreoffice.org/29273 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index c141e26..e6153ff 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -1642,9 +1642,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( bError ) { -if ( !shouldAccessNetworkAfterException( e ) ) +if ( !shouldAccessNetworkAfterException( aLastException ) ) { -cancelCommandExecution( e, xEnv ); +cancelCommandExecution( aLastException, xEnv ); // unreachable } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/CppunitTest_ucb_webdav_res_access.mk ucb/Module_ucb.mk ucb/qa ucb/source
ucb/CppunitTest_ucb_webdav_res_access.mk | 55 ++ ucb/Module_ucb.mk|1 ucb/qa/cppunit/webdav/webdav_options.cxx |2 ucb/qa/cppunit/webdav/webdav_resource_access.cxx | 85 +++ ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx |5 - 5 files changed, 146 insertions(+), 2 deletions(-) New commits: commit e62c02a089e454eeea472e758e113e7e28568a02 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sat Sep 24 13:35:54 2016 +0200 tdf#102499 (1): Add WebDAV test to check HTTP reponse status codes retry Change-Id: I4ff36df3ac1cc0788322768378fb74f70892f922 Reviewed-on: https://gerrit.libreoffice.org/29245 Tested-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/CppunitTest_ucb_webdav_res_access.mk b/ucb/CppunitTest_ucb_webdav_res_access.mk new file mode 100644 index 000..ac48f87 --- /dev/null +++ b/ucb/CppunitTest_ucb_webdav_res_access.mk @@ -0,0 +1,55 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#* +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +#* + +$(eval $(call gb_CppunitTest_CppunitTest,ucb_webdav_res_access)) + +$(eval $(call gb_CppunitTest_use_api,ucb_webdav_res_access, \ + offapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,ucb_webdav_res_access, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + salhelper \ + test \ + ucbhelper \ +)) + +$(eval $(call gb_CppunitTest_use_library_objects,ucb_webdav_res_access, \ + ucpdav1 \ +)) + +$(eval $(call gb_CppunitTest_use_externals,ucb_webdav_res_access,\ + boost_headers \ + libxml2 \ + neon \ + openssl \ +)) + +$(eval $(call gb_CppunitTest_use_custom_headers,ucb_webdav_res_access,\ + officecfg/registry \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,ucb_webdav_res_access, \ +ucb/qa/cppunit/webdav/webdav_resource_access \ +)) + +$(eval $(call gb_CppunitTest_set_include,ucb_webdav_res_access,\ +$$(INCLUDE) \ +-I$(SRCDIR)/ucb/source/ucp/webdav-neon \ +)) + +$(eval $(call gb_CppunitTest_use_static_libraries,ucb_webdav_res_access)) + +# vim: set noet sw=4 ts=4: diff --git a/ucb/Module_ucb.mk b/ucb/Module_ucb.mk index 5fcd1e7..fca05b8 100644 --- a/ucb/Module_ucb.mk +++ b/ucb/Module_ucb.mk @@ -37,6 +37,7 @@ $(eval $(call gb_Module_add_check_targets,ucb,\ CppunitTest_ucb_webdav_local_neon \ CppunitTest_ucb_webdav_neon_opts \ CppunitTest_ucb_webdav_propfindcache \ +CppunitTest_ucb_webdav_res_access \ )) endif diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx index bad3adc..924eaf9 100644 --- a/ucb/qa/cppunit/webdav/webdav_options.cxx +++ b/ucb/qa/cppunit/webdav/webdav_options.cxx @@ -9,6 +9,8 @@ #include #include +#include "DAVResourceAccess.hxx" +#include "DAVException.hxx" #include "DAVTypes.hxx" namespace diff --git a/ucb/qa/cppunit/webdav/webdav_resource_access.cxx b/ucb/qa/cppunit/webdav/webdav_resource_access.cxx new file mode 100644 index 000..4097d9e --- /dev/null +++ b/ucb/qa/cppunit/webdav/webdav_resource_access.cxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include +#include "DAVResourceAccess.hxx" +#include "DAVException.hxx" + +using namespace webdav_ucp; + +namespace +{ + +class webdav_resource_access_test: public test::BootstrapFixture +{ + +public: +webdav_resource_access_test() : BootstrapFixture( true, true ) {} + +// initialise your test code values here. +void setUp() override; + +void tearDown() override; + +void DAVCheckRetries(); + +// Change the following lines only, if you add, remove or rename +// member functions of the current class, +// because these macros are need by auto register mechanism. + +CPPUNIT_TEST_SUITE( webdav_resource_access_test ); +CPPUNIT_TEST( DAVCheckRetries ); +CPPUNIT_TEST_SUITE_END(); +}; // class webdav_local_test + +// initialise your test code values here. +
[Libreoffice-qa] Requesting help to test bug 90700 (was reopened)
Hi all, testing bug 90700 after the reopening I discovered that a new proxy now sits in the middle of the communication link. It returns an unofficial HTTP error code, not yet managed by LO. See my comment <https://bugs.documentfoundation.org/show_bug.cgi?id=90700#c5>. To start working on the problem I'd like to have a confirmation. Thanks. -- Kind Regards, Giuseppe Castagno aka beppec56 Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ List Name: Libreoffice-qa mailing list Mail address: Libreoffice-qa@lists.freedesktop.org Change settings: https://lists.freedesktop.org/mailman/listinfo/libreoffice-qa Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://lists.freedesktop.org/archives/libreoffice-qa/
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/DAVTypes.cxx | 29 + ucb/source/ucp/webdav-neon/DAVTypes.hxx |8 +++ ucb/source/ucp/webdav-neon/webdavcontent.cxx | 56 +++ ucb/source/ucp/webdav-neon/webdavcontent.hxx |3 - 4 files changed, 88 insertions(+), 8 deletions(-) New commits: commit 2a148e2b5ea11fd371042e836fa95438ffa738e7 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sat Aug 27 17:31:06 2016 +0200 tdf#101094 (32): Use a partial GET as a fall-back for HEAD... ... partial GET means a GET with no data returned, to test for resource 'real' availability in case HEAD fails or is disabled. At the same time disable use of HEAD method on the resource for the whole access procedure. This change is needed to manage web servers that don't permit the use of either HEAD or OPTIONS methods. To accomodate pure web sites that enable only GET to fetch contents. Change-Id: If52316ddd6ce637fb7d2ef518423de246ee2dcfb Reviewed-on: https://gerrit.libreoffice.org/28992 Tested-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.cxx b/ucb/source/ucp/webdav-neon/DAVTypes.cxx index af1079c..8756994 100644 --- a/ucb/source/ucp/webdav-neon/DAVTypes.cxx +++ b/ucb/source/ucp/webdav-neon/DAVTypes.cxx @@ -24,6 +24,7 @@ DAVOptions::DAVOptions() : m_isClass1( false ), m_isClass2( false ), m_isClass3( false ), +m_isHeadAllowed( true ), m_isLocked( false ), m_aAllowedMethods(), m_nStaleTime( 0 ), @@ -38,6 +39,7 @@ DAVOptions::DAVOptions( const DAVOptions & rOther ) : m_isClass1( rOther.m_isClass1 ), m_isClass2( rOther.m_isClass2 ), m_isClass3( rOther.m_isClass3 ), +m_isHeadAllowed( rOther.m_isHeadAllowed ), m_isLocked( rOther.m_isLocked ), m_aAllowedMethods( rOther.m_aAllowedMethods ), m_nStaleTime( rOther.m_nStaleTime ), @@ -173,5 +175,32 @@ bool DAVOptionsCache::isResourceFound( const OUString & rURL ) return true; } +bool DAVOptionsCache::isHeadAllowed( const OUString & rURL ) +{ +osl::MutexGuard aGuard( m_aMutex ); +OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( NeonUri::unescape( rURL ) ) ); +normalizeURLLastChar( aEncodedUrl ); + +DAVOptionsMap::iterator it; +it = m_aTheCache.find( aEncodedUrl ); +if ( it != m_aTheCache.end() ) +{ +// first check for stale +TimeValue t1; +osl_getSystemTime( ); +if( (*it).second.getStaleTime() < t1.Seconds ) +{ +m_aTheCache.erase( it ); +return true; // to force again OPTIONS method +} + +// check if the resource was present on server +return (*it).second.isHeadAllowed(); +} +// this value is needed because some web server don't implement +// OPTIONS method, so the resource is considered found, +// until detected otherwise +return true; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.hxx b/ucb/source/ucp/webdav-neon/DAVTypes.hxx index 53bc739..037e68f 100644 --- a/ucb/source/ucp/webdav-neon/DAVTypes.hxx +++ b/ucb/source/ucp/webdav-neon/DAVTypes.hxx @@ -81,6 +81,8 @@ namespace webdav_ucp boolm_isClass1; boolm_isClass2; boolm_isClass3; +// for server that do not implement it +boolm_isHeadAllowed; // Internally used to maintain locked stated of the resource, only // if it's a Class 2 resource boolm_isLocked; @@ -111,6 +113,9 @@ namespace webdav_ucp bool isClass3() { return m_isClass3; }; void setClass3( bool Class3 = true ) { m_isClass3 = Class3; }; +bool isHeadAllowed() { return m_isHeadAllowed; }; +void setHeadAllowed( bool HeadAllowed = true ) { m_isHeadAllowed = HeadAllowed; }; + sal_uInt32 getStaleTime() const { return m_nStaleTime ; }; void setStaleTime( const sal_uInt32 nStaleTime ) { m_nStaleTime = nStaleTime; }; @@ -133,6 +138,7 @@ namespace webdav_ucp m_isClass1 = false; m_isClass2 = false; m_isClass3 = false; +m_isHeadAllowed = true; m_isLocked = false; m_aAllowedMethods.clear(); m_nStaleTime = 0; @@ -177,6 +183,8 @@ namespace webdav_ucp */ bool isResourceFound( const OUString & rURL ); +bool isHeadAllowed( const OUString & rURL ); + private: /// remove the last '/' in aUrl, if it exists diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index be32582..a5d6406 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/web
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx | 45 ++ ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx |7 + ucb/source/ucp/webdav-neon/webdavcontent.cxx | 155 ++- 3 files changed, 202 insertions(+), 5 deletions(-) New commits: commit 827cc09948c09d934dd32ca1867252618f761eab Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Fri Aug 26 19:40:33 2016 +0200 Related: tdf#101094 (31): Add a simulated HEAD method: use GET Some server have HEAD method disabled or not implemented. So we can use GET with no data, retrieving only the header info. The implementing code comes from LO WebDAV serf implementation. Change-Id: I3b3d81f5a07232c4f1647888685e820939bc978c Reviewed-on: https://gerrit.libreoffice.org/28982 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx index 026186d..0cf396d 100644 --- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx @@ -497,6 +497,51 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( } +uno::Reference< io::XInputStream > DAVResourceAccess::GET( +DAVRequestHeaders , +const std::vector< OUString > & rHeaderNames, +DAVResource & rResource, +const uno::Reference< ucb::XCommandEnvironment > & xEnv ) + throw( DAVException ) +{ +initialize(); + +uno::Reference< io::XInputStream > xStream; +int errorCount = 0; +bool bRetry; +do +{ +bRetry = false; +try +{ +getUserRequestHeaders( xEnv, + getRequestURI(), + ucb::WebDAVHTTPMethod_GET, + rRequestHeaders ); + +xStream = m_xSession->GET( getRequestURI(), + rHeaderNames, + rResource, + DAVRequestEnvironment( + getRequestURI(), + new DAVAuthListener_Impl( + xEnv, m_aURL ), + rRequestHeaders, xEnv ) ); +} +catch ( const DAVException & e ) +{ +errorCount++; +bRetry = handleException( e, errorCount ); +if ( !bRetry ) +throw; +} +} +while ( bRetry ); + +return xStream; +} + + void DAVResourceAccess::GET( uno::Reference< io::XOutputStream > & rStream, const std::vector< OUString > & rHeaderNames, diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx index 96b308d..f2fa411 100644 --- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx +++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx @@ -134,6 +134,13 @@ public: const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) throw ( DAVException ); +css::uno::Reference< css::io::XInputStream > +GET( DAVRequestHeaders & rRequestHeaders, + const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all' + DAVResource & rResource, + const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) +throw ( DAVException ); + void GET( css::uno::Reference< css::io::XOutputStream > & rStream, const std::vector< OUString > & rHeaderNames, // empty == 'all' diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 099b7e2..be32582 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -93,6 +93,121 @@ using namespace com::sun::star; using namespace webdav_ucp; +namespace +{ +// implement a GET to substitute HEAD, when HEAD not available +void lcl_sendPartialGETRequest( bool , + DAVException , + const std::vector< rtl::OUString >& rProps, + std::vector< rtl::OUString > , + const std::unique_ptr< DAVResourceAccess > , + std::unique_ptr< ContentProperties > , + const uno::Reference< ucb::XCommandEnvironment >& xEnv ) +{ +bool bIsRequestSize = false; +DAVResource aResource; +DAVRequestHeaders aPartialGet; +aPartialGet.push_back( DAVRequestHeader( OUString( &q
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) New commits: commit e137caed30052359783f2b112eee72553be1bd4f Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Mon Sep 12 22:01:37 2016 +0200 tdf#101094 (30): Better explanation of OPTIONS errors in debug build Change-Id: Iea0eef5d3cd67c73325eb7af883ef8ce286187cd Reviewed-on: https://gerrit.libreoffice.org/28850 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index f204f2a..099b7e2 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -3875,13 +3875,14 @@ void Content::getResourceOptions( // not same as not found, this instead happens when the server does'n exist or does'n aswer at all // probably a new bit stating 'timed out' should be added to opts var? // in any case abort the command +SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException: DAV_HTTP_TIMEOUT or DAV_HTTP_CONNECT for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); cancelCommandExecution( e, xEnv ); // unreachable } break; case DAVException::DAV_HTTP_AUTH: { -SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException Authentication error for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException: DAV_HTTP_AUTH for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); // - the remote site is a WebDAV with special configuration: read/only for read operations // and read/write for write operations, the user is not allowed to lock/write and // she cancelled the credentials request. @@ -3895,7 +3896,7 @@ void Content::getResourceOptions( { case SC_FORBIDDEN: { -SAL_WARN( "ucb.ucp.webdav","OPTIONS - Forbidden for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +SAL_WARN( "ucb.ucp.webdav","OPTIONS - SC_FORBIDDEN for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); rDAVOptions.setResourceFound(); // it may exists, will be checked by HEAD or GET method, surely it's not DAV // cache it, so OPTIONS won't be called again, this URL does not support it aStaticDAVOptionsCache.addDAVOptions( rDAVOptions, @@ -3904,7 +3905,7 @@ void Content::getResourceOptions( break; case SC_BAD_REQUEST: { -SAL_WARN( "ucb.ucp.webdav","OPTIONS - Bad request for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +SAL_WARN( "ucb.ucp.webdav","OPTIONS - SC_BAD_REQUEST for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); rDAVOptions.setResourceFound(); // it may exists, will be checked by HEAD or GET method, surely it's not DAV // cache it, so OPTIONS won't be called again, this URL does not support it aStaticDAVOptionsCache.addDAVOptions( rDAVOptions, @@ -3916,7 +3917,7 @@ void Content::getResourceOptions( { // OPTIONS method must be implemented in DAV // resource is NON_DAV, or not advertising it -SAL_WARN( "ucb.ucp.webdav","OPTIONS - Method not implemented or not allowed for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); +SAL_WARN( "ucb.ucp.webdav","OPTIONS - SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED for URL <" << m_xIdentifier->getContentIdentifier() << ">" ); rDAVOptions.setResourceFound(); // means it exists, but it's not DAV // cache it, so OPTIONS won't be called again, this URL does not support it aStaticDAVOptionsCache.addDAVOptions( rDAVOptions, @@ -3936,
[Libreoffice-commits] core.git: sw/source
sw/source/filter/html/htmlatr.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c36489be617be3e8ca25612d29afb221bc7ae6c1 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Sep 4 13:06:51 2016 +0200 loplugin:defaultparams: Default method parameter Change-Id: I79f9eefecc6389bbf288d2be6b13129cd8f467ef Reviewed-on: https://gerrit.libreoffice.org/28663 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 0eaf819..2d05d4b 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -304,7 +304,7 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem pItemSet->Set( pFormat->GetAttrSet() ); if( pReferenceFormat ) -SwHTMLWriter::SubtractItemSet( *pItemSet, pReferenceFormat->GetAttrSet(), true, true ); +SwHTMLWriter::SubtractItemSet( *pItemSet, pReferenceFormat->GetAttrSet(), true ); // delete ItemSet that is empty straight away. This will save work // later on ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: fpicker/source
fpicker/source/office/RemoteFilesDialog.cxx |9 - 1 file changed, 8 insertions(+), 1 deletion(-) New commits: commit 4e8e637374f8dad5439da39bd0c4b8b0b7c13cde Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sun Aug 28 16:07:24 2016 +0200 tdf#101766: Fix new folder creation in 'Save Remote Server' dialog. Change-Id: I5297918ff6acf0631b8be370de3ac96bed474a47 Reviewed-on: https://gerrit.libreoffice.org/28458 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 69ededf..59f7791 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -1073,7 +1073,14 @@ IMPL_LINK_NOARG_TYPED ( RemoteFilesDialog, NewFolderHdl, Button*, void ) { m_pFileView->EndInplaceEditing(); -SmartContent aContent( m_pFileView->GetViewURL() ); +// will be bound after InteractionHandler is enabled +SmartContent aContent; +aContent.enableDefaultInteractionHandler(); +// now it can be bound +aContent.bindTo( m_pFileView->GetViewURL() ); +if( !aContent.canCreateFolder() ) +return; + OUString aTitle; aContent.getTitle( aTitle ); ScopedVclPtrInstance< QueryFolderNameDialog > aDlg( this, aTitle, fpicker::SVT_RESSTR( STR_SVT_NEW_FOLDER ) ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) New commits: commit 4a70eac6045c4d3d5773ad0807dcde5a25391836 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Mon Aug 29 09:10:42 2016 +0200 WebDAV: Make some SAL_WARN log wording a bit better Change-Id: Ib854d1ac74e952c786136176899e533804eb1e61 Reviewed-on: https://gerrit.libreoffice.org/28459 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 411750d..f204f2a 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -3055,13 +3055,13 @@ Content::ResourceType Content::resourceTypeForLocks( case SC_METHOD_NOT_ALLOWED: // <http://tools.ietf.org/html/rfc7231#section-6.5.5> // they all mean the resource is NON_DAV SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() DAVException (SC_FORBIDDEN, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" - << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); + << m_xIdentifier->getContentIdentifier() << ">, DAV ExceptionCode: " << e.getError() << ", HTTP error: " << e.getStatus() ); eResourceTypeForLocks = NON_DAV; break; default: //fallthrough SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() DAVException - URL: <" - << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); + << m_xIdentifier->getContentIdentifier() << ">, DAV ExceptionCode: " << e.getError() << ", HTTP error: " << e.getStatus() ); eResourceTypeForLocks = UNKNOWN; } } @@ -3216,7 +3216,7 @@ void Content::lock( case SC_NOT_IMPLEMENTED:// <http://tools.ietf.org/html/rfc7231#section-6.6.2> case SC_METHOD_NOT_ALLOWED: // <http://tools.ietf.org/html/rfc7231#section-6.5.5> SAL_WARN( "ucb.ucp.webdav", "lock() DAVException (SC_NOT_FOUND, SC_PRECONDITION_FAILED, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" - << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); + << m_xIdentifier->getContentIdentifier() << ">, DAV ExceptionCode: " << e.getError() << ", HTTP error: " << e.getStatus() ); // act as nothing happened // that's because when a resource is first created // the lock is sent before the put, so the resource @@ -3246,7 +3246,7 @@ void Content::lock( } SAL_WARN( "ucb.ucp.webdav","lock() DAVException - URL: <" - << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); + << m_xIdentifier->getContentIdentifier() << ">, DAV ExceptionCode: " << e.getError() << ", HTTP error: " << e.getStatus() ); cancelCommandExecution( e, Environment ); // Unreachable } @@ -3309,7 +3309,7 @@ void Content::unlock( case SC_NOT_IMPLEMENTED:// <http://tools.ietf.org/html/rfc7231#section-6.6.2> case SC_METHOD_NOT_ALLOWED: // <http://tools.ietf.org/html/rfc7231#section-6.5.5> SAL_WARN( "ucb.ucp.webdav", "unlock() DAVException (SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" - << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); +
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/PropfindCache.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f37fd4e2b47c7ffe81cd76db72b012a1210c1d1b Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Mon Aug 29 11:10:59 2016 +0200 cppcheck: noExplicitConstructor Change-Id: Ifa588c37added377d753cb7b32a6f1e6a3672c94 Reviewed-on: https://gerrit.libreoffice.org/28453 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/PropfindCache.hxx b/ucb/source/ucp/webdav-neon/PropfindCache.hxx index 1415a63..f01e652 100644 --- a/ucb/source/ucp/webdav-neon/PropfindCache.hxx +++ b/ucb/source/ucp/webdav-neon/PropfindCache.hxx @@ -41,7 +41,7 @@ namespace webdav_ucp public: PropertyNames(); -PropertyNames( const OUString& rURL ); +explicit PropertyNames( const OUString& rURL ); PropertyNames( const PropertyNames& theOther ); virtual ~PropertyNames(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 42 +++ ucb/source/ucp/webdav-neon/webdavcontent.hxx |3 + 2 files changed, 40 insertions(+), 5 deletions(-) New commits: commit e0d0d87257d62ac61377a73909e17753f96e7aaa Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sat Aug 27 12:29:21 2016 +0200 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. Change-Id: Ifd6df0ea4b89824133e212f73950d6c3acd00dd7 Reviewed-on: https://gerrit.libreoffice.org/28430 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 598a33f..411750d 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -35,7 +35,7 @@ #include #include -#include "osl/doublecheckedlocking.h" +#include #include #include #include @@ -58,9 +58,9 @@ #include #include #include -#include "com/sun/star/ucb/InteractiveLockingLockedException.hpp" -#include "com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp" -#include "com/sun/star/ucb/InteractiveLockingNotLockedException.hpp" +#include +#include +#include #include #include #include @@ -3925,8 +3925,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; @@ -3977,4 +3986,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-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx index 55a25ae..d213440 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx @@ -328,6 +328,9 @@ public: DAVOptions& rDAVOptions ) throw ( css::uno::Exception, std::exception ); +static bool isResourceAvailable( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv, + const std::unique_ptr< DAVResourceAccess > & rResAccess); + static void removeCachedPropertyNames( const OUString & rURL ); }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/NeonSession.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 15f1721dcb8a0550a5f7db6c0bafd56e7b08ff39 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Fri Aug 26 16:26:29 2016 +0200 tdf#101094 (28): Put back the thread mutex guard... ...the one I wrongly removed in commit 72589082945e5a197f3fb4b884f48dd4ae275e5f Change-Id: I9f8e2f34a91b0fe481b1fe0f4655e3899a0589a6 Reviewed-on: https://gerrit.libreoffice.org/28412 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index b3f54e6..9c285c3 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -845,6 +845,8 @@ void NeonSession::OPTIONS( const OUString & inPath, const DAVRequestEnvironment & rEnv ) throw( std::exception ) { +osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "OPTIONS - relative URL <" << inPath << ">" ); rOptions.reset(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/NeonSession.cxx |9 + 1 file changed, 5 insertions(+), 4 deletions(-) New commits: commit 72589082945e5a197f3fb4b884f48dd4ae275e5f Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Fri Aug 26 10:03:21 2016 +0200 tdf#101094 (27): Add a mutex guard to OPTIONS neon dispatch calls This is a sort of follow up to commit: 510da29131e56ba0e1783e505e7131e6f7e0d6b4: "forced to make certain neon api calls thread-safe due to cups rhbz#637738 libgcrypt that's been initialized already by cups to be non-threadsafe is therefore then also non-threadsafe. neon uses libgcrypt. So in the (as this is the usual circumstance) case that cups is initialized before neon, then libgcrypt is not threadsafe even though neon attempt to initialize it as such." Change-Id: I1f868642ac15bf9fa25d3edd46390467d8fce1f5 Reviewed-on: https://gerrit.libreoffice.org/28401 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index 8fdab2f..b3f54e6 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -845,18 +845,19 @@ void NeonSession::OPTIONS( const OUString & inPath, const DAVRequestEnvironment & rEnv ) throw( std::exception ) { - -osl::Guard< osl::Mutex > theGuard( m_aMutex ); SAL_INFO( "ucb.ucp.webdav", "OPTIONS - relative URL <" << inPath << ">" ); rOptions.reset(); Init( rEnv ); +int theRetVal; ne_request *req = ne_request_create(m_pHttpSession, "OPTIONS", OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ).getStr()); - -int theRetVal = ne_request_dispatch(req); +{ +osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex ); +theRetVal = ne_request_dispatch(req); +} //check if http error is in the 200 class (no error) if (theRetVal == NE_OK && ne_get_status(req)->klass != 2) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: tdf#82677 and SID_* e.g. Slot IDs I think...
An update: On 08/22/2016 01:08 PM, Giuseppe Castagno wrote: Hi all, ... For WebDAV this gerrit <https://gerrit.libreoffice.org/#/c/28313/> fixes the bug, by simplifying thing a bit. Can someone have a look if it's all right (and if I'm not oversimplifying)? it turned out that <https://gerrit.libreoffice.org/#/c/28313/> introduced a performance regression on file access, so I opted instead for the cache solution in: <https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=98bd24f8b479132ca3f2d884749b738e9e6203e3>, <https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=00e1f840be4a1ff202d82377b3cbf233b352b1c3> and <https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=90ded4cbf1ffbde2ef7926fb225759896ef075bf> -- Kind Regards, Giuseppe Castagno aka beppec56 Acca Esse http://www.acca-esse.eu giuseppe.castagno at acca-esse.eu ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 29 +++ ucb/source/ucp/webdav-neon/webdavcontent.hxx |1 ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx |6 3 files changed, 36 insertions(+) New commits: commit 90ded4cbf1ffbde2ef7926fb225759896ef075bf Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Wed Aug 3 18:12:58 2016 +0200 Related: tdf#82677, remove cached element when appropriate Change-Id: I6f9e1218c2767ec69ca371c4f5a12c2f385c7363 Reviewed-on: https://gerrit.libreoffice.org/28275 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index bd97cb3..598a33f 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -567,6 +567,8 @@ uno::Any SAL_CALL Content::execute( xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); } aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); +// clean cached value of PROPFIND property names +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->DESTROY( Environment ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -855,6 +857,9 @@ void Content::addProperty( const ucb::PropertyCommandArgument& aCmdArg, xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); } aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); +// clean cached value of PROPFIND property names +// PROPPATCH can change them +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -946,6 +951,9 @@ void Content::removeProperty( const OUString& Name, xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); } aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); +// clean cached value of PROPFIND property names +// PROPPATCH can change them +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -1463,6 +1471,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( try { DAVResource resource; +// clean cached value of PROPFIND property names +// PROPPATCH can change them +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->HEAD( aHeaderNames, resource, xEnv ); m_bDidGetOrHead = true; @@ -1870,6 +1881,9 @@ uno::Sequence< uno::Any > Content::setPropertyValues( { try { +// clean cached value of PROPFIND property names +// PROPPATCH can change them +removeCachedPropertyNames( xResAccess->getURL() ); // Set property values at server. aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() ); xResAccess->PROPPATCH( aProppatchValues, xEnv ); @@ -1919,6 +1933,9 @@ uno::Sequence< uno::Any > Content::setPropertyValues( { targetURI.SetScheme( sourceURI.GetScheme() ); +// clean cached value of PROPFIND property names +removeCachedPropertyNames( sourceURI.GetURI() ); +removeCachedPropertyNames( targetURI.GetURI() ); aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() ); aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() ); xResAccess->MOVE( @@ -2078,6 +2095,7 @@ uno::Any Content::open( DAVResource aResource; std::vector< OUString > aHeaders; +removeCachedPropertyNames( xResAccess->getURL() ); xResAccess->GET( xOut, aHeaders, aResource, xEnv ); m_bDidGetOrHead = true; @@ -2124,6 +2142,7 @@ uno::Any Content::open( DAVResource aResource; std::vector< OUString > aHeaders; +removeCachedPropertyNames( xResAccess->getURL() ); // check if the resource was present on the server if( aStaticDAVOptionsCache.isResourceFound( aTargetURL ) ) { @@ -2227,6 +2246,7 @@ void Content::post( new DAVResourceAccess( *m_xResAccess.get() ) ); } +removeCachedPropertyNames( xRe
[Libreoffice-commits] core.git: ucb/source
ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) New commits: commit 00e1f840be4a1ff202d82377b3cbf233b352b1c3 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sat Aug 20 15:53:17 2016 +0200 Related: tdf#82677, add cache use in Content::getProperties() Change-Id: I47f583c808498aaf0f7cca1749fb5ef841ad10f3 Reviewed-on: https://gerrit.libreoffice.org/28274 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx index fec4b62..4e0ce71 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx @@ -282,6 +282,8 @@ bool ContentProvider::getProperty( } +static PropertyNamesCache aStaticPropertyNamesCache; + // Content implementation. @@ -321,7 +323,21 @@ uno::Sequence< beans::Property > Content::getProperties( try { std::vector< DAVResourceInfo > props; -xResAccess->PROPFIND( DAVZERO, props, xEnv ); +OUString aTheURL( xResAccess->getURL() ); +PropertyNames aPropsNames( aTheURL ); + +if( !aStaticPropertyNamesCache.getCachedPropertyNames( aTheURL, aPropsNames ) ) +{ + +xResAccess->PROPFIND( DAVZERO, props, xEnv ); +aPropsNames.setPropertiesNames( props ); + +aStaticPropertyNamesCache.addCachePropertyNames( aPropsNames, 10 ); +} +else +{ +props = aPropsNames.getPropertiesNames(); +} // Note: vector always contains exactly one resource info, because // we used a depth of DAVZERO for PROPFIND. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: ucb/CppunitTest_ucb_webdav_propfindcache.mk ucb/Library_ucpdav1.mk ucb/Module_ucb.mk ucb/qa ucb/source
ucb/CppunitTest_ucb_webdav_propfindcache.mk | 55 + ucb/Library_ucpdav1.mk |1 ucb/Module_ucb.mk|1 ucb/qa/cppunit/webdav/webdav_options.cxx |1 ucb/qa/cppunit/webdav/webdav_propfindcache.cxx | 136 +++ ucb/source/ucp/webdav-neon/DAVResource.hxx |5 ucb/source/ucp/webdav-neon/PropfindCache.cxx | 102 + ucb/source/ucp/webdav-neon/PropfindCache.hxx | 83 ++ ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx |1 9 files changed, 384 insertions(+), 1 deletion(-) New commits: commit 98bd24f8b479132ca3f2d884749b738e9e6203e3 Author: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> Date: Sat Aug 20 15:45:07 2016 +0200 Related: tdf#82677, implement a PROPFIND 'propname' request cache PROPFIND 'propname' is the special usage to retrieve all the properties available on the URI resource, their names only. See <https://tools.ietf.org/html/rfc4918#section-9.1> for PROPFIND 'propname' definition. Add cache usage in Content::getProperties as well. The caching model is simple: a simple lifetime limit of 10 seconds to declare the property name list stale and request another list, accessing the Net. This should reduce the number of PROPFIND calls on the Net. Change-Id: Ie4ebd946dd81583dc964a62c7744f3e2c716c737 Reviewed-on: https://gerrit.libreoffice.org/28273 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.casta...@acca-esse.eu> diff --git a/ucb/CppunitTest_ucb_webdav_propfindcache.mk b/ucb/CppunitTest_ucb_webdav_propfindcache.mk new file mode 100644 index 000..ebbaee7 --- /dev/null +++ b/ucb/CppunitTest_ucb_webdav_propfindcache.mk @@ -0,0 +1,55 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#* +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +#* + +$(eval $(call gb_CppunitTest_CppunitTest,ucb_webdav_propfindcache)) + +$(eval $(call gb_CppunitTest_use_api,ucb_webdav_propfindcache, \ + offapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,ucb_webdav_propfindcache, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + salhelper \ + test \ + ucbhelper \ +)) + +$(eval $(call gb_CppunitTest_use_library_objects,ucb_webdav_propfindcache, \ + ucpdav1 \ +)) + +$(eval $(call gb_CppunitTest_use_externals,ucb_webdav_propfindcache,\ + boost_headers \ + libxml2 \ + neon \ + openssl \ +)) + +$(eval $(call gb_CppunitTest_use_custom_headers,ucb_webdav_propfindcache,\ + officecfg/registry \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,ucb_webdav_propfindcache, \ +ucb/qa/cppunit/webdav/webdav_propfindcache \ +)) + +$(eval $(call gb_CppunitTest_set_include,ucb_webdav_propfindcache,\ +$$(INCLUDE) \ +-I$(SRCDIR)/ucb/source/ucp/webdav-neon \ +)) + +$(eval $(call gb_CppunitTest_use_static_libraries,ucb_webdav_propfindcache)) + +# vim: set noet sw=4 ts=4: diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk index 02e3681..88306db 100644 --- a/ucb/Library_ucpdav1.mk +++ b/ucb/Library_ucpdav1.mk @@ -53,6 +53,7 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\ ucb/source/ucp/webdav-neon/NeonPropFindRequest \ ucb/source/ucp/webdav-neon/NeonSession \ ucb/source/ucp/webdav-neon/NeonUri \ + ucb/source/ucp/webdav-neon/PropfindCache \ ucb/source/ucp/webdav-neon/UCBDeadPropertyValue \ ucb/source/ucp/webdav-neon/webdavcontentcaps \ ucb/source/ucp/webdav-neon/webdavcontent \ diff --git a/ucb/Module_ucb.mk b/ucb/Module_ucb.mk index e14c524..5fcd1e7 100644 --- a/ucb/Module_ucb.mk +++ b/ucb/Module_ucb.mk @@ -36,6 +36,7 @@ ifeq ($(WITH_WEBDAV),neon) $(eval $(call gb_Module_add_check_targets,ucb,\ CppunitTest_ucb_webdav_local_neon \ CppunitTest_ucb_webdav_neon_opts \ +CppunitTest_ucb_webdav_propfindcache \ )) endif diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx index 6c89623..bad3adc 100644 --- a/ucb/qa/cppunit/webdav/webdav_options.cxx +++ b/ucb/qa/cppunit/webdav/webdav_options.cxx @@ -11,7 +11,6 @@ #include #include "DAVTypes.hxx" - namespace { diff --git a/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx b/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx new file mode 100644 index 000..074f21d --- /dev/null +++ b/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx @@ -0,0 +1,136 @@ +/* -*- Mo