diff options
author | Kai Sommerfeld <kso@openoffice.org> | 2001-02-16 07:14:51 +0000 |
---|---|---|
committer | Kai Sommerfeld <kso@openoffice.org> | 2001-02-16 07:14:51 +0000 |
commit | 543e3fa99c48684eeeb2fb1d38e15eb6aaba308e (patch) | |
tree | 2a1e3f84dbd825378d5fca21b79458230e39f27c /ucb | |
parent | 73d5d1da13c861cb2aa3f19c0cb5d1f54ddffc81 (diff) |
#83892# - Need to hold hostname and proxyname in an OString member,
because of somewhat curious neon API.
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/webdav/NeonSession.cxx | 35 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/NeonSession.hxx | 14 |
2 files changed, 30 insertions, 19 deletions
diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index 8abe6a2ca140..a029cd24aaea 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -2,9 +2,9 @@ * * $RCSfile: NeonSession.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: kso $ $Date: 2001-02-15 11:02:24 $ + * last change: $Author: kso $ $Date: 2001-02-16 08:14:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,15 +84,23 @@ NeonSession::NeonSession( DAVSessionFactory* pSessionFactory, const ProxyConfig& rProxyCfg ) : m_pSessionFactory( pSessionFactory ) { + // @@@ We need to keep the char buffer for hostname and proxyname + // for the whole session lifetime because neon only stores a pointer + // to that buffer (last verified with neon 0.11.0)!!! We do this + // by having the members mHostName and mProxyName, which are OStrings! + Init(); NeonUri theUri( inUri ); - mHostName = theUri.GetHost(); + mHostName = OUStringToOString( theUri.GetHost(), RTL_TEXTENCODING_UTF8 ); mPort = theUri.GetPort(); + mProxyName = OUStringToOString( rProxyCfg.aName, RTL_TEXTENCODING_UTF8 ); + mProxyPort = rProxyCfg.nPort; + mHttpSession = CreateSession( mHostName, theUri.GetPort(), - rProxyCfg.aName, + mProxyName, rProxyCfg.nPort ); if ( mHttpSession == NULL ) throw DAVException( DAVException::DAV_SESSION_CREATE ); @@ -136,7 +144,9 @@ sal_Bool NeonSession::CanUse( const OUString & inUri ) { sal_Bool IsConnected = sal_False; NeonUri theUri( inUri ); - if ( theUri.GetPort() == mPort && theUri.GetHost() == mHostName ) + if ( ( theUri.GetPort() == mPort ) && + ( OUStringToOString( theUri.GetHost(), RTL_TEXTENCODING_UTF8 ) + == mHostName ) ) IsConnected = sal_True; return IsConnected; } @@ -158,7 +168,7 @@ void NeonSession::setProxyAuthListener(DAVAuthListener * inDAVAuthListener) // ------------------------------------------------------------------- // OPTIONS // ------------------------------------------------------------------- -void NeonSession::OPTIONS( const OUString & inUri, +void NeonSession::OPTIONS( const OUString & inUri, DAVCapabilities & outCapabilities, const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& inEnv ) @@ -432,9 +442,9 @@ void NeonSession::Init( void ) // CreateSession // Creates a new neon session. // ------------------------------------------------------------------- -HttpSession * NeonSession::CreateSession( const OUString& inHostName, +HttpSession * NeonSession::CreateSession( const OString & inHostName, int inPort, - const OUString& inProxyName, + const OString & inProxyName, int inProxyPort ) { if ( inHostName.getLength() == 0 || inPort <= 0 ) @@ -446,17 +456,16 @@ HttpSession * NeonSession::CreateSession( const OUString& inHostName, if ( inProxyName.getLength() ) { - OString aProxy = OUStringToOString( inProxyName, RTL_TEXTENCODING_UTF8 ); - if ( http_session_proxy( theHttpSession, aProxy.getStr(), inProxyPort ) - != HTTP_OK ) + if ( http_session_proxy( + theHttpSession, inProxyName.getStr(), inProxyPort ) != HTTP_OK ) { http_session_destroy( theHttpSession ); throw DAVException( DAVException::DAV_HTTP_LOOKUP ); } } - OString aHost = OUStringToOString( inHostName, RTL_TEXTENCODING_UTF8 ); - if ( http_session_server( theHttpSession, aHost.getStr(), inPort ) != HTTP_OK ) + if ( http_session_server( + theHttpSession, inHostName.getStr(), inPort ) != HTTP_OK ) { http_session_destroy( theHttpSession ); throw DAVException( DAVException::DAV_HTTP_LOOKUP ); diff --git a/ucb/source/ucp/webdav/NeonSession.hxx b/ucb/source/ucp/webdav/NeonSession.hxx index e59f6b72adc7..fa6df46142f0 100644 --- a/ucb/source/ucp/webdav/NeonSession.hxx +++ b/ucb/source/ucp/webdav/NeonSession.hxx @@ -2,9 +2,9 @@ * * $RCSfile: NeonSession.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: kso $ $Date: 2001-01-26 16:05:04 $ + * last change: $Author: kso $ $Date: 2001-02-16 08:14:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,9 +77,11 @@ class NeonSession : public DAVSession { private: osl::Mutex mMutex; - HttpSession * mHttpSession; - rtl::OUString mHostName; + rtl::OString mHostName; + rtl::OString mProxyName; sal_Int32 mPort; + sal_Int32 mProxyPort; + HttpSession * mHttpSession; // Authentication stuff DAVAuthListener * mListener; @@ -183,9 +185,9 @@ class NeonSession : public DAVSession void Init( void ); // Create a Neon session for server at supplied host & port - HttpSession * CreateSession( const ::rtl::OUString& inHostName, + HttpSession * CreateSession( const ::rtl::OString & inHostName, int inPort, - const ::rtl::OUString& inProxyName, + const ::rtl::OString & inProxyName, int inProxyPort ); // A simple Neon http_block_reader for use with a http GET method |