summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/webdav/NeonSession.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'ucb/source/ucp/webdav/NeonSession.cxx')
-rw-r--r--ucb/source/ucp/webdav/NeonSession.cxx36
1 files changed, 34 insertions, 2 deletions
diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx
index 1317bdefacf6..ec421ad2b9b4 100644
--- a/ucb/source/ucp/webdav/NeonSession.cxx
+++ b/ucb/source/ucp/webdav/NeonSession.cxx
@@ -50,6 +50,7 @@ extern "C" {
#include "libxml/parser.h"
#include "rtl/ustrbuf.hxx"
#include "comphelper/sequence.hxx"
+#include <comphelper/stl_types.hxx>
#include "ucbhelper/simplecertificatevalidationrequest.hxx"
#include "DAVAuthListener.hxx"
@@ -69,8 +70,11 @@ extern "C" {
#include <com/sun/star/security/CertificateContainer.hpp>
#include <com/sun/star/security/XCertificateContainer.hpp>
#include <com/sun/star/ucb/Lock.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
+#include <boost/bind.hpp>
+
using namespace com::sun::star;
using namespace webdav_ucp;
@@ -151,6 +155,26 @@ static sal_uInt16 makeStatusCode( const rtl::OUString & rStatusText )
}
// -------------------------------------------------------------------
+static bool noKeepAlive( const uno::Sequence< beans::PropertyValue >& rFlags )
+{
+ if ( !rFlags.hasElements() )
+ return false;
+
+ // find "KeepAlive" property
+ const beans::PropertyValue* pAry(rFlags.getConstArray());
+ const sal_Int32 nLen(rFlags.getLength());
+ const beans::PropertyValue* pValue(
+ std::find_if(pAry,pAry+nLen,
+ boost::bind(comphelper::TPropertyValueEqualFunctor(),
+ _1,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("KeepAlive")))));
+ if ( pValue != pAry+nLen && !pValue->Value.get<sal_Bool>() )
+ return true;
+
+ return false;
+}
+
+// -------------------------------------------------------------------
struct NeonRequestContext
{
uno::Reference< io::XOutputStream > xOutputStream;
@@ -619,9 +643,11 @@ NeonLockStore NeonSession::m_aNeonLockStore;
NeonSession::NeonSession(
const rtl::Reference< DAVSessionFactory > & rSessionFactory,
const rtl::OUString& inUri,
+ const uno::Sequence< beans::PropertyValue >& rFlags,
const ucbhelper::InternetProxyDecider & rProxyDecider )
throw ( DAVException )
: DAVSession( rSessionFactory ),
+ m_aFlags( rFlags ),
m_pHttpSession( 0 ),
m_pRequestData( new RequestDataMap ),
m_rProxyDecider( rProxyDecider )
@@ -808,6 +834,10 @@ void NeonSession::Init()
m_nProxyPort );
}
+ // avoid KeepAlive?
+ if ( noKeepAlive(m_aFlags) )
+ ne_set_session_flag( m_pHttpSession, NE_SESSFLAG_PERSIST, 0 );
+
// Register for redirects.
ne_redirect_register( m_pHttpSession );
@@ -824,14 +854,16 @@ void NeonSession::Init()
// -------------------------------------------------------------------
// virtual
-sal_Bool NeonSession::CanUse( const rtl::OUString & inUri )
+sal_Bool NeonSession::CanUse( const rtl::OUString & inUri,
+ const uno::Sequence< beans::PropertyValue >& rFlags )
{
try
{
NeonUri theUri( inUri );
if ( ( theUri.GetPort() == m_nPort ) &&
( theUri.GetHost() == m_aHostName ) &&
- ( theUri.GetScheme() == m_aScheme ) )
+ ( theUri.GetScheme() == m_aScheme ) &&
+ ( rFlags == m_aFlags ) )
return sal_True;
}
catch ( DAVException const & )