summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorKai Sommerfeld <kso@openoffice.org>2002-09-18 11:46:14 +0000
committerKai Sommerfeld <kso@openoffice.org>2002-09-18 11:46:14 +0000
commit06e16dad6cb3a020bdbfdc9e5f28267e7f1cea63 (patch)
tree69485863599ca522cb7189cc36adc1ced444698b /ucb
parent913c58ed14b48b76f4192cbc0cf0e85afa7a9b39 (diff)
#i7636# - Proxy Authentication, some general refactoring
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav/DAVAuthListener.hxx8
-rw-r--r--ucb/source/ucp/webdav/DAVRequestEnvironment.hxx87
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.cxx142
-rw-r--r--ucb/source/ucp/webdav/DAVSession.hxx69
-rw-r--r--ucb/source/ucp/webdav/NeonSession.cxx374
-rw-r--r--ucb/source/ucp/webdav/NeonSession.hxx104
6 files changed, 391 insertions, 393 deletions
diff --git a/ucb/source/ucp/webdav/DAVAuthListener.hxx b/ucb/source/ucp/webdav/DAVAuthListener.hxx
index 51b6bef40153..a248e3d38116 100644
--- a/ucb/source/ucp/webdav/DAVAuthListener.hxx
+++ b/ucb/source/ucp/webdav/DAVAuthListener.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVAuthListener.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: kso $ $Date: 2002-08-15 10:05:23 $
+ * last change: $Author: kso $ $Date: 2002-09-18 12:46:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,9 +83,7 @@ class DAVAuthListener
const ::rtl::OUString & inRealm,
const ::rtl::OUString & inHostName,
::rtl::OUString & inoutUserName,
- ::rtl::OUString & outPassWord,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv ) = 0;
+ ::rtl::OUString & outPassWord ) = 0;
};
}; // namespace webdav_ucp
diff --git a/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx b/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx
new file mode 100644
index 000000000000..bca357d1af11
--- /dev/null
+++ b/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * $RCSfile: DAVRequestEnvironment.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: kso $ $Date: 2002-09-18 12:46:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _DAVREQUESTENVIRONMENT_HXX_
+#define _DAVREQUESTENVIRONMENT_HXX_
+
+#include <memory>
+
+#ifndef _DAVAUTHLISTENER_HXX_
+#include "DAVAuthListener.hxx"
+#endif
+
+namespace webdav_ucp
+{
+
+struct DAVRequestEnvironment
+{
+ std::auto_ptr< DAVAuthListener > m_xAuthListener;
+// std::auto_ptr< DAVStatusListener > m_xStatusListener;
+// std::auto_ptr< DAVProgressListener > m_xStatusListener;
+
+ DAVRequestEnvironment( DAVAuthListener * pListener )
+ : m_xAuthListener( pListener ) {}
+
+ DAVRequestEnvironment() {}
+};
+
+}; // namespace webdav_ucp
+
+#endif // _DAVREQUESTENVIRONMENT_HXX_
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index 3005e63e5201..fef68241d495 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVResourceAccess.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: kso $ $Date: 2002-09-16 14:37:11 $
+ * last change: $Author: kso $ $Date: 2002-09-18 12:46:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,9 @@
//=========================================================================
//=========================================================================
+using namespace webdav_ucp;
+using namespace com::sun::star;
+
namespace webdav_ucp
{
@@ -94,20 +97,21 @@ namespace webdav_ucp
class AuthListener : public DAVAuthListener
{
public:
+ AuthListener( const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+ : m_xEnv( xEnv ) {}
+
virtual int authenticate( const ::rtl::OUString & inRealm,
const ::rtl::OUString & inHostName,
::rtl::OUString & inoutUserName,
- ::rtl::OUString & outPassWord,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >&
- Environment );
+ ::rtl::OUString & outPassWord );
+private:
+ uno::Reference< ucb::XCommandEnvironment > m_xEnv;
+ rtl::OUString m_aPrevPassword;
+ rtl::OUString m_aPrevUsername;
};
}
-using namespace webdav_ucp;
-using namespace com::sun::star;
-
//=========================================================================
//=========================================================================
//
@@ -121,16 +125,22 @@ using namespace com::sun::star;
int AuthListener::authenticate( const ::rtl::OUString & inRealm,
const ::rtl::OUString & inHostName,
::rtl::OUString & inoutUserName,
- ::rtl::OUString & outPassWord,
- const uno::Reference<
- ucb::XCommandEnvironment >& Environment )
+ ::rtl::OUString & outPassWord )
{
- if ( Environment.is() )
+ if ( m_xEnv.is() )
{
uno::Reference< task::XInteractionHandler > xIH
- = Environment->getInteractionHandler();
+ = m_xEnv->getInteractionHandler();
if ( xIH.is() )
{
+ // #102871# - Supply username and password from previous try.
+ // Password container service depends on this!
+ if ( inoutUserName.getLength() == 0 )
+ inoutUserName = m_aPrevUsername;
+
+ if ( outPassWord.getLength() == 0 )
+ outPassWord = m_aPrevPassword;
+
rtl::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest
= new ucbhelper::SimpleAuthenticationRequest( inHostName,
inRealm,
@@ -155,6 +165,10 @@ int AuthListener::authenticate( const ::rtl::OUString & inRealm,
inoutUserName = xSupp->getUserName();
outPassWord = xSupp->getPassword();
+ // #102871# - Remember username and password.
+ m_aPrevUsername = inoutUserName;
+ m_aPrevPassword = outPassWord;
+
// go on.
return 0;
}
@@ -166,10 +180,6 @@ int AuthListener::authenticate( const ::rtl::OUString & inRealm,
}
//=========================================================================
-
-AuthListener webdavAuthListener;
-
-//=========================================================================
//=========================================================================
//
// DAVResourceAccess Implementation.
@@ -203,7 +213,10 @@ void DAVResourceAccess::OPTIONS( DAVCapabilities & rCapabilities,
bRetry = sal_False;
try
{
- m_xSession->OPTIONS( m_aPath, rCapabilities, xEnv );
+ m_xSession->OPTIONS( m_aPath,
+ rCapabilities,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -231,8 +244,12 @@ void DAVResourceAccess::PROPFIND( const Depth nDepth,
bRetry = sal_False;
try
{
- m_xSession->PROPFIND(
- m_aPath, nDepth, rPropertyNames, rResources, xEnv );
+ m_xSession->PROPFIND( m_aPath,
+ nDepth,
+ rPropertyNames,
+ rResources,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -259,7 +276,11 @@ void DAVResourceAccess::PROPFIND( const Depth nDepth,
bRetry = sal_False;
try
{
- m_xSession->PROPFIND( m_aPath, nDepth, rResInfo, xEnv );
+ m_xSession->PROPFIND( m_aPath,
+ nDepth,
+ rResInfo,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) ) ;
}
catch ( DAVException & e )
{
@@ -285,7 +306,10 @@ void DAVResourceAccess::PROPPATCH( const std::vector< ProppatchValue >& rValues,
bRetry = sal_False;
try
{
- m_xSession->PROPPATCH( m_aPath, rValues, xEnv );
+ m_xSession->PROPPATCH( m_aPath,
+ rValues,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -312,7 +336,11 @@ void DAVResourceAccess::HEAD( const std::vector< rtl::OUString > & rHeaderNames,
bRetry = sal_False;
try
{
- m_xSession->HEAD( m_aPath, rHeaderNames, rResource, xEnv );
+ m_xSession->HEAD( m_aPath,
+ rHeaderNames,
+ rResource,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -338,7 +366,9 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
bRetry = sal_False;
try
{
- xStream = m_xSession->GET( m_aPath, xEnv );
+ xStream = m_xSession->GET( m_aPath,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -366,7 +396,10 @@ void DAVResourceAccess::GET( uno::Reference< io::XOutputStream > & rStream,
bRetry = sal_False;
try
{
- m_xSession->GET( m_aPath, rStream, xEnv );
+ m_xSession->GET( m_aPath,
+ rStream,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -394,7 +427,11 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
bRetry = sal_False;
try
{
- xStream = m_xSession->GET( m_aPath, rHeaderNames, rResource, xEnv );
+ xStream = m_xSession->GET( m_aPath,
+ rHeaderNames,
+ rResource,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -424,7 +461,12 @@ void DAVResourceAccess::GET(
bRetry = sal_False;
try
{
- m_xSession->GET( m_aPath, rStream, rHeaderNames, rResource, xEnv );
+ m_xSession->GET( m_aPath,
+ rStream,
+ rHeaderNames,
+ rResource,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -450,7 +492,10 @@ void DAVResourceAccess::PUT( const uno::Reference< io::XInputStream > & rStream,
bRetry = sal_False;
try
{
- m_xSession->PUT( m_aPath, rStream, xEnv );
+ m_xSession->PUT( m_aPath,
+ rStream,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -479,8 +524,12 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
bRetry = sal_False;
try
{
- xStream = m_xSession->POST(
- m_aPath, rContentType, rReferer, rInputStream, xEnv );
+ xStream = m_xSession->POST( m_aPath,
+ rContentType,
+ rReferer,
+ rInputStream,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -512,8 +561,13 @@ void DAVResourceAccess::POST(
bRetry = sal_False;
try
{
- m_xSession->POST( m_aPath, rContentType, rReferer,
- rInputStream, rOutputStream, xEnv );
+ m_xSession->POST( m_aPath,
+ rContentType,
+ rReferer,
+ rInputStream,
+ rOutputStream,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -538,7 +592,9 @@ void DAVResourceAccess::MKCOL( const uno::Reference<
bRetry = sal_False;
try
{
- m_xSession->MKCOL( m_aPath, xEnv );
+ m_xSession->MKCOL( m_aPath,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -566,7 +622,11 @@ void DAVResourceAccess::COPY( const ::rtl::OUString & rSourcePath,
bRetry = sal_False;
try
{
- m_xSession->COPY( rSourcePath, rDestinationURI, xEnv, bOverwrite );
+ m_xSession->COPY( rSourcePath,
+ rDestinationURI,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ),
+ bOverwrite );
}
catch ( DAVException & e )
{
@@ -594,7 +654,11 @@ void DAVResourceAccess::MOVE( const ::rtl::OUString & rSourcePath,
bRetry = sal_False;
try
{
- m_xSession->MOVE( rSourcePath, rDestinationURI, xEnv, bOverwrite );
+ m_xSession->MOVE( rSourcePath,
+ rDestinationURI,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ),
+ bOverwrite );
}
catch ( DAVException & e )
{
@@ -619,7 +683,9 @@ void DAVResourceAccess::DESTROY( const uno::Reference<
bRetry = sal_False;
try
{
- m_xSession->DESTROY( m_aPath, xEnv );
+ m_xSession->DESTROY( m_aPath,
+ DAVRequestEnvironment(
+ new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
{
@@ -685,8 +751,6 @@ void DAVResourceAccess::initialize()
if ( !m_xSession.is() )
return;
-
- m_xSession->setServerAuthListener( &webdavAuthListener );
}
// Own URI is needed for redirect cycle detection.
diff --git a/ucb/source/ucp/webdav/DAVSession.hxx b/ucb/source/ucp/webdav/DAVSession.hxx
index e4c3c68149f3..7213a310bfd0 100644
--- a/ucb/source/ucp/webdav/DAVSession.hxx
+++ b/ucb/source/ucp/webdav/DAVSession.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVSession.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: kso $ $Date: 2002-09-16 14:37:12 $
+ * last change: $Author: kso $ $Date: 2002-09-18 12:46:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,9 +74,6 @@
#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
#include <com/sun/star/io/XOutputStream.hpp>
#endif
-#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#endif
#ifndef _DAVEXCEPTION_HXX_
#include "DAVException.hxx"
@@ -93,6 +90,9 @@
#ifndef _DAVTYPES_HXX_
#include "DAVTypes.hxx"
#endif
+#ifndef _DAVREQUESTENVIRONMENT_HXX_
+#include "DAVRequestEnvironment.hxx"
+#endif
namespace webdav_ucp
{
@@ -118,18 +118,12 @@ public:
virtual sal_Bool CanUse( const ::rtl::OUString & inPath ) = 0;
- // Authentication methods
- //
- virtual void setServerAuthListener(DAVAuthListener * inDAVAuthListener) = 0;
- virtual void setProxyAuthListener(DAVAuthListener * inDAVAuthListener ) = 0;
-
// DAV methods
//
virtual void OPTIONS( const ::rtl::OUString & inPath,
DAVCapabilities & outCapabilities,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
// allprop & named
@@ -137,64 +131,55 @@ public:
const Depth inDepth,
const std::vector< ::rtl::OUString > & inPropertyNames,
std::vector< DAVResource > & ioResources,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
// propnames
virtual void PROPFIND( const ::rtl::OUString & inPath,
const Depth inDepth,
std::vector< DAVResourceInfo > & ioResInfo,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual void PROPPATCH( const ::rtl::OUString & inPath,
const std::vector< ProppatchValue > & inValues,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual void HEAD( const ::rtl::OUString & inPath,
const std::vector< ::rtl::OUString > & inHeaderNames,
DAVResource & ioResource,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
GET( const ::rtl::OUString & inPath,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual void GET( const ::rtl::OUString & inPath,
com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
GET( const ::rtl::OUString & inPath,
const std::vector< ::rtl::OUString > & inHeaderNames,
DAVResource & ioResource,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual void GET( const ::rtl::OUString & inPath,
com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o,
const std::vector< ::rtl::OUString > & inHeaderNames,
DAVResource & ioResource,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual void PUT( const ::rtl::OUString & inPath,
const com::sun::star::uno::Reference<
com::sun::star::io::XInputStream >& s,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
@@ -203,8 +188,7 @@ public:
const rtl::OUString & rReferer,
const com::sun::star::uno::Reference<
com::sun::star::io::XInputStream > & inInputStream,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException ) = 0;
virtual void POST( const rtl::OUString & inPath,
@@ -214,44 +198,37 @@ public:
com::sun::star::io::XInputStream > & inInputStream,
com::sun::star::uno::Reference<
com::sun::star::io::XOutputStream > & oOutputStream,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException ) = 0;
virtual void MKCOL( const ::rtl::OUString & inPath,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual void COPY( const ::rtl::OUString & inSource,
const ::rtl::OUString & inDestination,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv,
+ const DAVRequestEnvironment & rEnv,
sal_Bool inOverwrite = false )
throw( DAVException ) = 0;
virtual void MOVE( const ::rtl::OUString & inSource,
const ::rtl::OUString & inDestination,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv,
+ const DAVRequestEnvironment & rEnv,
sal_Bool inOverwrite = false )
throw( DAVException ) = 0;
virtual void DESTROY( const ::rtl::OUString & inPath,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
// Note: Uncomment the following if locking support is required
/*
virtual void LOCK ( const Lock & inLock,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual void UNLOCK ( const Lock & inLock,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv)
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
*/
protected:
diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx
index d69bbfdc3710..6f56309fedf9 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.23 $
+ * $Revision: 1.24 $
*
- * last change: $Author: kso $ $Date: 2002-09-16 14:37:12 $
+ * last change: $Author: kso $ $Date: 2002-09-18 12:46:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -264,6 +264,7 @@ extern "C" void NeonSession_ResponseBlockWriter( void * inUserData,
}
}
+// -------------------------------------------------------------------
extern "C" int NeonSession_NeonAuth( void * inUserData,
const char * inRealm,
int attempt,
@@ -280,7 +281,9 @@ extern "C" int NeonSession_NeonAuth( void * inUserData,
#endif
NeonSession * theSession = static_cast< NeonSession * >( inUserData );
- if ( !theSession->getServerAuthListener() )
+ DAVAuthListener * pListener
+ = theSession->getRequestEnvironment().m_xAuthListener.get();
+ if ( !pListener )
{
// abort
return -1;
@@ -294,34 +297,21 @@ extern "C" int NeonSession_NeonAuth( void * inUserData,
// (last checked: 0.22.0).
rtl::OUString::createFromAscii( inoutPassWord ) ); */
- // #102871# - Supply username and password from previous try. Password
- // container service depends on this!
- if ( theUserName.getLength() == 0 )
- theUserName = theSession->getUserName();
-
- if ( thePassWord.getLength() == 0 )
- thePassWord = theSession->getPassWord();
-
- int theRetVal = theSession->getServerAuthListener()->authenticate(
+ int theRetVal = pListener->authenticate(
rtl::OUString::createFromAscii( inRealm ),
theSession->getHostName(),
theUserName,
- thePassWord,
- theSession->getCommandEnvironment() );
+ thePassWord );
strcpy( inoutUserName,
rtl::OUStringToOString( theUserName, RTL_TEXTENCODING_UTF8 ) );
strcpy( inoutPassWord,
rtl::OUStringToOString( thePassWord, RTL_TEXTENCODING_UTF8 ) );
- // #102871# - Remember username and password.
- theSession->setUserName( theUserName );
- theSession->setPassWord( thePassWord );
-
return theRetVal;
}
-
+// -------------------------------------------------------------------
extern "C" void NeonSession_ProgressNotify( void * userdata,
off_t progress,
off_t total )
@@ -330,6 +320,7 @@ extern "C" void NeonSession_ProgressNotify( void * userdata,
// total: total bytes to read, -1 -> total count not known
}
+// -------------------------------------------------------------------
extern "C" void NeonSession_StatusNotify( void * userdata,
ne_conn_status status,
const char *info )
@@ -346,6 +337,7 @@ extern "C" void NeonSession_StatusNotify( void * userdata,
// info: hostname
}
+// -------------------------------------------------------------------
extern "C" void NeonSession_PreSendRequest( ne_request * req,
void * userdata,
ne_buffer * headers )
@@ -391,6 +383,7 @@ extern "C" void NeonSession_PreSendRequest( ne_request * req,
}
}
+// -------------------------------------------------------------------
extern "C" void NeonSession_ResponseHeaderCatcher( void * userdata,
const char * value )
{
@@ -453,8 +446,7 @@ NeonSession::NeonSession(
const ProxyConfig& rProxyCfg )
throw ( DAVException )
: DAVSession( rSessionFactory ),
- m_pRequestData( new RequestDataMap ),
- m_pListener( 0 )
+ m_pRequestData( new RequestDataMap )
{
// @@@ We need to keep the char buffer for hostname and proxyname
// for the whole session lifetime because neon only stores a pointer
@@ -462,27 +454,91 @@ NeonSession::NeonSession(
// by having the members mHostName and mProxyName, which are OStrings!
NeonUri theUri( inUri );
-
- m_aScheme = theUri.GetScheme();
-
- m_aHostName = theUri.GetHost();
- m_nPort = theUri.GetPort();
+ m_aScheme = theUri.GetScheme();
+ m_aHostName = theUri.GetHost();
+ m_nPort = theUri.GetPort();
m_aProxyName = rProxyCfg.aName;
m_nProxyPort = rProxyCfg.nPort;
+ // Note: Uses m_aHostName and m_nPort (in case of error)
Init();
- m_pHttpSession = CreateSession( m_aScheme,
- m_aHostName,
- m_nPort,
- m_aProxyName,
- m_nProxyPort,
- theUri.GetUserInfo() );
- if ( !m_pHttpSession )
+ // @@@ 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
+
+ m_pHttpSession = ne_session_create(
+ rtl::OUStringToOString( m_aScheme,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ /* theUri.GetUserInfo(),
+ @@@ for FTP via HTTP proxy, but not supported by Neon */
+ rtl::OUStringToOString( m_aHostName,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ m_nPort );
+
+ if ( m_pHttpSession == 0 )
throw DAVException( DAVException::DAV_SESSION_CREATE,
theUri.makeConnectionEndPointString() );
+ // Set a progress callback for the session.
+ ne_set_progress( m_pHttpSession, NeonSession_ProgressNotify, this );
+
+ // Set a status notification callback for the session, to report
+ // connection status.
+ ne_set_status( m_pHttpSession, NeonSession_StatusNotify, this );
+
+ // 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ ne_hook_destroy_session( m_pHttpSession, destroy_sess_hook_fn, this );
+#endif
+
+ if ( m_aProxyName.getLength() )
+ {
+ ne_session_proxy( m_pHttpSession,
+ rtl::OUStringToOString( m_aProxyName,
+ RTL_TEXTENCODING_UTF8 )
+ .getStr(),
+ m_nProxyPort );
+ }
+
// Note: Uncomment the following if locking support is required
/*
mNeonLockSession = ne_lock_register( m_pHttpSession );
@@ -494,6 +550,14 @@ NeonSession::NeonSession(
// Register for redirects.
ne_redirect_register( m_pHttpSession );
+
+ // authentication callbacks.
+
+ // Note: Calling ne_set_[server|proxy]_auth more than once per
+ // m_pHttpSession instance sometimes(?) crashes Neon! ( last
+ // checked: 0.22.0)
+ ne_set_server_auth( m_pHttpSession, NeonSession_NeonAuth, this );
+ ne_set_proxy_auth ( m_pHttpSession, NeonSession_NeonAuth, this );
}
// -------------------------------------------------------------------
@@ -531,55 +595,16 @@ sal_Bool NeonSession::CanUse( const rtl::OUString & inUri )
}
// -------------------------------------------------------------------
-void NeonSession::setServerAuthListener( DAVAuthListener * inDAVAuthListener )
-{
-// OSL_ENSURE( m_pListener == 0, "Authentication listener already set!" );
-
- // @@@ Neon ( last checked: 0.22.0) cannot handle multiple callbacks.
- // Calling ne_set_server_auth more than once sometimes crashes Neon!
- if ( m_pListener == 0 )
- {
- osl::Guard< osl::Mutex > theGuard( m_aMutex );
- if ( m_pListener == 0 )
- {
- m_pListener = inDAVAuthListener;
- ne_set_server_auth( m_pHttpSession, NeonSession_NeonAuth, this );
- }
- }
-}
-
-// -------------------------------------------------------------------
-void NeonSession::setProxyAuthListener( DAVAuthListener * inDAVAuthListener )
-{
- // Note: Content is currently not using proxy auth
-}
-
-// -------------------------------------------------------------------
-void NeonSession::setUserName( const rtl::OUString & rUserName )
-{
- osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_aPrevUserName = rUserName;
-}
-
-// -------------------------------------------------------------------
-void NeonSession::setPassWord( const rtl::OUString & rPassWord )
-{
- osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_aPrevPassWord = rPassWord;
-}
-
-// -------------------------------------------------------------------
// OPTIONS
// -------------------------------------------------------------------
void NeonSession::OPTIONS( const rtl::OUString & inPath,
DAVCapabilities & outCapabilities,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
HttpServerCapabilities servercaps;
memset( &servercaps, 0, sizeof( servercaps ) );
@@ -602,13 +627,12 @@ void NeonSession::PROPFIND( const rtl::OUString & inPath,
const Depth inDepth,
const std::vector< rtl::OUString > & inPropNames,
std::vector< DAVResource > & ioResources,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
int theRetVal = NE_OK;
NeonPropFindRequest theRequest( m_pHttpSession,
@@ -627,13 +651,12 @@ void NeonSession::PROPFIND( const rtl::OUString & inPath,
void NeonSession::PROPFIND( const rtl::OUString & inPath,
const Depth inDepth,
std::vector< DAVResourceInfo >& ioResInfo,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
int theRetVal = NE_OK;
NeonPropFindRequest theRequest( m_pHttpSession,
@@ -650,8 +673,7 @@ void NeonSession::PROPFIND( const rtl::OUString & inPath,
// -------------------------------------------------------------------
void NeonSession::PROPPATCH( const rtl::OUString & inPath,
const std::vector< ProppatchValue > & inValues,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException )
{
/* @@@ Which standard live properties can be set by the client?
@@ -752,6 +774,10 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath,
if ( theRetVal == NE_OK )
{
+ osl::Guard< osl::Mutex > theGuard( m_aMutex );
+
+ m_aEnv = rEnv;
+
pItems[ n ].name = NULL;
theRetVal = ne_proppatch( m_pHttpSession,
@@ -776,13 +802,12 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath,
void NeonSession::HEAD( const ::rtl::OUString & inPath,
const std::vector< ::rtl::OUString > & inHeaderNames,
DAVResource & ioResource,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
int theRetVal = NE_OK;
NeonHeadRequest theRequest( m_pHttpSession,
@@ -798,13 +823,12 @@ void NeonSession::HEAD( const ::rtl::OUString & inPath,
// -------------------------------------------------------------------
uno::Reference< io::XInputStream > NeonSession::GET(
const rtl::OUString & inPath,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
rtl::Reference< NeonInputStream > xInputStream( new NeonInputStream );
NeonRequestContext aCtx( xInputStream );
@@ -823,13 +847,12 @@ uno::Reference< io::XInputStream > NeonSession::GET(
// -------------------------------------------------------------------
void NeonSession::GET( const rtl::OUString & inPath,
uno::Reference< io::XOutputStream > & ioOutputStream,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
NeonRequestContext aCtx( ioOutputStream );
int theRetVal = GET( m_pHttpSession,
@@ -848,12 +871,12 @@ uno::Reference< io::XInputStream > NeonSession::GET(
const rtl::OUString & inPath,
const std::vector< ::rtl::OUString > & inHeaderNames,
DAVResource & ioResource,
- const uno::Reference< ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
ioResource.uri = inPath;
ioResource.properties.clear();
@@ -878,12 +901,12 @@ void NeonSession::GET(
uno::Reference< io::XOutputStream > & ioOutputStream,
const std::vector< ::rtl::OUString > & inHeaderNames,
DAVResource & ioResource,
- const uno::Reference< ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
ioResource.uri = inPath;
ioResource.properties.clear();
@@ -903,13 +926,12 @@ void NeonSession::GET(
// -------------------------------------------------------------------
void NeonSession::PUT( const rtl::OUString & inPath,
const uno::Reference< io::XInputStream > & inInputStream,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
uno::Sequence< sal_Int8 > aDataToSend;
if ( !getDataFromInputStream( inInputStream, aDataToSend ) )
@@ -936,7 +958,7 @@ uno::Reference< io::XInputStream > NeonSession::POST(
const rtl::OUString & rContentType,
const rtl::OUString & rReferer,
const uno::Reference< io::XInputStream > & inInputStream,
- const uno::Reference< ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
@@ -948,7 +970,7 @@ uno::Reference< io::XInputStream > NeonSession::POST(
return uno::Reference< io::XInputStream >();
}
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
rtl::Reference< NeonInputStream > xInputStream( new NeonInputStream );
NeonRequestContext aCtx( xInputStream );
@@ -974,7 +996,7 @@ void NeonSession::POST( const rtl::OUString & inPath,
const rtl::OUString & rReferer,
const uno::Reference< io::XInputStream > & inInputStream,
uno::Reference< io::XOutputStream > & oOutputStream,
- const uno::Reference< ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
@@ -985,7 +1007,7 @@ void NeonSession::POST( const rtl::OUString & inPath,
// @@@ error
}
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
NeonRequestContext aCtx( oOutputStream );
int theRetVal = POST( m_pHttpSession,
@@ -1005,13 +1027,12 @@ void NeonSession::POST( const rtl::OUString & inPath,
// MKCOL
// -------------------------------------------------------------------
void NeonSession::MKCOL( const rtl::OUString & inPath,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
int theRetVal = ne_mkcol( m_pHttpSession,
rtl::OUStringToOString(
@@ -1022,16 +1043,15 @@ void NeonSession::MKCOL( const rtl::OUString & inPath,
// -------------------------------------------------------------------
// COPY
// -------------------------------------------------------------------
-void NeonSession::COPY( const rtl::OUString & inSourceURL,
- const rtl::OUString & inDestinationURL,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv,
- sal_Bool inOverWrite )
+void NeonSession::COPY( const rtl::OUString & inSourceURL,
+ const rtl::OUString & inDestinationURL,
+ const DAVRequestEnvironment & rEnv,
+ sal_Bool inOverWrite )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
NeonUri theSourceUri( inSourceURL );
NeonUri theDestinationUri( inDestinationURL );
@@ -1051,16 +1071,15 @@ void NeonSession::COPY( const rtl::OUString & inSourceURL,
// -------------------------------------------------------------------
// MOVE
// -------------------------------------------------------------------
-void NeonSession::MOVE( const rtl::OUString & inSourceURL,
- const rtl::OUString & inDestinationURL,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv,
- sal_Bool inOverWrite )
+void NeonSession::MOVE( const rtl::OUString & inSourceURL,
+ const rtl::OUString & inDestinationURL,
+ const DAVRequestEnvironment & rEnv,
+ sal_Bool inOverWrite )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
NeonUri theSourceUri( inSourceURL );
NeonUri theDestinationUri( inDestinationURL );
@@ -1079,13 +1098,12 @@ void NeonSession::MOVE( const rtl::OUString & inSourceURL,
// DESTROY
// -------------------------------------------------------------------
void NeonSession::DESTROY( const rtl::OUString & inPath,
- const uno::Reference<
- ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- m_xEnv = inEnv;
+ m_aEnv = rEnv;
int theRetVal = ne_delete( m_pHttpSession,
rtl::OUStringToOString(
@@ -1099,10 +1117,12 @@ void NeonSession::DESTROY( const rtl::OUString & inPath,
// Note: Uncomment the following if locking support is required
/*
void NeonSession::LOCK( const Lock & inLock,
- const uno::Reference< ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
- m_xEnv = inEnv;
+ osl::Guard< osl::Mutex > theGuard( m_aMutex );
+
+ m_aEnv = rEnv;
Lockit( inLock, true );
}
@@ -1114,9 +1134,13 @@ void NeonSession::LOCK( const Lock & inLock,
// Note: Uncomment the following if locking support is required
/*
void NeonSession::UNLOCK( const Lock & inLock,
- const uno::Reference< ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
+ osl::Guard< osl::Mutex > theGuard( m_aMutex );
+
+ m_aEnv = rEnv;
+
Lockit( inLock, false );
}
*/
@@ -1145,14 +1169,13 @@ void NeonSession::Init( void )
void NeonSession::HandleError( int nError )
throw ( DAVException )
{
- m_xEnv = 0;
+ m_aEnv = DAVRequestEnvironment();
// Map error code to DAVException.
switch ( nError )
{
case NE_OK:
// Cleanup.
- m_aPrevUserName = m_aPrevPassWord = rtl::OUString();
return;
case NE_ERROR: // Generic error
@@ -1215,103 +1238,6 @@ void NeonSession::HandleError( int nError )
}
}
-// -------------------------------------------------------------------
-// CreateSession
-// Creates a new neon session.
-// -------------------------------------------------------------------
-HttpSession * NeonSession::CreateSession( const ::rtl::OUString & inScheme,
- const rtl::OUString & inHostName,
- int inPort,
- const rtl::OUString & inProxyName,
- int inProxyPort,
- const rtl::OUString & inUserInfo )
- throw ( DAVException )
-{
- if ( inHostName.getLength() == 0 || inPort <= 0 )
- throw DAVException( DAVException::DAV_INVALID_ARG );
-
- // @@@ For FTP over HTTP proxy inUserInfo is needed to be able to
- // build the complete request URI (including user:pass), but
- // currently (0.21.3) neon does not allow to pass the user info
- // to the session
-
- HttpSession* theHttpSession = ne_session_create(
- rtl::OUStringToOString( inScheme,
- RTL_TEXTENCODING_UTF8 ).getStr(),
- /* inUserInfo,
- @@@ for FTP via HTTP proxy, but not supported by Neon */
- rtl::OUStringToOString( inHostName,
- RTL_TEXTENCODING_UTF8 ).getStr(),
- inPort );
-
- if ( theHttpSession == 0 )
- throw DAVException( DAVException::DAV_SESSION_CREATE,
- NeonUri::makeConnectionEndPointString(
- inHostName, inPort ) );
-
- // Set a progress callback for the session.
- ne_set_progress(
- theHttpSession, NeonSession_ProgressNotify, theHttpSession );
-
- // Set a status notification callback for the session, to report
- // connection status.
- ne_set_status(
- theHttpSession, NeonSession_StatusNotify, theHttpSession );
-
- // 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);
-
- ne_hook_create_request( theHttpSession, 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);
-
- ne_hook_pre_send(
- theHttpSession, 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);
-
- ne_hook_post_send( theHttpSession, post_send_req_hook_fn, this );
-
- /* Hook called when the request is destroyed. */
- //typedef void (*ne_destroy_req_fn)(ne_request *req, void *userdata);
-
- ne_hook_destroy_request( theHttpSession, destroy_req_hook_fn, this );
-
- /* Hook called when the session is destroyed. */
- //typedef void (*ne_destroy_sess_fn)(void *userdata);
-
- ne_hook_destroy_session( theHttpSession, destroy_sess_hook_fn, this );
-#endif
-
- if ( inProxyName.getLength() )
- {
- ne_session_proxy( theHttpSession,
- rtl::OUStringToOString( inProxyName,
- RTL_TEXTENCODING_UTF8 )
- .getStr(),
- inProxyPort );
- }
-
- return theHttpSession;
-}
-
// Note: Uncomment the following if locking support is required
/*
void NeonSession::Lockit( const Lock & inLock, bool inLockit )
@@ -1450,8 +1376,8 @@ int NeonSession::POST( ne_session * sess,
if ( rContentType.getLength() || rReferer.getLength() )
{
- // Remember contenttype and referer. Data will be adde to HTTP request
- // header in in 'PresendRequest' callback.
+ // Remember contenttype and referer. Data will be added to HTTP request
+ // header in in 'PreSendRequest' callback.
pData = static_cast< RequestDataMap* >( m_pRequestData );
(*pData)[ req ] = RequestData( rContentType, rReferer );
}
diff --git a/ucb/source/ucp/webdav/NeonSession.hxx b/ucb/source/ucp/webdav/NeonSession.hxx
index b47e44903694..787e5f92ca2c 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.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: kso $ $Date: 2002-09-16 14:37:12 $
+ * last change: $Author: kso $ $Date: 2002-09-18 12:46:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -93,31 +93,18 @@ class NeonSession : public DAVSession
sal_Int32 m_nPort;
sal_Int32 m_nProxyPort;
HttpSession * m_pHttpSession;
-
void * m_pRequestData;
// @@@ This should really be per-request data. A NeonSession
- // instance can handle multiple requests at a time!!!
- DAVAuthListener * m_pListener;
+ // instance can handle multiple requests at a time!!! But Neon
+ // currently has no better interface!
+ DAVRequestEnvironment m_aEnv;
// Note: Uncomment the following if locking support is required
// NeonLockSession * mNeonLockSession;
static sal_Bool m_bSockInited;
- // @@@ This should really be per-request data. A NeonSession
- // instance can handle multiple requests at a time!!!
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > m_xEnv;
-
- // @@@ This should really be per-request data. A NeonSession
- // instance can handle multiple requests at a time!!!
- // Username/password entered during last request. Cleared, if
- // request was processed successfully. Kept as long as request
- // returns with an error.
- rtl::OUString m_aPrevUserName;
- rtl::OUString m_aPrevPassWord;
-
protected:
virtual ~NeonSession();
@@ -130,31 +117,17 @@ class NeonSession : public DAVSession
// DAVSession methods
virtual sal_Bool CanUse( const ::rtl::OUString & inUri );
- virtual void setServerAuthListener(DAVAuthListener * inDAVAuthListener);
- virtual void setProxyAuthListener(DAVAuthListener * inDAVAuthListener);
-
- DAVAuthListener * getServerAuthListener() const
- { return m_pListener; }
-
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > &
- getCommandEnvironment() const { return m_xEnv; }
-
const rtl::OUString & getHostName() const { return m_aHostName; }
const void * getRequestData() const { return m_pRequestData; }
- const rtl::OUString & getUserName() const { return m_aPrevUserName; }
- const rtl::OUString & getPassWord() const { return m_aPrevPassWord; }
-
- void setUserName( const rtl::OUString & rUserName );
- void setPassWord( const rtl::OUString & rPassWord );
+ const DAVRequestEnvironment & getRequestEnvironment() const
+ { return m_aEnv; }
virtual void
OPTIONS( const ::rtl::OUString & inPath,
DAVCapabilities & outCapabilities,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
// allprop & named
@@ -163,8 +136,7 @@ class NeonSession : public DAVSession
const Depth inDepth,
const std::vector< ::rtl::OUString > & inPropNames,
std::vector< DAVResource > & ioResources,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
// propnames
@@ -172,38 +144,33 @@ class NeonSession : public DAVSession
PROPFIND( const ::rtl::OUString & inPath,
const Depth inDepth,
std::vector< DAVResourceInfo >& ioResInfo,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual void
PROPPATCH( const ::rtl::OUString & inPath,
const std::vector< ProppatchValue > & inValues,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException );
virtual void
HEAD( const ::rtl::OUString & inPath,
const std::vector< ::rtl::OUString > & inHeaderNames,
DAVResource & ioResource,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw( DAVException );
virtual com::sun::star::uno::Reference<
com::sun::star::io::XInputStream >
GET( const ::rtl::OUString & inPath,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual void
GET( const ::rtl::OUString & inPath,
com::sun::star::uno::Reference<
com::sun::star::io::XOutputStream > & ioOutputStream,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual com::sun::star::uno::Reference<
@@ -211,8 +178,7 @@ class NeonSession : public DAVSession
GET( const ::rtl::OUString & inPath,
const std::vector< ::rtl::OUString > & inHeaderNames,
DAVResource & ioResource,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual void
@@ -221,16 +187,14 @@ class NeonSession : public DAVSession
com::sun::star::io::XOutputStream > & ioOutputStream,
const std::vector< ::rtl::OUString > & inHeaderNames,
DAVResource & ioResource,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual void
PUT( const ::rtl::OUString & inPath,
const com::sun::star::uno::Reference<
com::sun::star::io::XInputStream > & inInputStream,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual com::sun::star::uno::Reference<
@@ -240,8 +204,7 @@ class NeonSession : public DAVSession
const rtl::OUString & rReferer,
const com::sun::star::uno::Reference<
com::sun::star::io::XInputStream > & inInputStream,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual void
@@ -252,47 +215,40 @@ class NeonSession : public DAVSession
com::sun::star::io::XInputStream > & inInputStream,
com::sun::star::uno::Reference<
com::sun::star::io::XOutputStream > & oOutputStream,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual void
MKCOL( const ::rtl::OUString & inPath,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual void
COPY( const ::rtl::OUString & inSourceURL,
const ::rtl::OUString & inDestinationURL,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv,
+ const DAVRequestEnvironment & rEnv,
sal_Bool inOverWrite )
throw ( DAVException );
virtual void
MOVE( const ::rtl::OUString & inSourceURL,
const ::rtl::OUString & inDestinationURL,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv,
+ const DAVRequestEnvironment & rEnv,
sal_Bool inOverWrite )
throw ( DAVException );
virtual void DESTROY( const ::rtl::OUString & inPath,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
// Note: Uncomment the following if locking support is required
/*
virtual void LOCK (const Lock & inLock,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
virtual void UNLOCK (const Lock & inLock,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& inEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException );
*/
@@ -304,20 +260,10 @@ class NeonSession : public DAVSession
void HandleError( int nError )
throw ( DAVException );
- // Create a Neon session for server at supplied host & port
- HttpSession * CreateSession( const ::rtl::OUString & inScheme,
- const ::rtl::OUString & inHostName,
- int inPort,
- const ::rtl::OUString & inProxyName,
- int inProxyPort,
- const ::rtl::OUString & inUserInfo )
- throw( DAVException );
-
// Note: Uncomment the following if locking support is required
// void Lockit( const Lock & inLock, bool inLockit )
// throw ( DAVException );
-
// low level GET implementation, used by public GET implementations
static int GET( ne_session * sess,
const char * uri,