tdf#102499 (9): Fix eXo Platform WebDAV on 'Save Remote File'
Change-Id: I2d2aceed3804f653b79d48eeb02468fc77374eb7 Reviewed-on: https://gerrit.libreoffice.org/29884 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
This commit is contained in:
@@ -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
|
||||
|
@@ -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 )
|
||||
{
|
||||
*networkAccessAllowed = *networkAccessAllowed
|
||||
&& shouldAccessNetworkAfterException(e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DAVException::DAV_HTTP_AUTHPROXY:
|
||||
{
|
||||
SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException: DAV_HTTP_AUTHPROXY for URL <" << m_xIdentifier->getContentIdentifier() << ">" );
|
||||
aDAVOptions.setHttpResponseStatusCode( USC_AUTHPROXY_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_ERROR:
|
||||
@@ -4157,8 +4198,14 @@ void Content::getResourceOptions(
|
||||
nLifeTime = m_nOptsCacheLifeNotImpl;
|
||||
}
|
||||
else
|
||||
{
|
||||
SAL_WARN( "ucb.ucp.webdav", "OPTIONS - SC_NOT_FOUND for URL <" << m_xIdentifier->getContentIdentifier() << ">" );
|
||||
|
||||
if ( networkAccessAllowed != nullptr )
|
||||
{
|
||||
*networkAccessAllowed = *networkAccessAllowed
|
||||
&& shouldAccessNetworkAfterException(e);
|
||||
}
|
||||
}
|
||||
aStaticDAVOptionsCache.addDAVOptions( aDAVOptions,
|
||||
nLifeTime );
|
||||
}
|
||||
@@ -4192,6 +4239,23 @@ void Content::getResourceOptions(
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// check current response status code, perhaps we need to set networkAccessAllowed
|
||||
sal_uInt16 CachedResponseStatusCode = aDAVOptions.getHttpResponseStatusCode();
|
||||
if ( networkAccessAllowed != nullptr &&
|
||||
( ( CachedResponseStatusCode == SC_NOT_FOUND ) ||
|
||||
( CachedResponseStatusCode == SC_GONE ) ||
|
||||
( CachedResponseStatusCode == USC_CONNECTION_TIMED_OUT ) ||
|
||||
( CachedResponseStatusCode == USC_LOOKUP_FAILED ) ||
|
||||
( CachedResponseStatusCode == USC_AUTH_FAILED ) ||
|
||||
( CachedResponseStatusCode == USC_AUTHPROXY_FAILED )
|
||||
)
|
||||
)
|
||||
{
|
||||
*networkAccessAllowed = *networkAccessAllowed && false;
|
||||
}
|
||||
}
|
||||
rDAVOptions = aDAVOptions;
|
||||
}
|
||||
|
||||
|
@@ -320,7 +320,8 @@ public:
|
||||
// Use OPTIONS method to retrieve the type of the Web resource
|
||||
void 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 = nullptr)
|
||||
throw ( css::uno::Exception, std::exception );
|
||||
|
||||
static bool isResourceAvailable( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv,
|
||||
@@ -328,6 +329,7 @@ public:
|
||||
DAVOptions& rDAVOptions );
|
||||
|
||||
static void removeCachedPropertyNames( const OUString & rURL );
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user