summaryrefslogtreecommitdiffstats
path: root/ucb
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-10-14 17:13:20 +0200
committerGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-10-21 17:52:42 +0000
commit59d6d5579528a66e55b75987d2d959968db485a8 (patch)
treed822d9db81191942d9b2408c6585eb0b373ad169 /ucb
parenttdf#102499 (8): Return empty property when not present. (diff)
downloadcore-59d6d5579528a66e55b75987d2d959968db485a8.tar.gz
core-59d6d5579528a66e55b75987d2d959968db485a8.zip
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>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav-neon/DAVException.hxx5
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx74
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.hxx4
3 files changed, 77 insertions, 6 deletions
diff --git a/ucb/source/ucp/webdav-neon/DAVException.hxx b/ucb/source/ucp/webdav-neon/DAVException.hxx
index a7e57caa3603..c6f50a2733dc 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 00ccdb9cb0ed..96b86f720d2c 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 )
+ {
+ *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;
}
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
index 87adc3a9661b..f2a68d0df496 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
@@ -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 );
+
};
}