summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorKai Sommerfeld <kso@openoffice.org>2002-10-28 15:20:12 +0000
committerKai Sommerfeld <kso@openoffice.org>2002-10-28 15:20:12 +0000
commit3da96f52aec0819840f2741a729603b753aec26a (patch)
tree3e6860555f02ddb68d15ac930fc83195f668980e /ucb
parent2b3f4215c9db9b6a8330bf466355b70f40a5f827 (diff)
#104432# - Now uses ucbhelper::ProxyDecider for proxy settings.
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav/DAVSessionFactory.cxx58
-rw-r--r--ucb/source/ucp/webdav/DAVSessionFactory.hxx20
-rw-r--r--ucb/source/ucp/webdav/NeonSession.cxx6
-rw-r--r--ucb/source/ucp/webdav/NeonSession.hxx6
-rw-r--r--ucb/source/ucp/webdav/makefile.mk7
5 files changed, 63 insertions, 34 deletions
diff --git a/ucb/source/ucp/webdav/DAVSessionFactory.cxx b/ucb/source/ucp/webdav/DAVSessionFactory.cxx
index 2c48d791a127..e30aafe6772f 100644
--- a/ucb/source/ucp/webdav/DAVSessionFactory.cxx
+++ b/ucb/source/ucp/webdav/DAVSessionFactory.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVSessionFactory.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: kso $ $Date: 2001-11-26 09:45:37 $
+ * last change: $Author: kso $ $Date: 2002-10-28 16:20:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,6 +65,9 @@
#ifndef _NEONSESSION_HXX_
#include "NeonSession.hxx"
#endif
+#ifndef _NEONURI_HXX_
+#include "NeonUri.hxx"
+#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -75,11 +78,6 @@ using namespace com::sun::star;
DAVSessionFactory::~DAVSessionFactory()
{
- if ( m_xProxySettings.is() )
- {
- m_xProxySettings->dispose();
- m_xProxySettings = 0;
- }
}
rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
@@ -89,8 +87,8 @@ rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
{
osl::MutexGuard aGuard( m_aMutex );
- if ( !m_xProxySettings.is() )
- m_xProxySettings = new ProxySettings( rxSMgr );
+ if ( !m_xProxyDecider.get() )
+ m_xProxyDecider.reset( new ucbhelper::InternetProxyDecider( rxSMgr ) );
Map::iterator aIt( m_aMap.begin() );
Map::iterator aEnd( m_aMap.end() );
@@ -105,9 +103,21 @@ rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
if ( aIt == aEnd )
{
+ NeonUri aURI( inUri );
+
std::auto_ptr< DAVSession > xElement(
- new NeonSession(
- this, inUri, m_xProxySettings->getProxy( inUri ) ) );
+ ( aURI.GetScheme().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "http" ) ) ||
+ aURI.GetScheme().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "https" ) ) )
+ ? new NeonSession(
+ this, inUri, m_xProxyDecider->getProxy( aURI.GetScheme(),
+ aURI.GetHost(),
+ aURI.GetPort() ) )
+ : new NeonSession(
+ this, inUri, m_xProxyDecider->getProxy( aURI.GetScheme(),
+ rtl::OUString() /* not used */,
+ -1 /* not used */ ) ) );
aIt = m_aMap.insert( Map::value_type( inUri, xElement.get() ) ).first;
aIt->second->m_aContainerIt = aIt;
xElement.release();
@@ -123,9 +133,29 @@ rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
{
osl_decrementInterlockedCount( &aIt->second->m_nRefCount );
aIt->second->m_aContainerIt = m_aMap.end();
- aIt->second = new NeonSession( this,
- inUri,
- m_xProxySettings->getProxy( inUri ) );
+
+ // If URL scheme is different from http or https we definitely
+ // have to use a proxy and therefore can optimize the getProxy
+ // call a little:
+ NeonUri aURI( inUri );
+
+ if ( aURI.GetScheme().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "http" ) ) ||
+ aURI.GetScheme().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "https" ) ) )
+ aIt->second = new NeonSession( this,
+ inUri,
+ m_xProxyDecider->getProxy(
+ aURI.GetScheme(),
+ aURI.GetHost(),
+ aURI.GetPort() ) );
+ else
+ aIt->second = new NeonSession( this,
+ inUri,
+ m_xProxyDecider->getProxy(
+ aURI.GetScheme(),
+ rtl::OUString() /* not used */,
+ -1 /* not used */ ) );
aIt->second->m_aContainerIt = aIt;
return aIt->second;
}
diff --git a/ucb/source/ucp/webdav/DAVSessionFactory.hxx b/ucb/source/ucp/webdav/DAVSessionFactory.hxx
index ae2a4f18c6cc..25cdcbe123fb 100644
--- a/ucb/source/ucp/webdav/DAVSessionFactory.hxx
+++ b/ucb/source/ucp/webdav/DAVSessionFactory.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVSessionFactory.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: kso $ $Date: 2001-11-26 09:45:37 $
+ * last change: $Author: kso $ $Date: 2002-10-28 16:20:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,24 +62,24 @@
#define _DAVSESSIONFACTORY_HXX_
#include <map>
+#include <memory>
-#ifndef _SALHELPER_SIMPLEREFERENCEOBJECT_HXX_
-#include "salhelper/simplereferenceobject.hxx"
-#endif
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
+#ifndef _SALHELPER_SIMPLEREFERENCEOBJECT_HXX_
+#include <salhelper/simplereferenceobject.hxx>
+#endif
#ifndef _RTL_REF_HXX_
#include <rtl/ref.hxx>
#endif
-
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
-
-#ifndef _PROXYCONFIG_HXX_
-#include "proxyconfig.hxx"
+#ifndef _UCBHELPER_PROXYDECIDER_HXX
+#include <ucbhelper/proxydecider.hxx>
#endif
+
#ifndef _DAVEXCEPTION_HXX_
#include "DAVException.hxx"
#endif
@@ -109,7 +109,7 @@ private:
Map m_aMap;
osl::Mutex m_aMutex;
- rtl::Reference< ProxySettings > m_xProxySettings;
+ std::auto_ptr< ucbhelper::InternetProxyDecider > m_xProxyDecider;
void releaseElement( DAVSession * pElement ) SAL_THROW(());
diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx
index 28699bcea5f5..9de93248b832 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.25 $
+ * $Revision: 1.26 $
*
- * last change: $Author: kso $ $Date: 2002-10-24 11:59:14 $
+ * last change: $Author: kso $ $Date: 2002-10-28 16:20:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -443,7 +443,7 @@ extern "C" void NeonSession_ResponseHeaderCatcher( void * userdata,
NeonSession::NeonSession(
rtl::Reference< DAVSessionFactory > const & rSessionFactory,
const rtl::OUString& inUri,
- const ProxyConfig& rProxyCfg )
+ const ucbhelper::InternetProxyServer& rProxyCfg )
throw ( DAVException )
: DAVSession( rSessionFactory ),
m_pRequestData( new RequestDataMap )
diff --git a/ucb/source/ucp/webdav/NeonSession.hxx b/ucb/source/ucp/webdav/NeonSession.hxx
index 5dca43c54388..807b1c29c3c6 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.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: kso $ $Date: 2002-10-24 11:59:14 $
+ * last change: $Author: kso $ $Date: 2002-10-28 16:20:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -111,7 +111,7 @@ class NeonSession : public DAVSession
public:
NeonSession( rtl::Reference< DAVSessionFactory > const & rSessionFactory,
const rtl::OUString& inUri,
- const ProxyConfig& rProxyCfg )
+ const ucbhelper::InternetProxyServer & rProxyCfg )
throw ( DAVException );
// DAVSession methods
diff --git a/ucb/source/ucp/webdav/makefile.mk b/ucb/source/ucp/webdav/makefile.mk
index f3a4c2a65dda..f3af5b8e7276 100644
--- a/ucb/source/ucp/webdav/makefile.mk
+++ b/ucb/source/ucp/webdav/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.16 $
+# $Revision: 1.17 $
#
-# last change: $Author: kso $ $Date: 2002-08-29 09:00:13 $
+# last change: $Author: kso $ $Date: 2002-10-28 16:20:12 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -103,10 +103,9 @@ SLOFILES=\
$(SLO)$/NeonUri.obj \
$(SLO)$/NeonInputStream.obj \
$(SLO)$/NeonPropFindRequest.obj \
- $(SLO)$/NeonHeadRequest.obj \
+ $(SLO)$/NeonHeadRequest.obj \
$(SLO)$/NeonSession.obj \
$(SLO)$/DateTimeHelper.obj \
- $(SLO)$/proxyconfig.obj \
$(SLO)$/LinkSequence.obj \
$(SLO)$/LockSequence.obj \
$(SLO)$/LockEntrySequence.obj \