diff options
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/Library_ucpdav1.mk | 4 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonSession.cxx | 26 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontent.cxx | 6 |
3 files changed, 32 insertions, 4 deletions
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk index f6e8a62c514c..37f3c8f0af9c 100644 --- a/ucb/Library_ucpdav1.mk +++ b/ucb/Library_ucpdav1.mk @@ -33,6 +33,10 @@ $(eval $(call gb_Library_use_externals,ucpdav1,\ openssl \ )) +$(eval $(call gb_Library_use_custom_headers,ucpdav1,\ + officecfg/registry \ +)) + $(eval $(call gb_Library_add_exception_objects,ucpdav1,\ ucb/source/ucp/webdav-neon/ContentProperties \ ucb/source/ucp/webdav-neon/DateTimeHelper \ diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index 61b3ce9eb103..41f956370952 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -60,6 +60,7 @@ extern "C" { #include "LinkSequence.hxx" #include "UCBDeadPropertyValue.hxx" +#include <officecfg/Inet.hxx> #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/security/XCertificate.hpp> #include <com/sun/star/security/CertificateValidity.hpp> @@ -691,6 +692,11 @@ void NeonSession::Init() if ( bCreateNewSession ) { + const sal_Int32 nConnectTimeoutMax = 180; + const sal_Int32 nConnectTimeoutMin = 2; + const sal_Int32 nReadTimeoutMax = 180; + const sal_Int32 nReadTimeoutMin = 20; + // @@@ For FTP over HTTP proxy inUserInfo is needed to be able to // build the complete request URI (including user:pass), but // currently (0.22.0) neon does not allow to pass the user info @@ -790,6 +796,26 @@ void NeonSession::Init() ne_set_server_auth( m_pHttpSession, NeonSession_NeonAuth, this ); ne_set_proxy_auth ( m_pHttpSession, NeonSession_NeonAuth, this ); #endif + // set timeout to connect + // if connect_timeout is not set, neon returns NE_CONNECT when the TCP socket default + // timeout elapses + // whith connect_timeout set neon returns NE_TIMEOUT if elapsed when the connection + // didn't succeed + // grab it from configuration + uno::Reference< uno::XComponentContext > rContext = m_xFactory->getComponentContext(); + + // set the timeout (in seconds) used when making a connection + sal_Int32 nConnectTimeout = officecfg::Inet::Settings::ConnectTimeout::get( rContext ); + ne_set_connect_timeout( m_pHttpSession, + (int) ( std::max( nConnectTimeoutMin, + std::min( nConnectTimeout, nConnectTimeoutMax ) ) ) ); + + // provides a read time out facility as well + // set the timeout (in seconds) used when reading from a socket. + sal_Int32 nReadTimeout = officecfg::Inet::Settings::ReadTimeout::get( rContext ); + ne_set_read_timeout( m_pHttpSession, + (int) ( std::max( nReadTimeoutMin, + std::min( nReadTimeout, nReadTimeoutMax ) ) ) ); } } diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 98d56e131bfa..d7fe64451b89 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -3294,6 +3294,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( @@ -3304,10 +3305,6 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite ) break; // @@@ No matching InteractiveNetwork*Exception -// case DAVException::DAV_HTTP_TIMEOUT: -// break; - -// @@@ No matching InteractiveNetwork*Exception // case DAVException::DAV_HTTP_REDIRECT: // break; @@ -3378,6 +3375,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 ) || |