[Libreoffice-commits] core.git: officecfg/registry ucb/Library_ucpdav1.mk ucb/source
Giuseppe Castagno
giuseppe.castagno at acca-esse.eu
Wed Dec 16 06:35:46 PST 2015
officecfg/registry/schema/org/openoffice/Inet.xcs | 12 ++++++++++
ucb/Library_ucpdav1.mk | 4 +++
ucb/source/ucp/webdav-neon/NeonSession.cxx | 26 ++++++++++++++++++++++
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 6 +----
4 files changed, 44 insertions(+), 4 deletions(-)
New commits:
commit 14220052ef2b8675ee12aad63b0402f023d9760a
Author: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>
Date: Sat Nov 21 20:41:06 2015 +0100
Related tdf#90700 Add configuration for web connection timeout.
Currently the connection timeout is governed by operating system
default.
LO timeouts will be used in place of the TCP socket operating
system ones, only in operating system where this is currently
possible.
The timeouts to use can be changed in LO configuration:
'Tools > Options > Advanced > Expert Configuration'.
Propriety names are ConnectTimeout and ReadTimeout.
ConnectTimeout contains the timeout (in seconds) used when
making a connection (max 180 s, min 2 s, default 20 s).
ReadTimeout contains the timeout (in seconds) used when reading
from a socket (max 180 s, min 20 s, default 60 s).
Change-Id: Ide69ab137274c3bf71332b6e76666151ecac1f1e
Reviewed-on: https://gerrit.libreoffice.org/20195
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
Tested-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/officecfg/registry/schema/org/openoffice/Inet.xcs b/officecfg/registry/schema/org/openoffice/Inet.xcs
index e6c1f7b..f5dcc6a 100644
--- a/officecfg/registry/schema/org/openoffice/Inet.xcs
+++ b/officecfg/registry/schema/org/openoffice/Inet.xcs
@@ -151,6 +151,18 @@
</maxInclusive>
</constraints>
</prop>
+ <prop oor:name="ConnectTimeout" oor:type="xs:int" oor:nillable="false">
+ <info>
+ <desc>Specifies the timeout when first open a connection to a Web/WebDAV server. Time in seconds. Minimum allowed 5 sec maximum 180 sec.</desc>
+ </info>
+ <value>20</value>
+ </prop>
+ <prop oor:name="ReadTimeout" oor:type="xs:int" oor:nillable="false">
+ <info>
+ <desc>Specifies the timeout when waiting for data from a Web/WebDAV server. Time in seconds. Minimum allowed 20 sec maximum 180 sec.</desc>
+ </info>
+ <value>60</value>
+ </prop>
</group>
</component>
</oor:component-schema>
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index f6e8a62..37f3c8f 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 61b3ce9..41f9563 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 98d56e13..d7fe644 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 ) ||
More information about the Libreoffice-commits
mailing list