[Libreoffice-commits] core.git: ucb/source
Giuseppe Castagno
giuseppe.castagno at acca-esse.eu
Sun Aug 28 11:32:37 UTC 2016
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.castagno at 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 <ci at libreoffice.org>
Reviewed-by: Giuseppe Castagno <giuseppe.castagno at 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 <comphelper/processfactory.hxx>
#include <osl/diagnose.h>
-#include "osl/doublecheckedlocking.h"
+#include <osl/doublecheckedlocking.h>
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
#include <officecfg/Inet.hxx>
@@ -58,9 +58,9 @@
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
#include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
-#include "com/sun/star/ucb/InteractiveLockingLockedException.hpp"
-#include "com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp"
-#include "com/sun/star/ucb/InteractiveLockingNotLockedException.hpp"
+#include <com/sun/star/ucb/InteractiveLockingLockedException.hpp>
+#include <com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp>
+#include <com/sun/star/ucb/InteractiveLockingNotLockedException.hpp>
#include <com/sun/star/ucb/InteractiveNetworkConnectException.hpp>
#include <com/sun/star/ucb/InteractiveNetworkGeneralException.hpp>
#include <com/sun/star/ucb/InteractiveNetworkReadException.hpp>
@@ -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 );
};
More information about the Libreoffice-commits
mailing list