diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-17 11:18:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-18 07:41:51 +0100 |
commit | 5e69b3619d3a2b05930c5b8b8521d7f2938c709d (patch) | |
tree | 2bcfb4244223b7fe570e9b0bcee2f7dd3928e226 /ucb/source | |
parent | 1d097883541b9d244e50ced7fe49a4d7a0f65cfd (diff) |
loplugin:flatten in toolkit..writerfilter
Change-Id: I4da2a768b6b55869c3a3d6f8a8d50dc018709acd
Reviewed-on: https://gerrit.libreoffice.org/44865
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/package/pkguri.cxx | 277 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_uri.cxx | 151 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonSession.cxx | 203 |
3 files changed, 317 insertions, 314 deletions
diff --git a/ucb/source/ucp/package/pkguri.cxx b/ucb/source/ucp/package/pkguri.cxx index 96c238d6758f..95cb0b7d8874 100644 --- a/ucb/source/ucp/package/pkguri.cxx +++ b/ucb/source/ucp/package/pkguri.cxx @@ -60,171 +60,172 @@ static void normalize( OUString& rURL ) void PackageUri::init() const { // Already inited? - if ( !m_aUri.isEmpty() && m_aPath.isEmpty() ) + if ( m_aUri.isEmpty() || !m_aPath.isEmpty() ) + return; + + // Note: Maybe it's a re-init, setUri only resets m_aPath! + m_aPackage.clear(); + m_aParentUri.clear(); + m_aName.clear(); + m_aParam.clear(); + m_aScheme.clear(); + + // URI must match at least: <sheme>://<non_empty_url_to_file> + if ( m_aUri.getLength() < PACKAGE_URL_SCHEME_LENGTH + 4 ) { - // Note: Maybe it's a re-init, setUri only resets m_aPath! - m_aPackage.clear(); - m_aParentUri.clear(); - m_aName.clear(); - m_aParam.clear(); - m_aScheme.clear(); - - // URI must match at least: <sheme>://<non_empty_url_to_file> - if ( m_aUri.getLength() < PACKAGE_URL_SCHEME_LENGTH + 4 ) + // error, but remember that we did a init(). + m_aPath = "/"; + return; + } + + // Scheme must be followed by '://' + if ( ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH ] != ':' ) + || + ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 1 ] != '/' ) + || + ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 2 ] != '/' ) ) + { + // error, but remember that we did a init(). + m_aPath = "/"; + return; + } + + OUString aPureUri; + sal_Int32 nParam = m_aUri.indexOf( '?' ); + if( nParam >= 0 ) + { + m_aParam = m_aUri.copy( nParam ); + aPureUri = m_aUri.copy( 0, nParam ); + } + else + aPureUri = m_aUri; + + // Scheme is case insensitive. + m_aScheme = aPureUri.copy( + 0, PACKAGE_URL_SCHEME_LENGTH ).toAsciiLowerCase(); + + if ( m_aScheme == PACKAGE_URL_SCHEME || m_aScheme == PACKAGE_ZIP_URL_SCHEME ) + { + if ( m_aScheme == PACKAGE_ZIP_URL_SCHEME ) { - // error, but remember that we did a init(). - m_aPath = "/"; - return; + m_aParam += + ( !m_aParam.isEmpty() + ? OUString( "&purezip" ) + : OUString( "?purezip" ) ); } - // Scheme must be followed by '://' - if ( ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH ] != ':' ) - || - ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 1 ] != '/' ) - || - ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 2 ] != '/' ) ) + aPureUri = aPureUri.replaceAt( 0, + m_aScheme.getLength(), + m_aScheme ); + + sal_Int32 nStart = PACKAGE_URL_SCHEME_LENGTH + 3; + sal_Int32 nEnd = aPureUri.lastIndexOf( '/' ); + if ( nEnd == PACKAGE_URL_SCHEME_LENGTH + 3 ) { + // Only <scheme>:/// - Empty authority + // error, but remember that we did a init(). m_aPath = "/"; return; } - - OUString aPureUri; - sal_Int32 nParam = m_aUri.indexOf( '?' ); - if( nParam >= 0 ) + else if ( nEnd == ( aPureUri.getLength() - 1 ) ) { - m_aParam = m_aUri.copy( nParam ); - aPureUri = m_aUri.copy( 0, nParam ); - } - else - aPureUri = m_aUri; - - // Scheme is case insensitive. - m_aScheme = aPureUri.copy( - 0, PACKAGE_URL_SCHEME_LENGTH ).toAsciiLowerCase(); - - if ( m_aScheme == PACKAGE_URL_SCHEME || m_aScheme == PACKAGE_ZIP_URL_SCHEME ) - { - if ( m_aScheme == PACKAGE_ZIP_URL_SCHEME ) - { - m_aParam += - ( !m_aParam.isEmpty() - ? OUString( "&purezip" ) - : OUString( "?purezip" ) ); - } - - aPureUri = aPureUri.replaceAt( 0, - m_aScheme.getLength(), - m_aScheme ); - - sal_Int32 nStart = PACKAGE_URL_SCHEME_LENGTH + 3; - sal_Int32 nEnd = aPureUri.lastIndexOf( '/' ); - if ( nEnd == PACKAGE_URL_SCHEME_LENGTH + 3 ) + if ( aPureUri[ aPureUri.getLength() - 2 ] == '/' ) { - // Only <scheme>:/// - Empty authority + // Only <scheme>://// or <scheme>://<something> // error, but remember that we did a init(). m_aPath = "/"; return; } - else if ( nEnd == ( aPureUri.getLength() - 1 ) ) - { - if ( aPureUri[ aPureUri.getLength() - 2 ] == '/' ) - { - // Only <scheme>://// or <scheme>://<something> - // error, but remember that we did a init(). - m_aPath = "/"; - return; - } - - // Remove trailing slash. - aPureUri = aPureUri.copy( 0, nEnd ); - } + // Remove trailing slash. + aPureUri = aPureUri.copy( 0, nEnd ); + } - nEnd = aPureUri.indexOf( '/', nStart ); - if ( nEnd == -1 ) - { - // root folder. + nEnd = aPureUri.indexOf( '/', nStart ); + if ( nEnd == -1 ) + { + // root folder. - OUString aNormPackage = aPureUri.copy( nStart ); - normalize( aNormPackage ); + OUString aNormPackage = aPureUri.copy( nStart ); + normalize( aNormPackage ); - aPureUri = aPureUri.replaceAt( - nStart, aPureUri.getLength() - nStart, aNormPackage ); - m_aPackage - = ::ucb_impl::urihelper::decodeSegment( aNormPackage ); - m_aPath = "/"; - m_aUri = m_aUri.replaceAt( 0, - ( nParam >= 0 ) - ? nParam - : m_aUri.getLength(), aPureUri ); - - sal_Int32 nLastSlash = m_aPackage.lastIndexOf( '/' ); - if ( nLastSlash != -1 ) - m_aName = ::ucb_impl::urihelper::decodeSegment( - m_aPackage.copy( nLastSlash + 1 ) ); - else - m_aName - = ::ucb_impl::urihelper::decodeSegment( m_aPackage ); - } + aPureUri = aPureUri.replaceAt( + nStart, aPureUri.getLength() - nStart, aNormPackage ); + m_aPackage + = ::ucb_impl::urihelper::decodeSegment( aNormPackage ); + m_aPath = "/"; + m_aUri = m_aUri.replaceAt( 0, + ( nParam >= 0 ) + ? nParam + : m_aUri.getLength(), aPureUri ); + + sal_Int32 nLastSlash = m_aPackage.lastIndexOf( '/' ); + if ( nLastSlash != -1 ) + m_aName = ::ucb_impl::urihelper::decodeSegment( + m_aPackage.copy( nLastSlash + 1 ) ); else - { - m_aPath = aPureUri.copy( nEnd + 1 ); - - // Unexpected sequences of characters: - // - empty path segments - // - encoded slashes - // - parent folder segments ".." - // - current folder segments "." - if ( m_aPath.indexOf( "//" ) != -1 - || m_aPath.indexOf( "%2F" ) != -1 - || m_aPath.indexOf( "%2f" ) != -1 - || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, ".." ) - || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, "." ) ) - { - // error, but remember that we did a init(). - m_aPath = "/"; - return; - } - - OUString aNormPackage = aPureUri.copy( nStart, nEnd - nStart ); - normalize( aNormPackage ); - - aPureUri = aPureUri.replaceAt( - nStart, nEnd - nStart, aNormPackage ); - aPureUri = aPureUri.replaceAt( - nEnd + 1, - aPureUri.getLength() - nEnd - 1, - ::ucb_impl::urihelper::encodeURI( m_aPath ) ); - - m_aPackage - = ::ucb_impl::urihelper::decodeSegment( aNormPackage ); - m_aPath = ::ucb_impl::urihelper::decodeSegment( m_aPath ); - m_aUri = m_aUri.replaceAt( 0, - ( nParam >= 0 ) - ? nParam - : m_aUri.getLength(), aPureUri ); - - sal_Int32 nLastSlash = aPureUri.lastIndexOf( '/' ); - if ( nLastSlash != -1 ) - { - m_aParentUri = aPureUri.copy( 0, nLastSlash ); - m_aName = ::ucb_impl::urihelper::decodeSegment( - aPureUri.copy( nLastSlash + 1 ) ); - } - } - - // success - m_bValid = true; + m_aName + = ::ucb_impl::urihelper::decodeSegment( m_aPackage ); } else { - // error, but remember that we did a init(). - m_aPath = "/"; + m_aPath = aPureUri.copy( nEnd + 1 ); + + // Unexpected sequences of characters: + // - empty path segments + // - encoded slashes + // - parent folder segments ".." + // - current folder segments "." + if ( m_aPath.indexOf( "//" ) != -1 + || m_aPath.indexOf( "%2F" ) != -1 + || m_aPath.indexOf( "%2f" ) != -1 + || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, ".." ) + || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, "." ) ) + { + // error, but remember that we did a init(). + m_aPath = "/"; + return; + } + + OUString aNormPackage = aPureUri.copy( nStart, nEnd - nStart ); + normalize( aNormPackage ); + + aPureUri = aPureUri.replaceAt( + nStart, nEnd - nStart, aNormPackage ); + aPureUri = aPureUri.replaceAt( + nEnd + 1, + aPureUri.getLength() - nEnd - 1, + ::ucb_impl::urihelper::encodeURI( m_aPath ) ); + + m_aPackage + = ::ucb_impl::urihelper::decodeSegment( aNormPackage ); + m_aPath = ::ucb_impl::urihelper::decodeSegment( m_aPath ); + m_aUri = m_aUri.replaceAt( 0, + ( nParam >= 0 ) + ? nParam + : m_aUri.getLength(), aPureUri ); + + sal_Int32 nLastSlash = aPureUri.lastIndexOf( '/' ); + if ( nLastSlash != -1 ) + { + m_aParentUri = aPureUri.copy( 0, nLastSlash ); + m_aName = ::ucb_impl::urihelper::decodeSegment( + aPureUri.copy( nLastSlash + 1 ) ); + } } + + // success + m_bValid = true; } + else + { + // error, but remember that we did a init(). + m_aPath = "/"; + } + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/tdoc/tdoc_uri.cxx b/ucb/source/ucp/tdoc/tdoc_uri.cxx index c48fa4078e08..126ef346b202 100644 --- a/ucb/source/ucp/tdoc/tdoc_uri.cxx +++ b/ucb/source/ucp/tdoc/tdoc_uri.cxx @@ -38,83 +38,84 @@ using namespace tdoc_ucp; void Uri::init() const { // Already inited? - if ( m_eState == UNKNOWN ) + if ( m_eState != UNKNOWN ) + return; + + m_eState = INVALID; + + // Check for proper length: must be at least length of <sheme>:/ + if ( m_aUri.getLength() < TDOC_URL_SCHEME_LENGTH + 2 ) + { + // Invalid length (to short). + return; + } + + // Check for proper scheme. (Scheme is case insensitive.) + OUString aScheme + = m_aUri.copy( 0, TDOC_URL_SCHEME_LENGTH ).toAsciiLowerCase(); + if ( aScheme != TDOC_URL_SCHEME ) + { + // Invalid scheme. + return; + } + + // Remember normalized scheme string. + m_aUri = m_aUri.replaceAt( 0, aScheme.getLength(), aScheme ); + + if ( m_aUri[ TDOC_URL_SCHEME_LENGTH ] != ':' ) { - m_eState = INVALID; - - // Check for proper length: must be at least length of <sheme>:/ - if ( m_aUri.getLength() < TDOC_URL_SCHEME_LENGTH + 2 ) - { - // Invalid length (to short). - return; - } - - // Check for proper scheme. (Scheme is case insensitive.) - OUString aScheme - = m_aUri.copy( 0, TDOC_URL_SCHEME_LENGTH ).toAsciiLowerCase(); - if ( aScheme != TDOC_URL_SCHEME ) - { - // Invalid scheme. - return; - } - - // Remember normalized scheme string. - m_aUri = m_aUri.replaceAt( 0, aScheme.getLength(), aScheme ); - - if ( m_aUri[ TDOC_URL_SCHEME_LENGTH ] != ':' ) - { - // Invalid (no ':' after <scheme>). - return; - } - - if ( m_aUri[ TDOC_URL_SCHEME_LENGTH + 1 ] != '/' ) - { - // Invalid (no '/' after <scheme>:). - return; - } - - m_aPath = m_aUri.copy( TDOC_URL_SCHEME_LENGTH + 1 ); - - // Note: There must be at least one slash; see above. - sal_Int32 nLastSlash = m_aUri.lastIndexOf( '/' ); - bool bTrailingSlash = false; - if ( nLastSlash == m_aUri.getLength() - 1 ) - { - // ignore trailing slash - bTrailingSlash = true; - nLastSlash = m_aUri.lastIndexOf( '/', nLastSlash ); - } - - if ( nLastSlash != -1 ) // -1 is valid for the root folder - { - m_aParentUri = m_aUri.copy( 0, nLastSlash + 1 ); - - if ( bTrailingSlash ) - m_aName = m_aUri.copy( nLastSlash + 1, - m_aUri.getLength() - nLastSlash - 2 ); - else - m_aName = m_aUri.copy( nLastSlash + 1 ); - - m_aDecodedName = ::ucb_impl::urihelper::decodeSegment( m_aName ); - - sal_Int32 nSlash = m_aPath.indexOf( '/', 1 ); - if ( nSlash == -1 ) - m_aDocId = m_aPath.copy( 1 ); - else - m_aDocId = m_aPath.copy( 1, nSlash - 1 ); - } - - if ( !m_aDocId.isEmpty() ) - { - sal_Int32 nSlash = m_aPath.indexOf( '/', 1 ); - if ( nSlash != - 1 ) - m_aInternalPath = m_aPath.copy( nSlash ); - else - m_aInternalPath = "/"; - } - - m_eState = VALID; + // Invalid (no ':' after <scheme>). + return; } + + if ( m_aUri[ TDOC_URL_SCHEME_LENGTH + 1 ] != '/' ) + { + // Invalid (no '/' after <scheme>:). + return; + } + + m_aPath = m_aUri.copy( TDOC_URL_SCHEME_LENGTH + 1 ); + + // Note: There must be at least one slash; see above. + sal_Int32 nLastSlash = m_aUri.lastIndexOf( '/' ); + bool bTrailingSlash = false; + if ( nLastSlash == m_aUri.getLength() - 1 ) + { + // ignore trailing slash + bTrailingSlash = true; + nLastSlash = m_aUri.lastIndexOf( '/', nLastSlash ); + } + + if ( nLastSlash != -1 ) // -1 is valid for the root folder + { + m_aParentUri = m_aUri.copy( 0, nLastSlash + 1 ); + + if ( bTrailingSlash ) + m_aName = m_aUri.copy( nLastSlash + 1, + m_aUri.getLength() - nLastSlash - 2 ); + else + m_aName = m_aUri.copy( nLastSlash + 1 ); + + m_aDecodedName = ::ucb_impl::urihelper::decodeSegment( m_aName ); + + sal_Int32 nSlash = m_aPath.indexOf( '/', 1 ); + if ( nSlash == -1 ) + m_aDocId = m_aPath.copy( 1 ); + else + m_aDocId = m_aPath.copy( 1, nSlash - 1 ); + } + + if ( !m_aDocId.isEmpty() ) + { + sal_Int32 nSlash = m_aPath.indexOf( '/', 1 ); + if ( nSlash != - 1 ) + m_aInternalPath = m_aPath.copy( nSlash ); + else + m_aInternalPath = "/"; + } + + m_eState = VALID; + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index 0ccf4a0109e7..0c02f3287502 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -679,133 +679,134 @@ 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; + if ( !bCreateNewSession ) + return; - // @@@ 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 - // to the session + const sal_Int32 nConnectTimeoutMax = 180; + const sal_Int32 nConnectTimeoutMin = 2; + const sal_Int32 nReadTimeoutMax = 180; + const sal_Int32 nReadTimeoutMin = 20; - { - osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex ); - m_pHttpSession = ne_session_create( - OUStringToOString( m_aScheme, RTL_TEXTENCODING_UTF8 ).getStr(), - /* theUri.GetUserInfo(), - @@@ for FTP via HTTP proxy, but not supported by Neon */ - OUStringToOString( m_aHostName, RTL_TEXTENCODING_UTF8 ).getStr(), - m_nPort ); - } + // @@@ 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 + // to the session - if ( m_pHttpSession == nullptr ) - throw DAVException( DAVException::DAV_SESSION_CREATE, - NeonUri::makeConnectionEndPointString( - m_aHostName, m_nPort ) ); + { + osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex ); + m_pHttpSession = ne_session_create( + OUStringToOString( m_aScheme, RTL_TEXTENCODING_UTF8 ).getStr(), + /* theUri.GetUserInfo(), + @@@ for FTP via HTTP proxy, but not supported by Neon */ + OUStringToOString( m_aHostName, RTL_TEXTENCODING_UTF8 ).getStr(), + m_nPort ); + } - // Register the session with the lock store - m_aNeonLockStore.registerSession( m_pHttpSession ); + if ( m_pHttpSession == nullptr ) + throw DAVException( DAVException::DAV_SESSION_CREATE, + NeonUri::makeConnectionEndPointString( + m_aHostName, m_nPort ) ); - if ( m_aScheme.equalsIgnoreAsciiCase("https") ) - { - // Set a failure callback for certificate check - ne_ssl_set_verify( - m_pHttpSession, NeonSession_CertificationNotify, this); - - // Tell Neon to tell the SSL library used (OpenSSL or - // GnuTLS, I guess) to use a default set of root - // certificates. - ne_ssl_trust_default_ca(m_pHttpSession); - } + // Register the session with the lock store + m_aNeonLockStore.registerSession( m_pHttpSession ); - // Add hooks (i.e. for adding additional headers to the request) + if ( m_aScheme.equalsIgnoreAsciiCase("https") ) + { + // Set a failure callback for certificate check + ne_ssl_set_verify( + m_pHttpSession, NeonSession_CertificationNotify, this); + + // Tell Neon to tell the SSL library used (OpenSSL or + // GnuTLS, I guess) to use a default set of root + // certificates. + ne_ssl_trust_default_ca(m_pHttpSession); + } + + // Add hooks (i.e. for adding additional headers to the request) #if 0 - /* Hook called when a request is created. */ - //typedef void (*ne_create_request_fn)(ne_request *req, void *userdata, - // const char *method, const char *path); + /* Hook called when a request is created. */ + //typedef void (*ne_create_request_fn)(ne_request *req, void *userdata, + // const char *method, const char *path); - ne_hook_create_request( m_pHttpSession, create_req_hook_fn, this ); + ne_hook_create_request( m_pHttpSession, create_req_hook_fn, this ); #endif - /* Hook called before the request is sent. 'header' is the raw HTTP - * header before the trailing CRLF is added: add in more here. */ - //typedef void (*ne_pre_send_fn)(ne_request *req, void *userdata, - // ne_buffer *header); + /* Hook called before the request is sent. 'header' is the raw HTTP + * header before the trailing CRLF is added: add in more here. */ + //typedef void (*ne_pre_send_fn)(ne_request *req, void *userdata, + // ne_buffer *header); - ne_hook_pre_send( m_pHttpSession, NeonSession_PreSendRequest, this ); + ne_hook_pre_send( m_pHttpSession, NeonSession_PreSendRequest, this ); #if 0 - /* Hook called after the request is sent. May return: - * NE_OK everything is okay - * NE_RETRY try sending the request again. - * anything else signifies an error, and the request is failed. The - * return code is passed back the _dispatch caller, so the session error - * must also be set appropriately (ne_set_error). - */ - //typedef int (*ne_post_send_fn)(ne_request *req, void *userdata, - // const ne_status *status); + /* Hook called after the request is sent. May return: + * NE_OK everything is okay + * NE_RETRY try sending the request again. + * anything else signifies an error, and the request is failed. The + * return code is passed back the _dispatch caller, so the session error + * must also be set appropriately (ne_set_error). + */ + //typedef int (*ne_post_send_fn)(ne_request *req, void *userdata, + // const ne_status *status); - ne_hook_post_send( m_pHttpSession, post_send_req_hook_fn, this ); + ne_hook_post_send( m_pHttpSession, post_send_req_hook_fn, this ); - /* Hook called when the request is destroyed. */ - //typedef void (*ne_destroy_req_fn)(ne_request *req, void *userdata); + /* Hook called when the request is destroyed. */ + //typedef void (*ne_destroy_req_fn)(ne_request *req, void *userdata); - ne_hook_destroy_request( m_pHttpSession, destroy_req_hook_fn, this ); + ne_hook_destroy_request( m_pHttpSession, destroy_req_hook_fn, this ); - /* Hook called when the session is destroyed. */ - //typedef void (*ne_destroy_sess_fn)(void *userdata); + /* Hook called when the session is destroyed. */ + //typedef void (*ne_destroy_sess_fn)(void *userdata); - ne_hook_destroy_session( m_pHttpSession, destroy_sess_hook_fn, this ); + ne_hook_destroy_session( m_pHttpSession, destroy_sess_hook_fn, this ); #endif - if ( !m_aProxyName.isEmpty() ) - { - ne_session_proxy( m_pHttpSession, - OUStringToOString( - m_aProxyName, - RTL_TEXTENCODING_UTF8 ).getStr(), - m_nProxyPort ); - } + if ( !m_aProxyName.isEmpty() ) + { + ne_session_proxy( m_pHttpSession, + OUStringToOString( + m_aProxyName, + RTL_TEXTENCODING_UTF8 ).getStr(), + m_nProxyPort ); + } - // avoid KeepAlive? - if ( noKeepAlive(m_aFlags) ) - ne_set_session_flag( m_pHttpSession, NE_SESSFLAG_PERSIST, 0 ); + // avoid KeepAlive? + if ( noKeepAlive(m_aFlags) ) + ne_set_session_flag( m_pHttpSession, NE_SESSFLAG_PERSIST, 0 ); - // Register for redirects. - ne_redirect_register( m_pHttpSession ); + // Register for redirects. + ne_redirect_register( m_pHttpSession ); - // authentication callbacks. + // authentication callbacks. #if 1 - ne_add_server_auth( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); - ne_add_proxy_auth ( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); + ne_add_server_auth( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); + ne_add_proxy_auth ( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); #else - ne_set_server_auth( m_pHttpSession, NeonSession_NeonAuth, this ); - ne_set_proxy_auth ( m_pHttpSession, NeonSession_NeonAuth, this ); + 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 - // with 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, - 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, - std::max( nReadTimeoutMin, - std::min( nReadTimeout, nReadTimeoutMax ) ) ); - } + // set timeout to connect + // if connect_timeout is not set, neon returns NE_CONNECT when the TCP socket default + // timeout elapses + // with 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, + 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, + std::max( nReadTimeoutMin, + std::min( nReadTimeout, nReadTimeoutMax ) ) ); + } bool NeonSession::CanUse( const OUString & inUri, |