summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-08-27 12:29:21 +0200
committerGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-08-28 11:32:12 +0000
commite0d0d87257d62ac61377a73909e17753f96e7aaa (patch)
tree0d6dd2dd95d2bdd9530bffabe88e718e979e8d4f
parent0140d931e17a6392ead39a0250b2266fb6dfddf4 (diff)
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@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx42
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.hxx3
2 files changed, 40 insertions, 5 deletions
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 598a33f64b1a..411750d4e3e8 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 55a25ae80c9b..d213440e4778 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 );
};