[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 23 commits - config_host.mk.in configure.ac download.lst external/apr external/Module_external.mk external/serf Makefile.fetch postprocess/CustomTarget_registry.mk postprocess/Rdb_services.mk RepositoryExternal.mk Repository.mk solenv/gbuild ucb/Library_ucpdav1.mk ucb/Module_ucb.mk ucb/source

Matúš Kukan matus.kukan at collabora.com
Wed Apr 2 13:07:25 PDT 2014


 Makefile.fetch                                        |    3 
 Repository.mk                                         |    2 
 RepositoryExternal.mk                                 |   52 +++
 config_host.mk.in                                     |    8 
 configure.ac                                          |   83 ++++--
 download.lst                                          |    6 
 external/Module_external.mk                           |    2 
 external/apr/ExternalProject_apr.mk                   |   38 ++
 external/apr/ExternalProject_apr_util.mk              |   41 +++
 external/apr/Makefile                                 |    7 
 external/apr/Module_apr.mk                            |   19 +
 external/apr/README                                   |    5 
 external/apr/UnpackedTarball_apr.mk                   |   14 +
 external/apr/UnpackedTarball_apr_util.mk              |   22 +
 external/apr/windows.build.patch.1                    |   53 +++
 external/serf/ExternalProject_serf.mk                 |   48 +++
 external/serf/Makefile                                |    7 
 external/serf/Module_serf.mk                          |   17 +
 external/serf/README                                  |    4 
 external/serf/UnpackedTarball_serf.mk                 |   22 +
 external/serf/windows.build.patch.1                   |   29 ++
 postprocess/CustomTarget_registry.mk                  |    2 
 postprocess/Rdb_services.mk                           |    2 
 solenv/gbuild/ExternalProject.mk                      |    1 
 solenv/gbuild/platform/com_GCC_class.mk               |    1 
 solenv/gbuild/platform/com_MSC_class.mk               |   10 
 ucb/Library_ucpdav1.mk                                |   54 ++++
 ucb/Module_ucb.mk                                     |    7 
 ucb/source/ucp/webdav/AprEnv.cxx                      |    9 
 ucb/source/ucp/webdav/AprEnv.hxx                      |    8 
 ucb/source/ucp/webdav/ContentProperties.cxx           |   46 +--
 ucb/source/ucp/webdav/ContentProperties.hxx           |   11 
 ucb/source/ucp/webdav/DAVProperties.cxx               |   14 -
 ucb/source/ucp/webdav/DAVResourceAccess.cxx           |   16 -
 ucb/source/ucp/webdav/DAVResourceAccess.hxx           |    4 
 ucb/source/ucp/webdav/DAVSessionFactory.cxx           |    8 
 ucb/source/ucp/webdav/DAVSessionFactory.hxx           |    8 
 ucb/source/ucp/webdav/PropertyMap.hxx                 |    4 
 ucb/source/ucp/webdav/SerfCallbacks.cxx               |    5 
 ucb/source/ucp/webdav/SerfCallbacks.hxx               |    5 
 ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx         |  202 +++++++++++++++
 ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx         |   67 +++++
 ucb/source/ucp/webdav/SerfLockStore.cxx               |   79 ++---
 ucb/source/ucp/webdav/SerfLockStore.hxx               |   55 +---
 ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx         |   15 -
 ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx     |   46 +--
 ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx    |   22 -
 ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx          |   22 -
 ucb/source/ucp/webdav/SerfRequestProcessor.cxx        |   88 ++++--
 ucb/source/ucp/webdav/SerfRequestProcessor.hxx        |    7 
 ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx    |   42 ++-
 ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx    |    9 
 ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx |  221 ----------------
 ucb/source/ucp/webdav/SerfRequestProcessorImplFac.hxx |  115 --------
 ucb/source/ucp/webdav/SerfSession.cxx                 |  239 ++++--------------
 ucb/source/ucp/webdav/SerfSession.hxx                 |   16 -
 ucb/source/ucp/webdav/SerfTypes.hxx                   |    3 
 ucb/source/ucp/webdav/SerfUnlockReqProcImpl.cxx       |   68 +++++
 ucb/source/ucp/webdav/SerfUnlockReqProcImpl.hxx       |   54 ++++
 ucb/source/ucp/webdav/SerfUri.cxx                     |   24 -
 ucb/source/ucp/webdav/SerfUri.hxx                     |    2 
 ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx        |   21 -
 ucb/source/ucp/webdav/webdavcontent.cxx               |  223 ++++++++--------
 ucb/source/ucp/webdav/webdavcontent.hxx               |   30 +-
 ucb/source/ucp/webdav/webdavcontentcaps.cxx           |    6 
 ucb/source/ucp/webdav/webdavdatasupplier.cxx          |   12 
 ucb/source/ucp/webdav/webdavdatasupplier.hxx          |    2 
 ucb/source/ucp/webdav/webdavprovider.cxx              |   88 ------
 ucb/source/ucp/webdav/webdavprovider.hxx              |    2 
 ucb/source/ucp/webdav/webdavresponseparser.cxx        |  140 +++++++---
 ucb/source/ucp/webdav/webdavresponseparser.hxx        |   10 
 ucb/source/ucp/webdav/webdavresultset.cxx             |    8 
 ucb/source/ucp/webdav/webdavservices.cxx              |   10 
 ucb/source/ucp/webdav/webdavuseragent.hxx             |   34 --
 74 files changed, 1527 insertions(+), 1152 deletions(-)

New commits:
commit 18df3732dee6d6d6215ddfc2f8f999a65bd14d6b
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Wed Mar 26 16:17:21 2014 +0100

    webdav: Workaround failing unlocking by ignoring certificates when closing.
    
    In neon version, we use xml::crypto::SEInitializer in
    NeonSession_CertificationNotify which I see called only once.
    For some reason in serf, Serf_ConnectSetup is called every time
    we send a command to the server. But that leads to not working
    verifySerfCertificateChain in __run_exit_handlers because
    xml::crypto::SEInitializer is not available anymore.
    
    (cherry picked from commit 2d832c264801a8b1e155d33d1506af55dc6e207f)
    
    Conflicts:
    	ucb/source/ucp/webdav/SerfLockStore.cxx
    
    Change-Id: I15685256790375dd86eb1b7614da25838d5ce244

diff --git a/ucb/source/ucp/webdav/SerfLockStore.cxx b/ucb/source/ucp/webdav/SerfLockStore.cxx
index 7a0795b..514c13f 100644
--- a/ucb/source/ucp/webdav/SerfLockStore.cxx
+++ b/ucb/source/ucp/webdav/SerfLockStore.cxx
@@ -75,6 +75,7 @@ void TickerThread::run()
 // -------------------------------------------------------------------
 SerfLockStore::SerfLockStore()
     : m_pTickerThread( 0 )
+    , m_bFinishing( false )
 {
 }
 
@@ -82,6 +83,7 @@ SerfLockStore::SerfLockStore()
 SerfLockStore::~SerfLockStore()
 {
     stopTicker();
+    m_bFinishing = true;
 
     // release active locks, if any.
     OSL_ENSURE( m_aLockInfoMap.size() == 0,
@@ -97,7 +99,11 @@ SerfLockStore::~SerfLockStore()
     }
 }
 
-// -------------------------------------------------------------------
+bool SerfLockStore::finishing() const
+{
+    return m_bFinishing;
+}
+
 void SerfLockStore::startTicker()
 {
     osl::MutexGuard aGuard( m_aMutex );
diff --git a/ucb/source/ucp/webdav/SerfLockStore.hxx b/ucb/source/ucp/webdav/SerfLockStore.hxx
index eefd7b8..0444359 100644
--- a/ucb/source/ucp/webdav/SerfLockStore.hxx
+++ b/ucb/source/ucp/webdav/SerfLockStore.hxx
@@ -56,12 +56,14 @@ class SerfLockStore
 {
     osl::Mutex         m_aMutex;
     TickerThread     * m_pTickerThread;
+    bool               m_bFinishing;
     LockInfoMap        m_aLockInfoMap;
 
 public:
     SerfLockStore();
     ~SerfLockStore();
 
+    bool finishing() const;
     OUString getLockToken( const OUString& rLock );
 
     void addLock( const OUString& rLock,
diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx
index 3f024cb..938c610 100644
--- a/ucb/source/ucp/webdav/SerfSession.cxx
+++ b/ucb/source/ucp/webdav/SerfSession.cxx
@@ -348,6 +348,13 @@ apr_status_t SerfSession::verifySerfCertificateChain (
         return SERF_SSL_CERT_UNKNOWN_FAILURE;
     }
 
+    // When called from SerfLockStore::~SerfLockStore(),
+    // css::xml::crypto::SEInitializer::create() will fail
+    // but we want to send unlock commands anyway,
+    // so just ignore certificates and return here.
+    if (apr_environment::AprEnv::getAprEnv()->getSerfLockStore()->finishing())
+        return APR_SUCCESS;
+
     // Create some crypto objects to decode and handle the base64
     // encoded certificate chain.
     uno::Reference< xml::crypto::XSEInitializer > xSEInitializer;
commit dc3cd43dbb14f2e23f9406da21b546daefd384c7
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Mar 25 12:19:35 2014 +0100

    webdav: Implement refreshing of locks.
    
    (cherry picked from commit 166a934cdf6b3adc89bca8ce6b2489d225c75309)
    
    Conflicts:
    	ucb/source/ucp/webdav/SerfSession.cxx
    
    Change-Id: Ia4a1c7b929dac473dfb5a5fa233c7f0c662a95c6

diff --git a/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
index 9e16212..ff766ef 100644
--- a/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
+++ b/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
@@ -32,10 +32,12 @@ namespace http_dav_ucp
 SerfLockReqProcImpl::SerfLockReqProcImpl( const char* inPath,
                                           const DAVRequestHeaders& inRequestHeaders,
                                           SerfSession& rSession,
-                                          const css::ucb::Lock & rLock )
+                                          const css::ucb::Lock& rLock,
+                                          sal_Int32* plastChanceToSendRefreshRequest )
     : SerfRequestProcessorImpl( inPath, inRequestHeaders )
     , m_rSession( rSession )
     , m_aLock( rLock )
+    , m_plastChanceToSendRefreshRequest( plastChanceToSendRefreshRequest )
     , m_xInputStream( new SerfInputStream() )
 {
 }
@@ -76,9 +78,12 @@ serf_bucket_t * SerfLockReqProcImpl::createSerfRequestBucket( serf_request_t * i
     aBody.append("</lockinfo>\n");
 
     const OString aBodyText(aBody.makeStringAndClear());
-    serf_bucket_t* body_bkt = serf_bucket_simple_copy_create( aBodyText.getStr(),
-                                                              aBodyText.getLength(),
-                                                              pSerfBucketAlloc );
+    serf_bucket_t* body_bkt = 0;
+
+    if (!m_plastChanceToSendRefreshRequest)
+        body_bkt = serf_bucket_simple_copy_create( aBodyText.getStr(),
+                                                   aBodyText.getLength(),
+                                                   pSerfBucketAlloc );
 
     // create serf request
     serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
@@ -86,7 +91,8 @@ serf_bucket_t * SerfLockReqProcImpl::createSerfRequestBucket( serf_request_t * i
                                                                  getPathStr(),
                                                                  body_bkt,
                                                                  pSerfBucketAlloc );
-    handleChunkedEncoding(req_bkt, aBodyText.getLength());
+    if (!m_plastChanceToSendRefreshRequest)
+        handleChunkedEncoding(req_bkt, aBodyText.getLength());
 
     // set request header fields
     serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
@@ -110,8 +116,18 @@ serf_bucket_t * SerfLockReqProcImpl::createSerfRequestBucket( serf_request_t * i
         default:
             throw DAVException( DAVException::DAV_INVALID_ARG );
     }
-    serf_bucket_headers_set( hdrs_bkt, "Depth", depth );
-    serf_bucket_headers_set( hdrs_bkt, "Content-Type", "application/xml" );
+    if (!m_plastChanceToSendRefreshRequest)
+    {
+        serf_bucket_headers_set( hdrs_bkt, "Depth", depth );
+        serf_bucket_headers_set( hdrs_bkt, "Content-Type", "application/xml" );
+    }
+    else
+    {
+        const OString sToken( "(<" + OUStringToOString( apr_environment::AprEnv::getAprEnv()->
+                    getSerfLockStore()->getLockToken( OUString::createFromAscii(getPathStr())),
+                    RTL_TEXTENCODING_UTF8 ) + ">)" );
+        serf_bucket_headers_set( hdrs_bkt, "If", sToken.getStr() );
+    }
 
     // Set the lock timeout
     if (m_aLock.Timeout == -1)
@@ -121,6 +137,8 @@ serf_bucket_t * SerfLockReqProcImpl::createSerfRequestBucket( serf_request_t * i
         const OString aTimeValue("Second-" + OString::number(m_aLock.Timeout));
         serf_bucket_headers_set( hdrs_bkt, "Timeout", aTimeValue.getStr() );
     }
+    else
+        serf_bucket_headers_set( hdrs_bkt, "Timeout", "Second-180" );
 
     osl_getSystemTime( &m_aStartCall );
 
@@ -158,6 +176,13 @@ void SerfLockReqProcImpl::handleEndOfResponseData( serf_bucket_t * )
                 else
                     SAL_WARN("ucb.ucp.webdav", "No chance to refresh lock before timeout!" );
             }
+            if (m_plastChanceToSendRefreshRequest)
+            {
+                *m_plastChanceToSendRefreshRequest = lastChanceToSendRefreshRequest;
+                assert(aLocks.size() == 1);
+                // We are just refreshing lock, do not add it into SerfLockStore
+                break;
+            }
             apr_environment::AprEnv::getAprEnv()->getSerfLockStore()->addLock(
                     OUString::createFromAscii(getPathStr()),
                     aLocks[i].LockTokens[0],
diff --git a/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
index 766bc2b..9341a40 100644
--- a/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
+++ b/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
@@ -37,7 +37,8 @@ public:
     SerfLockReqProcImpl( const char* inPath,
                          const DAVRequestHeaders& inRequestHeaders,
                          SerfSession& rSession,
-                         const css::ucb::Lock & rLock );
+                         const css::ucb::Lock& rLock,
+                         sal_Int32* plastChanceToSendRefreshRequest = 0 );
 
     virtual ~SerfLockReqProcImpl() SAL_OVERRIDE;
 
@@ -53,6 +54,8 @@ private:
 
     SerfSession& m_rSession;
     css::ucb::Lock m_aLock;
+    // if m_plastChanceToSendRefreshRequest is not 0 we are sending just refresh request
+    sal_Int32* m_plastChanceToSendRefreshRequest;
     TimeValue m_aStartCall;
     css::uno::Reference< SerfInputStream > m_xInputStream;
 };
diff --git a/ucb/source/ucp/webdav/SerfLockStore.cxx b/ucb/source/ucp/webdav/SerfLockStore.cxx
index 16ee5e6..7a0795b 100644
--- a/ucb/source/ucp/webdav/SerfLockStore.cxx
+++ b/ucb/source/ucp/webdav/SerfLockStore.cxx
@@ -196,8 +196,7 @@ void SerfLockStore::refreshLocks()
                 // refresh the lock.
                 sal_Int32 nlastChanceToSendRefreshRequest = -1;
                 if ( rInfo.m_xSession->LOCK(
-                         (*it).first,
-                         /* out param */ nlastChanceToSendRefreshRequest ) )
+                         (*it).first, &nlastChanceToSendRefreshRequest ) )
                 {
                     rInfo.m_nLastChanceToSendRefreshRequest
                         = nlastChanceToSendRefreshRequest;
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
index ced9d5b..ddeecca 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
@@ -313,12 +313,13 @@ bool SerfRequestProcessor::processMove( const OUString & inDestinationPath,
 }
 
 
-bool SerfRequestProcessor::processLock( const css::ucb::Lock & rLock )
+bool SerfRequestProcessor::processLock( const css::ucb::Lock & rLock, sal_Int32 *plastChanceToSendRefreshRequest )
 {
     mpProcImpl = new SerfLockReqProcImpl( mPathStr,
                                           mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                           mrSerfSession,
-                                          rLock );
+                                          rLock,
+                                          plastChanceToSendRefreshRequest );
 
     return runProcessor() == APR_SUCCESS;
 }
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.hxx b/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
index 7e4573f..ef0987f 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
@@ -126,7 +126,7 @@ public:
                       apr_status_t& outSerfStatus );
 
     //LOCK
-    bool processLock( const css::ucb::Lock & rLock );
+    bool processLock( const css::ucb::Lock & rLock, sal_Int32 *plastChanceToSendRefreshRequest = 0 );
 
     //UNLOCK
     bool processUnlock();
diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx
index bfb7bba..3f024cb 100644
--- a/ucb/source/ucp/webdav/SerfSession.cxx
+++ b/ucb/source/ucp/webdav/SerfSession.cxx
@@ -1023,32 +1023,25 @@ sal_Int64 SerfSession::LOCK( const OUString & /*inPath*/,
 
 // -------------------------------------------------------------------
 // LOCK (refresh existing lock)
-bool SerfSession::LOCK( const OUString& /*rLock*/,
-                        sal_Int32 & /*rlastChanceToSendRefreshRequest*/ )
+bool SerfSession::LOCK( const OUString& rLock,
+                        sal_Int32 *plastChanceToSendRefreshRequest )
 {
     osl::Guard< osl::Mutex > theGuard( m_aMutex );
 
-    return true;
-    /*
-    // refresh existing lock.
-
-    TimeValue startCall;
-    osl_getSystemTime( &startCall );
+    boost::shared_ptr<SerfRequestProcessor> aReqProc( createReqProc( rLock ) );
+    aReqProc->processLock( ucb::Lock(), plastChanceToSendRefreshRequest );
 
-    if ( ne_lock_refresh( m_pHttpSession, pLock ) == NE_OK )
+    try
     {
-        rlastChanceToSendRefreshRequest
-            = lastChanceToSendRefreshRequest( startCall, pLock->timeout );
-
-        OSL_TRACE( "Lock successfully refreshed." );
+        HandleError( aReqProc );
+        SAL_INFO("ucb.ucp.webdav",  "Refreshing LOCK of " << rLock << " succeeded." );
         return true;
     }
-    else
+    catch(...)
     {
-        OSL_TRACE( "Lock not refreshed!" );
+        SAL_INFO("ucb.ucp.webdav",  "Refreshing LOCK of " << rLock << " failed!" );
         return false;
     }
-    */
 }
 
 // -------------------------------------------------------------------
diff --git a/ucb/source/ucp/webdav/SerfSession.hxx b/ucb/source/ucp/webdav/SerfSession.hxx
index fbb28e8..d18178d 100644
--- a/ucb/source/ucp/webdav/SerfSession.hxx
+++ b/ucb/source/ucp/webdav/SerfSession.hxx
@@ -267,8 +267,7 @@ private:
                                  const DAVRequestEnvironment & rEnv );
 
     // refresh lock, called by SerfLockStore::refreshLocks
-    bool LOCK( const OUString& rLock,
-               sal_Int32 & rlastChanceToSendRefreshRequest );
+    bool LOCK( const OUString& rLock, sal_Int32 *plastChanceToSendRefreshRequest );
 
     // unlock, called by SerfLockStore::~SerfLockStore
     void UNLOCK( const OUString& rLock );
commit 4e8cbd0c6e60b6f1a77d001d61784cd7e9c9168e
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Fri Mar 21 12:42:51 2014 +0100

    webdav: Implement unlocking of documents.
    
    (cherry picked from commit 53e9b3393aaeb00687eae096944531747976cef3)
    
    Conflicts:
    	ucb/source/ucp/webdav/SerfLockStore.cxx
    	ucb/source/ucp/webdav/SerfSession.cxx
    
    Change-Id: I12c092fa7034702273182ef07431ed00f38df8ef

diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 9ada038..51225d2 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -95,6 +95,7 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
 	ucb/source/ucp/webdav/SerfRequestProcessor \
 	ucb/source/ucp/webdav/SerfRequestProcessorImpl \
 	ucb/source/ucp/webdav/SerfSession \
+	ucb/source/ucp/webdav/SerfUnlockReqProcImpl \
 	ucb/source/ucp/webdav/SerfUri \
 	ucb/source/ucp/webdav/UCBDeadPropertyValue \
 	ucb/source/ucp/webdav/webdavcontent \
diff --git a/ucb/source/ucp/webdav/SerfLockStore.cxx b/ucb/source/ucp/webdav/SerfLockStore.cxx
index b923be0..16ee5e6 100644
--- a/ucb/source/ucp/webdav/SerfLockStore.cxx
+++ b/ucb/source/ucp/webdav/SerfLockStore.cxx
@@ -123,6 +123,18 @@ void SerfLockStore::stopTicker()
     }
 }
 
+OUString SerfLockStore::getLockToken( const OUString& rLock )
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    LockInfoMap::const_iterator it( m_aLockInfoMap.find( rLock ) );
+    if ( it != m_aLockInfoMap.end() )
+        return (*it).second.m_sToken;
+
+    SAL_WARN("ucb.ucp.webdav", "SerfLockStore::getLockToken: lock not found!" );
+    return OUString();
+}
+
 void SerfLockStore::addLock( const OUString& rLock,
                              const OUString& sToken,
                              rtl::Reference< SerfSession > const & xSession,
diff --git a/ucb/source/ucp/webdav/SerfLockStore.hxx b/ucb/source/ucp/webdav/SerfLockStore.hxx
index 92ab190..eefd7b8 100644
--- a/ucb/source/ucp/webdav/SerfLockStore.hxx
+++ b/ucb/source/ucp/webdav/SerfLockStore.hxx
@@ -62,6 +62,8 @@ public:
     SerfLockStore();
     ~SerfLockStore();
 
+    OUString getLockToken( const OUString& rLock );
+
     void addLock( const OUString& rLock,
                   const OUString& sToken,
                   rtl::Reference< SerfSession > const & xSession,
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
index a557781..ced9d5b 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
@@ -18,6 +18,8 @@
  */
 
 #include "SerfRequestProcessor.hxx"
+
+#include "AprEnv.hxx"
 #include "SerfCallbacks.hxx"
 #include "SerfSession.hxx"
 #include "SerfPropFindReqProcImpl.hxx"
@@ -31,6 +33,7 @@
 #include "SerfCopyReqProcImpl.hxx"
 #include "SerfMoveReqProcImpl.hxx"
 #include "SerfLockReqProcImpl.hxx"
+#include "SerfUnlockReqProcImpl.hxx"
 
 #include <apr_strings.h>
 
@@ -320,6 +323,22 @@ bool SerfRequestProcessor::processLock( const css::ucb::Lock & rLock )
     return runProcessor() == APR_SUCCESS;
 }
 
+bool SerfRequestProcessor::processUnlock()
+{
+    // get the lock from lock store
+    const OUString sToken(
+            apr_environment::AprEnv::getAprEnv()->getSerfLockStore()->getLockToken(
+                OUString::createFromAscii(mPathStr)) );
+    if ( sToken.isEmpty() )
+        throw DAVException( DAVException::DAV_NOT_LOCKED );
+
+    mpProcImpl = new SerfUnlockReqProcImpl( mPathStr,
+                                            mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
+                                            sToken );
+
+    return runProcessor() == APR_SUCCESS;
+}
+
 apr_status_t SerfRequestProcessor::runProcessor()
 {
     prepareProcessor();
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.hxx b/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
index f941a49..7e4573f 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
@@ -128,6 +128,9 @@ public:
     //LOCK
     bool processLock( const css::ucb::Lock & rLock );
 
+    //UNLOCK
+    bool processUnlock();
+
     apr_status_t provideSerfCredentials( char ** outUsername,
                                          char ** outPassword,
                                          serf_request_t * inRequest,
diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx
index 79dba326..bfb7bba 100644
--- a/ucb/source/ucp/webdav/SerfSession.cxx
+++ b/ucb/source/ucp/webdav/SerfSession.cxx
@@ -1053,59 +1053,46 @@ bool SerfSession::LOCK( const OUString& /*rLock*/,
 
 // -------------------------------------------------------------------
 // UNLOCK
-// -------------------------------------------------------------------
-void SerfSession::UNLOCK( const OUString & /*inPath*/,
-                          const DAVRequestEnvironment & /*rEnv*/ )
+void SerfSession::UNLOCK( const OUString & inPath,
+                          const DAVRequestEnvironment & rEnv )
     throw ( DAVException )
 {
     osl::Guard< osl::Mutex > theGuard( m_aMutex );
 
-    /*
-    // get the neon lock from lock store
-    SerfLock * theLock
-        = m_aSerfLockStore.findByUri( makeAbsoluteURL( inPath ) );
-    if ( !theLock )
-        throw DAVException( DAVException::DAV_NOT_LOCKED );
-
     Init( rEnv );
 
-    int theRetVal = ne_unlock( m_pHttpSession, theLock );
+    boost::shared_ptr<SerfRequestProcessor> aReqProc( createReqProc( inPath ) );
+    aReqProc->processUnlock();
 
-    if ( theRetVal == NE_OK )
+    try
     {
-        m_aSerfLockStore.removeLock( theLock );
-        ne_lock_destroy( theLock );
+        HandleError( aReqProc );
+        SAL_INFO("ucb.ucp.webdav",  "UNLOCK of " << inPath << " succeeded." );
     }
-    else
+    catch(...)
     {
-        OSL_TRACE( "SerfSession::UNLOCK: unlocking of %s failed.",
-                   OUStringToOString( makeAbsoluteURL( inPath ),
-                                           RTL_TEXTENCODING_UTF8 ).getStr() );
+        SAL_INFO("ucb.ucp.webdav",  "UNLOCK of " << inPath << " failed!" );
     }
-
-    HandleError( theRetVal, inPath, rEnv );
-    */
 }
 
 // -------------------------------------------------------------------
 // UNLOCK
-bool SerfSession::UNLOCK( const OUString& /*rLock*/ )
+void SerfSession::UNLOCK( const OUString& rLock )
 {
     osl::Guard< osl::Mutex > theGuard( m_aMutex );
 
-    return true;
-    /*
-    if ( ne_unlock( m_pHttpSession, pLock ) == NE_OK )
+    boost::shared_ptr<SerfRequestProcessor> aReqProc( createReqProc( rLock ) );
+    aReqProc->processUnlock();
+
+    try
     {
-        OSL_TRACE( "UNLOCK succeeded." );
-        return true;
+        HandleError( aReqProc );
+        SAL_INFO("ucb.ucp.webdav",  "UNLOCK of " << rLock << " succeeded." );
     }
-    else
+    catch(...)
     {
-        OSL_TRACE( "UNLOCK failed!" );
-        return false;
+        SAL_INFO("ucb.ucp.webdav",  "UNLOCK of " << rLock << " failed!" );
     }
-    */
 }
 
 // -------------------------------------------------------------------
diff --git a/ucb/source/ucp/webdav/SerfSession.hxx b/ucb/source/ucp/webdav/SerfSession.hxx
index 7966bfa..fbb28e8 100644
--- a/ucb/source/ucp/webdav/SerfSession.hxx
+++ b/ucb/source/ucp/webdav/SerfSession.hxx
@@ -271,7 +271,7 @@ private:
                sal_Int32 & rlastChanceToSendRefreshRequest );
 
     // unlock, called by SerfLockStore::~SerfLockStore
-    bool UNLOCK( const OUString& rLock );
+    void UNLOCK( const OUString& rLock );
 
     /*
     // low level GET implementation, used by public GET implementations
diff --git a/ucb/source/ucp/webdav/SerfUnlockReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfUnlockReqProcImpl.cxx
new file mode 100644
index 0000000..59c8994
--- /dev/null
+++ b/ucb/source/ucp/webdav/SerfUnlockReqProcImpl.cxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "SerfUnlockReqProcImpl.hxx"
+
+namespace http_dav_ucp
+{
+
+SerfUnlockReqProcImpl::SerfUnlockReqProcImpl( const char* inPath,
+                                              const DAVRequestHeaders& inRequestHeaders,
+                                              const OUString& sToken)
+    : SerfRequestProcessorImpl( inPath, inRequestHeaders )
+    , m_sToken( sToken )
+{
+}
+
+SerfUnlockReqProcImpl::~SerfUnlockReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfUnlockReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+    // create serf request
+    serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
+                                                                 "UNLOCK",
+                                                                 getPathStr(),
+                                                                 0,
+                                                                 serf_request_get_alloc( inSerfRequest ) );
+    // set request header fields
+    serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+
+    // general header fields provided by caller
+    setRequestHeaders( hdrs_bkt );
+
+    // token header field
+    serf_bucket_headers_set( hdrs_bkt, "Lock-Token",
+            OUStringToOString(m_sToken, RTL_TEXTENCODING_UTF8).getStr() );
+
+    return req_bkt;
+}
+
+void SerfUnlockReqProcImpl::processChunkOfResponseData( const char* , apr_size_t )
+{
+}
+
+void SerfUnlockReqProcImpl::handleEndOfResponseData( serf_bucket_t * )
+{
+}
+
+} // namespace http_dav_ucp
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav/SerfUnlockReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfUnlockReqProcImpl.hxx
new file mode 100644
index 0000000..dc2e6d1
--- /dev/null
+++ b/ucb/source/ucp/webdav/SerfUnlockReqProcImpl.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SERFUNLOCKREQPROCIMPL_HXX
+#define INCLUDED_SERFUNLOCKREQPROCIMPL_HXX
+
+#include "SerfRequestProcessorImpl.hxx"
+
+namespace http_dav_ucp
+{
+
+class SerfUnlockReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+    SerfUnlockReqProcImpl( const char* inPath,
+                           const DAVRequestHeaders& inRequestHeaders,
+                           const OUString& sToken);
+
+    virtual ~SerfUnlockReqProcImpl() SAL_OVERRIDE;
+
+    virtual serf_bucket_t *createSerfRequestBucket(
+            serf_request_t * inSerfRequest ) SAL_OVERRIDE;
+
+private:
+    virtual void processChunkOfResponseData(
+            const char* data, apr_size_t len ) SAL_OVERRIDE;
+
+    virtual void handleEndOfResponseData(
+            serf_bucket_t * inSerfResponseBucket ) SAL_OVERRIDE;
+
+    OUString m_sToken;
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFUNLOCKREQPROCIMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b64c0d0cdb993046cf44bb107dec88bda171e5cb
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Mar 20 12:27:21 2014 +0100

    webdav: Store locks in SerfLockStore, so we could unlock later.
    
    (cherry picked from commit 3648ba0db379b3ca2cc6bb84a4b6c14f16217fa9)
    
    Conflicts:
    	ucb/source/ucp/webdav/SerfLockStore.cxx
    	ucb/source/ucp/webdav/SerfSession.cxx
    
    Change-Id: If2667e9374917dd1e4c4361378783729761e7dda

diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index ad0fe79..9ada038 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -85,6 +85,7 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
 	ucb/source/ucp/webdav/SerfHeadReqProcImpl \
 	ucb/source/ucp/webdav/SerfInputStream \
 	ucb/source/ucp/webdav/SerfLockReqProcImpl \
+	ucb/source/ucp/webdav/SerfLockStore \
 	ucb/source/ucp/webdav/SerfMkColReqProcImpl \
 	ucb/source/ucp/webdav/SerfMoveReqProcImpl \
 	ucb/source/ucp/webdav/SerfPostReqProcImpl \
@@ -104,7 +105,6 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
 	ucb/source/ucp/webdav/webdavresultset \
 	ucb/source/ucp/webdav/webdavservices \
  ))
-	#ucb/source/ucp/webdav/SerfLockStore
 
 endif # WITH_WEBDAV
 
diff --git a/ucb/source/ucp/webdav/AprEnv.cxx b/ucb/source/ucp/webdav/AprEnv.cxx
index 327b7dd..e9e650f 100644
--- a/ucb/source/ucp/webdav/AprEnv.cxx
+++ b/ucb/source/ucp/webdav/AprEnv.cxx
@@ -28,10 +28,14 @@ AprEnv::AprEnv()
     apr_initialize();
 
     apr_pool_create(&mpAprPool, NULL);
+
+    mpSerfLockStore = new http_dav_ucp::SerfLockStore();
 }
 
 AprEnv::~AprEnv()
 {
+    delete mpSerfLockStore;
+
     apr_pool_destroy(mpAprPool);
 
     apr_terminate();
@@ -50,6 +54,11 @@ apr_pool_t* AprEnv::getAprPool()
     return mpAprPool;
 }
 
+http_dav_ucp::SerfLockStore* AprEnv::getSerfLockStore()
+{
+    return mpSerfLockStore;
+}
+
 } // namespace apr_environment
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav/AprEnv.hxx b/ucb/source/ucp/webdav/AprEnv.hxx
index 9b7c59b..4f360aa 100644
--- a/ucb/source/ucp/webdav/AprEnv.hxx
+++ b/ucb/source/ucp/webdav/AprEnv.hxx
@@ -22,6 +22,7 @@
 #define INCLUDED_APRENV_HXX
 
 #include <apr_pools.h>
+#include <SerfLockStore.hxx>
 
 namespace apr_environment
 {
@@ -36,8 +37,13 @@ class AprEnv
 
         apr_pool_t* getAprPool();
 
+        http_dav_ucp::SerfLockStore* getSerfLockStore();
+
     private:
         apr_pool_t* mpAprPool;
+        // SerfLockStore is a static object and has to be destroyed
+        // before AprEnv, so store it here.
+        http_dav_ucp::SerfLockStore* mpSerfLockStore;
 
         AprEnv();
 
diff --git a/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
index 667583d..9e16212 100644
--- a/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
+++ b/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
@@ -18,6 +18,9 @@
  */
 
 #include "SerfLockReqProcImpl.hxx"
+
+#include "AprEnv.hxx"
+#include "SerfSession.hxx"
 #include "DAVException.hxx"
 
 #include "webdavresponseparser.hxx"
@@ -28,8 +31,10 @@ namespace http_dav_ucp
 
 SerfLockReqProcImpl::SerfLockReqProcImpl( const char* inPath,
                                           const DAVRequestHeaders& inRequestHeaders,
+                                          SerfSession& rSession,
                                           const css::ucb::Lock & rLock )
     : SerfRequestProcessorImpl( inPath, inRequestHeaders )
+    , m_rSession( rSession )
     , m_aLock( rLock )
     , m_xInputStream( new SerfInputStream() )
 {
@@ -139,7 +144,24 @@ void SerfLockReqProcImpl::handleEndOfResponseData( serf_bucket_t * )
     {
         for (size_t i = 0; i < aLocks.size(); ++i)
         {
-           // m_pSerfLockStore->addLock( aLocks[i], m_pSerfSession, m_aStartCall );
+            sal_Int64 timeout = aLocks[i].Timeout;
+            TimeValue aEnd;
+            osl_getSystemTime( &aEnd );
+            // Try to estimate a safe absolute time for sending the
+            // lock refresh request.
+            sal_Int32 lastChanceToSendRefreshRequest = -1;
+            if ( timeout != -1 )
+            {
+                sal_Int32 calltime = aEnd.Seconds - m_aStartCall.Seconds;
+                if ( calltime <= timeout )
+                    lastChanceToSendRefreshRequest = aEnd.Seconds + timeout - calltime;
+                else
+                    SAL_WARN("ucb.ucp.webdav", "No chance to refresh lock before timeout!" );
+            }
+            apr_environment::AprEnv::getAprEnv()->getSerfLockStore()->addLock(
+                    OUString::createFromAscii(getPathStr()),
+                    aLocks[i].LockTokens[0],
+                    &m_rSession, lastChanceToSendRefreshRequest );
             SAL_INFO("ucb.ucp.webdav",  "SerfSession::LOCK: created lock for "
                     << getPathStr() << ". token: " << aLocks[i].LockTokens[0]);
         }
diff --git a/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
index cb746a3..766bc2b 100644
--- a/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
+++ b/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
@@ -29,11 +29,14 @@
 namespace http_dav_ucp
 {
 
+class SerfSession;
+
 class SerfLockReqProcImpl : public SerfRequestProcessorImpl
 {
 public:
     SerfLockReqProcImpl( const char* inPath,
                          const DAVRequestHeaders& inRequestHeaders,
+                         SerfSession& rSession,
                          const css::ucb::Lock & rLock );
 
     virtual ~SerfLockReqProcImpl() SAL_OVERRIDE;
@@ -48,6 +51,7 @@ private:
     virtual
     void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket ) SAL_OVERRIDE;
 
+    SerfSession& m_rSession;
     css::ucb::Lock m_aLock;
     TimeValue m_aStartCall;
     css::uno::Reference< SerfInputStream > m_xInputStream;
diff --git a/ucb/source/ucp/webdav/SerfLockStore.cxx b/ucb/source/ucp/webdav/SerfLockStore.cxx
index 80dcd60..b923be0 100644
--- a/ucb/source/ucp/webdav/SerfLockStore.cxx
+++ b/ucb/source/ucp/webdav/SerfLockStore.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <ne_locks.h>
-#include <ne_uri.h>
 #include <rtl/ustring.hxx>
 #include <osl/time.h>
 #include <osl/thread.hxx>
@@ -76,10 +74,8 @@ void TickerThread::run()
 
 // -------------------------------------------------------------------
 SerfLockStore::SerfLockStore()
-    : m_pSerfLockStore( ne_lockstore_create() ),
-      m_pTickerThread( 0 )
+    : m_pTickerThread( 0 )
 {
-    OSL_ENSURE( m_pSerfLockStore, "Unable to create neon lock store!" );
 }
 
 // -------------------------------------------------------------------
@@ -95,16 +91,10 @@ SerfLockStore::~SerfLockStore()
     const LockInfoMap::const_iterator end( m_aLockInfoMap.end() );
     while ( it != end )
     {
-        SerfLock * pLock = (*it).first;
-        (*it).second.xSession->UNLOCK( pLock );
-
-        ne_lockstore_remove( m_pSerfLockStore, pLock );
-        ne_lock_destroy( pLock );
-
+        const OUString& rLock = (*it).first;
+        (*it).second.m_xSession->UNLOCK( rLock );
         ++it;
     }
-
-    ne_lockstore_destroy( m_pSerfLockStore );
 }
 
 // -------------------------------------------------------------------
@@ -133,63 +123,41 @@ void SerfLockStore::stopTicker()
     }
 }
 
-// -------------------------------------------------------------------
-void SerfLockStore::registerSession( HttpSession * pHttpSession )
-{
-    osl::MutexGuard aGuard( m_aMutex );
-
-    ne_lockstore_register( m_pSerfLockStore, pHttpSession );
-}
-
-// -------------------------------------------------------------------
-SerfLock * SerfLockStore::findByUri( OUString const & rUri )
-{
-    osl::MutexGuard aGuard( m_aMutex );
-
-    ne_uri aUri;
-    ne_uri_parse( OUStringToOString(
-        rUri, RTL_TEXTENCODING_UTF8 ).getStr(), &aUri );
-    return ne_lockstore_findbyuri( m_pSerfLockStore, &aUri );
-}
-
-// -------------------------------------------------------------------
-void SerfLockStore::addLock( SerfLock * pLock,
+void SerfLockStore::addLock( const OUString& rLock,
+                             const OUString& sToken,
                              rtl::Reference< SerfSession > const & xSession,
                              sal_Int32 nLastChanceToSendRefreshRequest )
 {
     osl::MutexGuard aGuard( m_aMutex );
 
-    ne_lockstore_add( m_pSerfLockStore, pLock );
-    m_aLockInfoMap[ pLock ]
-        = LockInfo( xSession, nLastChanceToSendRefreshRequest );
+    m_aLockInfoMap[ rLock ]
+        = LockInfo( sToken, xSession, nLastChanceToSendRefreshRequest );
 
     startTicker();
 }
 
-// -------------------------------------------------------------------
-void SerfLockStore::updateLock( SerfLock * pLock,
+void SerfLockStore::updateLock( const OUString& rLock,
                                 sal_Int32 nLastChanceToSendRefreshRequest )
 {
     osl::MutexGuard aGuard( m_aMutex );
 
-    LockInfoMap::iterator it( m_aLockInfoMap.find( pLock ) );
-    OSL_ENSURE( it != m_aLockInfoMap.end(),
+    LockInfoMap::iterator it( m_aLockInfoMap.find( rLock ) );
+    SAL_WARN_IF( it == m_aLockInfoMap.end(), "ucb.ucp.webdav",
                 "SerfLockStore::updateLock: lock not found!" );
 
     if ( it != m_aLockInfoMap.end() )
     {
-        (*it).second.nLastChanceToSendRefreshRequest
+        (*it).second.m_nLastChanceToSendRefreshRequest
             = nLastChanceToSendRefreshRequest;
     }
 }
 
-// -------------------------------------------------------------------
-void SerfLockStore::removeLock( SerfLock * pLock )
+
+void SerfLockStore::removeLock( const OUString& rLock )
 {
     osl::MutexGuard aGuard( m_aMutex );
 
-    m_aLockInfoMap.erase( pLock );
-    ne_lockstore_remove( m_pSerfLockStore, pLock );
+    m_aLockInfoMap.erase( rLock );
 
     if ( m_aLockInfoMap.empty() )
         stopTicker();
@@ -205,27 +173,27 @@ void SerfLockStore::refreshLocks()
     while ( it != end )
     {
         LockInfo & rInfo = (*it).second;
-        if ( rInfo.nLastChanceToSendRefreshRequest != -1 )
+        if ( rInfo.m_nLastChanceToSendRefreshRequest != -1 )
         {
             // 30 seconds or less remaining until lock expires?
             TimeValue t1;
             osl_getSystemTime( &t1 );
-            if ( rInfo.nLastChanceToSendRefreshRequest - 30
+            if ( rInfo.m_nLastChanceToSendRefreshRequest - 30
                      <= sal_Int32( t1.Seconds ) )
             {
                 // refresh the lock.
                 sal_Int32 nlastChanceToSendRefreshRequest = -1;
-                if ( rInfo.xSession->LOCK(
+                if ( rInfo.m_xSession->LOCK(
                          (*it).first,
                          /* out param */ nlastChanceToSendRefreshRequest ) )
                 {
-                    rInfo.nLastChanceToSendRefreshRequest
+                    rInfo.m_nLastChanceToSendRefreshRequest
                         = nlastChanceToSendRefreshRequest;
                 }
                 else
                 {
                     // refresh failed. stop auto-refresh.
-                    rInfo.nLastChanceToSendRefreshRequest = -1;
+                    rInfo.m_nLastChanceToSendRefreshRequest = -1;
                 }
             }
         }
diff --git a/ucb/source/ucp/webdav/SerfLockStore.hxx b/ucb/source/ucp/webdav/SerfLockStore.hxx
index 4fff5f6..92ab190 100644
--- a/ucb/source/ucp/webdav/SerfLockStore.hxx
+++ b/ucb/source/ucp/webdav/SerfLockStore.hxx
@@ -24,43 +24,37 @@
 #include <map>
 #include <osl/mutex.hxx>
 #include <rtl/ref.hxx>
-#include "SerfTypes.hxx"
+#include <rtl/ustring.hxx>
+#include <SerfTypes.hxx>
+#include <SerfSession.hxx>
 
 namespace http_dav_ucp
 {
 
 class TickerThread;
-class SerfSession;
 
-struct ltptr
+struct LockInfo
 {
-    bool operator()( const SerfLock * p1, const SerfLock * p2 ) const
-    {
-        return p1 < p2;
-    }
+    OUString m_sToken;
+    rtl::Reference< SerfSession > m_xSession;
+    sal_Int32 m_nLastChanceToSendRefreshRequest;
+
+    LockInfo()
+        : m_nLastChanceToSendRefreshRequest( -1 ) {}
+
+    LockInfo( const OUString& sToken,
+              rtl::Reference< SerfSession > const & xSession,
+              sal_Int32 nLastChanceToSendRefreshRequest )
+    : m_sToken( sToken ),
+      m_xSession( xSession ),
+      m_nLastChanceToSendRefreshRequest( nLastChanceToSendRefreshRequest ) {}
 };
 
-typedef struct _LockInfo
-{
-    rtl::Reference< SerfSession > xSession;
-    sal_Int32 nLastChanceToSendRefreshRequest;
-
-    _LockInfo()
-        : nLastChanceToSendRefreshRequest( -1 ) {}
-
-    _LockInfo( rtl::Reference< SerfSession > const & _xSession,
-              sal_Int32 _nLastChanceToSendRefreshRequest )
-    : xSession( _xSession ),
-      nLastChanceToSendRefreshRequest( _nLastChanceToSendRefreshRequest ) {}
-
-} LockInfo;
-
-typedef std::map< SerfLock *, LockInfo, ltptr > LockInfoMap;
+typedef std::map< OUString, LockInfo > LockInfoMap;
 
 class SerfLockStore
 {
     osl::Mutex         m_aMutex;
-//    ne_lock_store    * m_pSerfLockStore;
     TickerThread     * m_pTickerThread;
     LockInfoMap        m_aLockInfoMap;
 
@@ -68,20 +62,17 @@ public:
     SerfLockStore();
     ~SerfLockStore();
 
-    void registerSession( HttpSession * pHttpSession );
-
-    SerfLock * findByUri( OUString const & rUri );
-
-    void addLock( SerfLock * pLock,
+    void addLock( const OUString& rLock,
+                  const OUString& sToken,
                   rtl::Reference< SerfSession > const & xSession,
                   // time in seconds since Jan 1 1970
                   // -1: infinite lock, no refresh
                   sal_Int32 nLastChanceToSendRefreshRequest );
 
-    void updateLock( SerfLock * pLock,
+    void updateLock( const OUString& rLock,
                      sal_Int32 nLastChanceToSendRefreshRequest );
 
-    void removeLock( SerfLock * pLock );
+    void removeLock( const OUString& rLock );
 
     void refreshLocks();
 
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
index 8a1663b..a557781 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
@@ -314,6 +314,7 @@ bool SerfRequestProcessor::processLock( const css::ucb::Lock & rLock )
 {
     mpProcImpl = new SerfLockReqProcImpl( mPathStr,
                                           mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
+                                          mrSerfSession,
                                           rLock );
 
     return runProcessor() == APR_SUCCESS;
diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx
index 9ac01fa..79dba326 100644
--- a/ucb/source/ucp/webdav/SerfSession.cxx
+++ b/ucb/source/ucp/webdav/SerfSession.cxx
@@ -48,12 +48,6 @@
 using namespace com::sun::star;
 using namespace http_dav_ucp;
 
-
-// -------------------------------------------------------------------
-// static members!
-//SerfLockStore SerfSession::m_aSerfLockStore;
-
-// -------------------------------------------------------------------
 // Constructor
 // -------------------------------------------------------------------
 SerfSession::SerfSession(
@@ -1029,8 +1023,7 @@ sal_Int64 SerfSession::LOCK( const OUString & /*inPath*/,
 
 // -------------------------------------------------------------------
 // LOCK (refresh existing lock)
-// -------------------------------------------------------------------
-bool SerfSession::LOCK( SerfLock * /*pLock*/,
+bool SerfSession::LOCK( const OUString& /*rLock*/,
                         sal_Int32 & /*rlastChanceToSendRefreshRequest*/ )
 {
     osl::Guard< osl::Mutex > theGuard( m_aMutex );
@@ -1096,8 +1089,7 @@ void SerfSession::UNLOCK( const OUString & /*inPath*/,
 
 // -------------------------------------------------------------------
 // UNLOCK
-// -------------------------------------------------------------------
-bool SerfSession::UNLOCK( SerfLock * /*pLock*/ )
+bool SerfSession::UNLOCK( const OUString& /*rLock*/ )
 {
     osl::Guard< osl::Mutex > theGuard( m_aMutex );
 
diff --git a/ucb/source/ucp/webdav/SerfSession.hxx b/ucb/source/ucp/webdav/SerfSession.hxx
index 0f9156d..7966bfa 100644
--- a/ucb/source/ucp/webdav/SerfSession.hxx
+++ b/ucb/source/ucp/webdav/SerfSession.hxx
@@ -27,7 +27,6 @@
 #include <osl/mutex.hxx>
 #include "DAVSession.hxx"
 #include "SerfTypes.hxx"
-//#include "SerfLockStore.hxx"
 #include "SerfUri.hxx"
 
 namespace ucbhelper { class ProxyDecider; }
@@ -63,8 +62,6 @@ private:
 
     DAVRequestEnvironment m_aEnv;
 
-//    static SerfLockStore m_aSerfLockStore;
-
     char* getHostinfo();
     bool isSSLNeeded();
 
@@ -270,11 +267,11 @@ private:
                                  const DAVRequestEnvironment & rEnv );
 
     // refresh lock, called by SerfLockStore::refreshLocks
-    bool LOCK( SerfLock * pLock,
+    bool LOCK( const OUString& rLock,
                sal_Int32 & rlastChanceToSendRefreshRequest );
 
     // unlock, called by SerfLockStore::~SerfLockStore
-    bool UNLOCK( SerfLock * pLock );
+    bool UNLOCK( const OUString& rLock );
 
     /*
     // low level GET implementation, used by public GET implementations
diff --git a/ucb/source/ucp/webdav/SerfTypes.hxx b/ucb/source/ucp/webdav/SerfTypes.hxx
index b396697..2393458 100644
--- a/ucb/source/ucp/webdav/SerfTypes.hxx
+++ b/ucb/source/ucp/webdav/SerfTypes.hxx
@@ -26,9 +26,6 @@
 
 typedef serf_connection_t SerfConnection;
 
-// TODO, figure out type of <SerfLock>
-typedef int SerfLock;
-
 // TODO, check if we need it later on
 typedef struct { const char *nspace, *name; } SerfPropName;
 
commit b1789d306c0e16ceb7a432ea4c5d6c83d23377de
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Mar 20 20:59:46 2014 +0100

    webdav: Parse response of LOCK request.
    
    (cherry picked from commit c1496e67616c3ec94d500bb632cca6b844f37a2f)
    
    Conflicts:
    	ucb/source/ucp/webdav/webdavresponseparser.cxx
    	ucb/source/ucp/webdav/webdavresponseparser.hxx
    
    Change-Id: Ib17de602e2c51eb29b0495ce7411836ceeccf9d4

diff --git a/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
index f5aa35c..667583d 100644
--- a/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
+++ b/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
@@ -20,7 +20,7 @@
 #include "SerfLockReqProcImpl.hxx"
 #include "DAVException.hxx"
 
-//#include "webdavresponseparser.hxx"
+#include "webdavresponseparser.hxx"
 #include <rtl/strbuf.hxx>
 
 namespace http_dav_ucp
@@ -131,33 +131,23 @@ void SerfLockReqProcImpl::processChunkOfResponseData( const char* data,
     }
 }
 
-void SerfLockReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
+void SerfLockReqProcImpl::handleEndOfResponseData( serf_bucket_t * )
 {
-    //const std::vector< DAVResourceInfo > rResInfo( parseWebDAVPropNameResponse( m_xInputStream.get() ) );
+    const std::vector< css::ucb::Lock > aLocks( parseWebDAVLockResponse( m_xInputStream.get() ) );
 
-    /*
-    if ( theRetVal == NE_OK )
+    if (!aLocks.empty())
     {
-        m_aSerfLockStore.addLock( theLock,
-                                  this,
-                                  lastChanceToSendRefreshRequest(
-                                      startCall, theLock->timeout ) );
-
-        uno::Sequence< OUString > aTokens( 1 );
-        aTokens[ 0 ] = OUString::createFromAscii( theLock->token );
-        m_xLock.LockTokens = aTokens;
-
-        SAL_INFO("ucb.ucp.webdav",  "SerfSession::LOCK: created lock for "
-                    << makeAbsoluteURL( inPath ) << ". token: " << theLock->token );
+        for (size_t i = 0; i < aLocks.size(); ++i)
+        {
+           // m_pSerfLockStore->addLock( aLocks[i], m_pSerfSession, m_aStartCall );
+            SAL_INFO("ucb.ucp.webdav",  "SerfSession::LOCK: created lock for "
+                    << getPathStr() << ". token: " << aLocks[i].LockTokens[0]);
+        }
     }
     else
     {
-        ne_lock_destroy( theLock );
-
-        SAL_INFO("ucb.ucp.webdav",  "SerfSession::LOCK: obtaining lock for "
-                    << makeAbsoluteURL( inPath ) << " failed!");
+        SAL_INFO("ucb.ucp.webdav",  "SerfSession::LOCK: obtaining lock failed!");
     }
-    */
 }
 
 } // namespace http_dav_ucp
diff --git a/ucb/source/ucp/webdav/webdavresponseparser.cxx b/ucb/source/ucp/webdav/webdavresponseparser.cxx
index 9166843..928c432 100644
--- a/ucb/source/ucp/webdav/webdavresponseparser.cxx
+++ b/ucb/source/ucp/webdav/webdavresponseparser.cxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/ucb/LockEntry.hpp>
 #include <com/sun/star/ucb/LockScope.hpp>
 #include <com/sun/star/ucb/LockType.hpp>
+#include <com/sun/star/ucb/Lock.hpp>
 #include <map>
 #include <boost/unordered_map.hpp>
 
@@ -74,6 +75,7 @@ namespace
     enum WebDAVName
     {
         WebDAVName_unknown = 0,
+        WebDAVName_activelock,
         WebDAVName_multistatus,
         WebDAVName_response,
         WebDAVName_href,
@@ -85,8 +87,11 @@ namespace
         WebDAVName_supportedlock,
         WebDAVName_lockentry,
         WebDAVName_lockscope,
+        WebDAVName_locktoken,
         WebDAVName_exclusive,
         WebDAVName_locktype,
+        WebDAVName_owner,
+        WebDAVName_timeout,
         WebDAVName_write,
         WebDAVName_shared,
         WebDAVName_status,
@@ -105,25 +110,29 @@ namespace
 
         if(aWebDAVNameMapperList.empty())
         {
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("multistatus"), WebDAVName_multistatus));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("response"), WebDAVName_response));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("href"), WebDAVName_href));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("propstat"), WebDAVName_propstat));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("prop"), WebDAVName_prop));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("resourcetype"), WebDAVName_resourcetype));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("collection"), WebDAVName_collection));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("getcontenttype"), WebDAVName_getcontenttype));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("supportedlock"), WebDAVName_supportedlock));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("lockentry"), WebDAVName_lockentry));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("lockscope"), WebDAVName_lockscope));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("exclusive"), WebDAVName_exclusive));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("locktype"), WebDAVName_locktype));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("write"), WebDAVName_write));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("shared"), WebDAVName_shared));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("status"), WebDAVName_status));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("getlastmodified"), WebDAVName_getlastmodified));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("creationdate"), WebDAVName_creationdate));
-            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString::createFromAscii("getcontentlength"), WebDAVName_getcontentlength));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("activelock"), WebDAVName_activelock));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("multistatus"), WebDAVName_multistatus));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("response"), WebDAVName_response));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("href"), WebDAVName_href));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("propstat"), WebDAVName_propstat));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("prop"), WebDAVName_prop));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("resourcetype"), WebDAVName_resourcetype));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("collection"), WebDAVName_collection));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("getcontenttype"), WebDAVName_getcontenttype));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("supportedlock"), WebDAVName_supportedlock));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("lockentry"), WebDAVName_lockentry));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("lockscope"), WebDAVName_lockscope));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("locktoken"), WebDAVName_locktoken));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("exclusive"), WebDAVName_exclusive));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("locktype"), WebDAVName_locktype));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("owner"), WebDAVName_owner));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("timeout"), WebDAVName_timeout));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("write"), WebDAVName_write));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("shared"), WebDAVName_shared));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("status"), WebDAVName_status));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("getlastmodified"), WebDAVName_getlastmodified));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("creationdate"), WebDAVName_creationdate));
+            aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("getcontentlength"), WebDAVName_getcontentlength));
         }
 
         const WebDAVNameMapper::const_iterator aResult(aWebDAVNameMapperList.find(rStr));
@@ -283,12 +292,14 @@ namespace
     enum WebDAVResponseParserMode
     {
         WebDAVResponseParserMode_PropFind = 0,
-        WebDAVResponseParserMode_PropName
+        WebDAVResponseParserMode_PropName,
+        WebDAVResponseParserMode_Lock
     };
 
     class WebDAVResponseParser : public cppu::WeakImplHelper1< com::sun::star::xml::sax::XDocumentHandler >
     {
     private:
+        std::vector< ucb::Lock >                      maResult_Lock;
         std::vector< http_dav_ucp::DAVResource >      maResult_PropFind;
         std::vector< http_dav_ucp::DAVResourceInfo >  maResult_PropName;
 
@@ -302,6 +313,7 @@ namespace
         uno::Sequence< ucb::LockEntry >             maLockEntries;
         ucb::LockScope                              maLockScope;
         ucb::LockType                               maLockType;
+        ucb::Lock                                   maLock;
         WebDAVResponseParserMode                    meWebDAVResponseParserMode;
 
         // bitfield
@@ -362,6 +374,7 @@ namespace
         virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (xml::sax::SAXException, uno::RuntimeException);
         virtual void SAL_CALL setDocumentLocator( const uno::Reference< xml::sax::XLocator >& xLocator ) throw (xml::sax::SAXException, uno::RuntimeException);
 
+        const std::vector< ucb::Lock >& getResult_Lock() const { return maResult_Lock; }
         const std::vector< http_dav_ucp::DAVResource >& getResult_PropFind() const { return maResult_PropFind; }
         const std::vector< http_dav_ucp::DAVResourceInfo >& getResult_PropName() const { return maResult_PropName; }
     };
@@ -486,6 +499,11 @@ namespace
                                 mbLockTypeSet = false;
                                 break;
                             }
+                            case WebDAVName_activelock:
+                            {
+                                maLock = ucb::Lock();
+                                break;
+                            }
                         }
                         break;
                     }
@@ -654,6 +672,30 @@ namespace
                                 }
                                 break;
                             }
+                            case WebDAVName_owner:
+                            {
+                                maLock.Owner <<= mpContext->getWhiteSpace();
+                                break;
+                            }
+                            case WebDAVName_timeout:
+                            {
+                                const OUString sTimeout(mpContext->getWhiteSpace());
+                                if (sTimeout == "Infinite")
+                                    maLock.Timeout = -1;
+                                else if (sTimeout.startsWith("Second-"))
+                                    maLock.Timeout = sTimeout.copy(7).toInt64();
+                                break;
+                            }
+                            case WebDAVName_locktoken:
+                            {
+                                const OUString sLockToken(maHref);
+                                SAL_WARN_IF(!sLockToken.startsWith("opaquelocktoken:"), "ucb.ucp.webdav",
+                                        "Parser error: wrong 'locktoken' value.");
+                                const sal_Int32 nLength(maLock.LockTokens.getLength());
+                                maLock.LockTokens.realloc(nLength+1);
+                                maLock.LockTokens[nLength] = sLockToken;
+                                break;
+                            }
                             case WebDAVName_exclusive:
                             {
                                 // exclusive lockscope end
@@ -684,6 +726,12 @@ namespace
                                 }
                                 break;
                             }
+                            case WebDAVName_activelock:
+                            {
+                                maLock.Type = maLockType;
+                                maLock.Scope = maLockScope;
+                                maResult_Lock.push_back(maLock);
+                            }
                             case WebDAVName_propstat:
                             {
                                 // propstat end, check status
@@ -804,10 +852,10 @@ namespace
 
 namespace
 {
-    void parseWebDAVPropNameResponse(
+    template<typename T>
+    void parseWebDAVResponse(
         const uno::Reference< io::XInputStream >& xInputStream,
-        std::vector< http_dav_ucp::DAVResource >& rPropFind,
-        std::vector< http_dav_ucp::DAVResourceInfo >& rPropName,
+        std::vector< T >& rResult,
         WebDAVResponseParserMode eWebDAVResponseParserMode)
     {
         if(xInputStream.is())
@@ -833,16 +881,17 @@ namespace
                 // get result
                 switch(eWebDAVResponseParserMode)
                 {
+                    // *(std::vector<T>*) & is a horrible hack but hopefully works,
+                    // I was not able to come up with something sane :-/
                     case WebDAVResponseParserMode_PropFind:
-                    {
-                        rPropFind = pWebDAVResponseParser->getResult_PropFind();
+                        rResult = *(std::vector<T>*) &pWebDAVResponseParser->getResult_PropFind();
                         break;
-                    }
                     case WebDAVResponseParserMode_PropName:
-                    {
-                        rPropName = pWebDAVResponseParser->getResult_PropName();
+                        rResult = *(std::vector<T>*) &pWebDAVResponseParser->getResult_PropName();
+                        break;
+                    case WebDAVResponseParserMode_Lock:
+                        rResult = *(std::vector<T>*) &pWebDAVResponseParser->getResult_Lock();
                         break;
-                    }
                 }
             }
             catch(uno::Exception&)
@@ -858,22 +907,25 @@ namespace
 
 namespace http_dav_ucp
 {
-    std::vector< DAVResource > parseWebDAVPropFindResponse(const uno::Reference< io::XInputStream >& xInputStream)
+    std::vector< ucb::Lock > parseWebDAVLockResponse(const uno::Reference< io::XInputStream >& xInputStream)
     {
-        std::vector< DAVResource > aRetval;
-        std::vector< DAVResourceInfo > aFoo;
+        std::vector< ucb::Lock > aResult;
+        parseWebDAVResponse< ucb::Lock >(xInputStream, aResult, WebDAVResponseParserMode_Lock);
+        return aResult;
+    }
 
-        parseWebDAVPropNameResponse(xInputStream, aRetval, aFoo, WebDAVResponseParserMode_PropFind);
-        return aRetval;
+    std::vector< DAVResource > parseWebDAVPropFindResponse(const uno::Reference< io::XInputStream >& xInputStream)
+    {
+        std::vector< DAVResource > aResult;
+        parseWebDAVResponse< DAVResource >(xInputStream, aResult, WebDAVResponseParserMode_PropFind);
+        return aResult;
     }
 
     std::vector< DAVResourceInfo > parseWebDAVPropNameResponse(const uno::Reference< io::XInputStream >& xInputStream)
     {
-        std::vector< DAVResource > aFoo;
-        std::vector< DAVResourceInfo > aRetval;
-
-        parseWebDAVPropNameResponse(xInputStream, aFoo, aRetval, WebDAVResponseParserMode_PropName);
-        return aRetval;
+        std::vector< DAVResourceInfo > aResult;
+        parseWebDAVResponse< DAVResourceInfo >(xInputStream, aResult, WebDAVResponseParserMode_PropName);
+        return aResult;
     }
 } // namespace http_dav_ucp
 
diff --git a/ucb/source/ucp/webdav/webdavresponseparser.hxx b/ucb/source/ucp/webdav/webdavresponseparser.hxx
index f385895..f33fa89 100644
--- a/ucb/source/ucp/webdav/webdavresponseparser.hxx
+++ b/ucb/source/ucp/webdav/webdavresponseparser.hxx
@@ -22,6 +22,7 @@
 
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/ucb/Lock.hpp>
 #include "DAVResource.hxx"
 #include <vector>
 
@@ -29,15 +30,12 @@
 
 namespace http_dav_ucp
 {
-    std::vector< DAVResource > parseWebDAVPropFindResponse(const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& xInputStream);
-    std::vector< DAVResourceInfo > parseWebDAVPropNameResponse(const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& xInputStream);
+    std::vector< css::ucb::Lock > parseWebDAVLockResponse(const css::uno::Reference< css::io::XInputStream >& xInputStream);
+    std::vector< DAVResource > parseWebDAVPropFindResponse(const css::uno::Reference< css::io::XInputStream >& xInputStream);
+    std::vector< DAVResourceInfo > parseWebDAVPropNameResponse(const css::uno::Reference< css::io::XInputStream >& xInputStream);
 } // namespace http_dav_ucp
 
-//////////////////////////////////////////////////////////////////////////////
 
 #endif // _WEBDAVRESPONSEPARSER_HXX_
 
-//////////////////////////////////////////////////////////////////////////////
-// eof
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 7bfd3fd86affe6ce804e910b39edfbe09890717f
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Mar 20 09:40:06 2014 +0100

    webdav: Lock files when opening them.
    
    The implementation is not perfect but good enough as a start.
    
    (cherry picked from commit 6e0cc0cd40fcceef601c9b680f44b95f6286ffa0)
    
    Conflicts:
    	ucb/source/ucp/webdav/SerfSession.cxx
    
    Change-Id: I6f006ae7a16ee73de20448e1228d9acfd69becb4

diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 2e23ba8..ad0fe79 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -84,6 +84,7 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
 	ucb/source/ucp/webdav/SerfGetReqProcImpl \
 	ucb/source/ucp/webdav/SerfHeadReqProcImpl \
 	ucb/source/ucp/webdav/SerfInputStream \
+	ucb/source/ucp/webdav/SerfLockReqProcImpl \
 	ucb/source/ucp/webdav/SerfMkColReqProcImpl \
 	ucb/source/ucp/webdav/SerfMoveReqProcImpl \
 	ucb/source/ucp/webdav/SerfPostReqProcImpl \
diff --git a/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
new file mode 100644
index 0000000..f5aa35c
--- /dev/null
+++ b/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "SerfLockReqProcImpl.hxx"
+#include "DAVException.hxx"
+
+//#include "webdavresponseparser.hxx"
+#include <rtl/strbuf.hxx>
+
+namespace http_dav_ucp
+{
+
+SerfLockReqProcImpl::SerfLockReqProcImpl( const char* inPath,
+                                          const DAVRequestHeaders& inRequestHeaders,
+                                          const css::ucb::Lock & rLock )
+    : SerfRequestProcessorImpl( inPath, inRequestHeaders )
+    , m_aLock( rLock )
+    , m_xInputStream( new SerfInputStream() )
+{
+}
+
+SerfLockReqProcImpl::~SerfLockReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfLockReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+    serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+    OStringBuffer aBody("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+                        "<lockinfo xmlns='DAV:'>\n <lockscope>");
+
+    // Set the lock scope
+    switch ( m_aLock.Scope )
+    {
+        case css::ucb::LockScope_EXCLUSIVE:
+            aBody.append("<exclusive/>");
+            break;
+        case css::ucb::LockScope_SHARED:
+            aBody.append("<shared/>");
+            break;
+        default:
+            throw DAVException( DAVException::DAV_INVALID_ARG );
+    }
+    aBody.append("</lockscope>\n <locktype><write/></locktype>\n");
+
+    // Set the lock owner
+    OUString aValue;
+    if ((m_aLock.Owner >>= aValue) && !aValue.isEmpty())
+    {
+        aBody.append(" <owner>");
+        aBody.append(OUStringToOString(aValue, RTL_TEXTENCODING_UTF8));
+        aBody.append("</owner>\n");
+    }
+    aBody.append("</lockinfo>\n");
+
+    const OString aBodyText(aBody.makeStringAndClear());
+    serf_bucket_t* body_bkt = serf_bucket_simple_copy_create( aBodyText.getStr(),
+                                                              aBodyText.getLength(),
+                                                              pSerfBucketAlloc );
+
+    // create serf request
+    serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
+                                                                 "LOCK",
+                                                                 getPathStr(),
+                                                                 body_bkt,
+                                                                 pSerfBucketAlloc );
+    handleChunkedEncoding(req_bkt, aBodyText.getLength());
+
+    // set request header fields
+    serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+
+    // general header fields provided by caller
+    setRequestHeaders( hdrs_bkt );
+
+    // request specific header fields
+    const char * depth = 0;
+    switch( m_aLock.Depth )
+    {
+        case css::ucb::LockDepth_ZERO:
+            depth = "0";
+            break;
+        case css::ucb::LockDepth_ONE:
+            depth = "1";
+            break;
+        case css::ucb::LockDepth_INFINITY:
+            depth = "infinity";
+            break;
+        default:
+            throw DAVException( DAVException::DAV_INVALID_ARG );
+    }
+    serf_bucket_headers_set( hdrs_bkt, "Depth", depth );
+    serf_bucket_headers_set( hdrs_bkt, "Content-Type", "application/xml" );
+
+    // Set the lock timeout
+    if (m_aLock.Timeout == -1)
+        serf_bucket_headers_set( hdrs_bkt, "Timeout", "Infinite" );
+    else if (m_aLock.Timeout > 0)
+    {
+        const OString aTimeValue("Second-" + OString::number(m_aLock.Timeout));
+        serf_bucket_headers_set( hdrs_bkt, "Timeout", aTimeValue.getStr() );
+    }
+
+    osl_getSystemTime( &m_aStartCall );
+
+    return req_bkt;
+}
+
+void SerfLockReqProcImpl::processChunkOfResponseData( const char* data,
+                                                          apr_size_t len )
+{
+    if ( m_xInputStream.is() )
+    {
+        m_xInputStream->AddToStream( data, len );
+    }
+}
+
+void SerfLockReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
+{
+    //const std::vector< DAVResourceInfo > rResInfo( parseWebDAVPropNameResponse( m_xInputStream.get() ) );
+
+    /*
+    if ( theRetVal == NE_OK )
+    {
+        m_aSerfLockStore.addLock( theLock,
+                                  this,
+                                  lastChanceToSendRefreshRequest(
+                                      startCall, theLock->timeout ) );
+
+        uno::Sequence< OUString > aTokens( 1 );
+        aTokens[ 0 ] = OUString::createFromAscii( theLock->token );
+        m_xLock.LockTokens = aTokens;
+
+        SAL_INFO("ucb.ucp.webdav",  "SerfSession::LOCK: created lock for "
+                    << makeAbsoluteURL( inPath ) << ". token: " << theLock->token );
+    }
+    else
+    {
+        ne_lock_destroy( theLock );
+
+        SAL_INFO("ucb.ucp.webdav",  "SerfSession::LOCK: obtaining lock for "
+                    << makeAbsoluteURL( inPath ) << " failed!");
+    }
+    */
+}
+
+} // namespace http_dav_ucp
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
new file mode 100644
index 0000000..cb746a3
--- /dev/null
+++ b/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SERFLOCKREQPROCIMPL_HXX
+#define INCLUDED_SERFLOCKREQPROCIMPL_HXX
+
+#include "SerfRequestProcessorImpl.hxx"
+#include "SerfInputStream.hxx"
+
+#include <com/sun/star/ucb/Lock.hpp>
+#include <osl/time.h>
+
+namespace http_dav_ucp
+{
+
+class SerfLockReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+    SerfLockReqProcImpl( const char* inPath,
+                         const DAVRequestHeaders& inRequestHeaders,
+                         const css::ucb::Lock & rLock );
+
+    virtual ~SerfLockReqProcImpl() SAL_OVERRIDE;
+
+    virtual
+    serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest ) SAL_OVERRIDE;
+
+private:
+    virtual
+    void processChunkOfResponseData( const char* data, apr_size_t len ) SAL_OVERRIDE;
+
+    virtual
+    void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket ) SAL_OVERRIDE;
+
+    css::ucb::Lock m_aLock;
+    TimeValue m_aStartCall;
+    css::uno::Reference< SerfInputStream > m_xInputStream;
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFLOCKREQPROCIMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
index 70d5575..8a1663b 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
@@ -30,6 +30,7 @@
 #include "SerfMkColReqProcImpl.hxx"
 #include "SerfCopyReqProcImpl.hxx"
 #include "SerfMoveReqProcImpl.hxx"
+#include "SerfLockReqProcImpl.hxx"
 
 #include <apr_strings.h>
 
@@ -308,6 +309,16 @@ bool SerfRequestProcessor::processMove( const OUString & inDestinationPath,
     return outSerfStatus == APR_SUCCESS;
 }
 
+
+bool SerfRequestProcessor::processLock( const css::ucb::Lock & rLock )
+{
+    mpProcImpl = new SerfLockReqProcImpl( mPathStr,
+                                          mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
+                                          rLock );
+
+    return runProcessor() == APR_SUCCESS;
+}
+
 apr_status_t SerfRequestProcessor::runProcessor()
 {
     prepareProcessor();
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.hxx b/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
index 9addb34..f941a49 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
@@ -32,6 +32,7 @@
 
 #include "SerfInputStream.hxx"
 #include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/ucb/Lock.hpp>
 
 namespace http_dav_ucp
 {
@@ -124,6 +125,9 @@ public:
                       const bool inOverwrite,
                       apr_status_t& outSerfStatus );
 
+    //LOCK
+    bool processLock( const css::ucb::Lock & rLock );
+
     apr_status_t provideSerfCredentials( char ** outUsername,
                                          char ** outPassword,
                                          serf_request_t * inRequest,
diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx
index 355c563..9ac01fa 100644
--- a/ucb/source/ucp/webdav/SerfSession.cxx
+++ b/ucb/source/ucp/webdav/SerfSession.cxx
@@ -972,7 +972,7 @@ namespace
 // LOCK (set new lock)
 // -------------------------------------------------------------------
 void SerfSession::LOCK( const OUString & inPath,
-                        ucb::Lock & /*rLock*/,
+                        ucb::Lock & rLock,
                         const DAVRequestEnvironment & rEnv )
     throw ( DAVException )
 {
@@ -981,90 +981,9 @@ void SerfSession::LOCK( const OUString & inPath,
     Init( rEnv );
 
     boost::shared_ptr<SerfRequestProcessor> aReqProc( createReqProc( inPath ) );
-    HandleError( aReqProc );
-    /* Create a depth zero, exclusive write lock, with default timeout
-     * (allowing a server to pick a default).  token, owner and uri are
-     * unset. */
-    /*
-    SerfLock * theLock = ne_lock_create();
-
-    // Set the lock uri
-    ne_uri aUri;
-    ne_uri_parse( OUStringToOString( makeAbsoluteURL( inPath ),
-                                          RTL_TEXTENCODING_UTF8 ).getStr(),
-                  &aUri );
-    theLock->uri = aUri;
-
-    // Set the lock depth
-    switch( rLock.Depth )
-    {
-    case ucb::LockDepth_ZERO:
-        theLock->depth = NE_DEPTH_ZERO;
-        break;
-    case ucb::LockDepth_ONE:
-        theLock->depth = NE_DEPTH_ONE;
-        break;
-    case ucb::LockDepth_INFINITY:
-        theLock->depth = NE_DEPTH_INFINITE;
-        break;
-    default:
-        throw DAVException( DAVException::DAV_INVALID_ARG );
-    }
-
-    // Set the lock scope
-    switch ( rLock.Scope )
-    {
-    case ucb::LockScope_EXCLUSIVE:
-        theLock->scope = ne_lockscope_exclusive;
-        break;
-    case ucb::LockScope_SHARED:
-        theLock->scope = ne_lockscope_shared;
-        break;
-    default:
-        throw DAVException( DAVException::DAV_INVALID_ARG );
-    }
-
-    // Set the lock timeout
-    theLock->timeout = (long)rLock.Timeout;
-
-    // Set the lock owner
-    OUString aValue;
-    rLock.Owner >>= aValue;
-    theLock->owner =
-        ne_strdup( OUStringToOString( aValue,
-                                           RTL_TEXTENCODING_UTF8 ).getStr() );
-    TimeValue startCall;
-    osl_getSystemTime( &startCall );
-
-    int theRetVal = ne_lock( m_pHttpSession, theLock );
-
-    if ( theRetVal == NE_OK )
-    {
-        m_aSerfLockStore.addLock( theLock,
-                                  this,
-                                  lastChanceToSendRefreshRequest(
-                                      startCall, theLock->timeout ) );
-
-        uno::Sequence< OUString > aTokens( 1 );
-        aTokens[ 0 ] = OUString::createFromAscii( theLock->token );
-        rLock.LockTokens = aTokens;
-
-        OSL_TRACE( "SerfSession::LOCK: created lock for %s. token: %s",
-                   OUStringToOString( makeAbsoluteURL( inPath ),
-                                           RTL_TEXTENCODING_UTF8 ).getStr(),
-                   theLock->token );
-    }
-    else
-    {
-        ne_lock_destroy( theLock );
+    aReqProc->processLock( rLock );
 
-        OSL_TRACE( "SerfSession::LOCK: obtaining lock for %s failed!",
-                   OUStringToOString( makeAbsoluteURL( inPath ),
-                                           RTL_TEXTENCODING_UTF8 ).getStr() );
-    }
-
-    HandleError( theRetVal, inPath, rEnv );
-    */
+    HandleError( aReqProc );
 }
 
 // -------------------------------------------------------------------
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index 7d6ffe3..5c9afc2 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -598,6 +598,11 @@ uno::Any SAL_CALL Content::execute(
         }
 
         aRet = open( aOpenCommand, Environment );
+
+        if ( (aOpenCommand.Mode == ucb::OpenMode::DOCUMENT ||
+              aOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE) &&
+                supportsExclusiveWriteLock( Environment ) )
+            lock( Environment );
     }
     else if ( aCommand.Name == "insert" )
     {
commit ef1ae4bc7371b73df60f846f081f67027aff71a2
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Mar 20 09:20:30 2014 +0100

    Remove pointless SerfRequestProcessorImplFac indirection.
    
    Change-Id: If8549893a686c7a665adde0436d377d6d695e5bf
    (cherry picked from commit 9f586e2fbe41ec4d808369fac9501e3e9aea08f5)

diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 4f6f4c2..2e23ba8 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -92,7 +92,6 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
 	ucb/source/ucp/webdav/SerfPutReqProcImpl \
 	ucb/source/ucp/webdav/SerfRequestProcessor \
 	ucb/source/ucp/webdav/SerfRequestProcessorImpl \
-	ucb/source/ucp/webdav/SerfRequestProcessorImplFac \
 	ucb/source/ucp/webdav/SerfSession \
 	ucb/source/ucp/webdav/SerfUri \
 	ucb/source/ucp/webdav/UCBDeadPropertyValue \
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
index 5e2b67e..70d5575 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
@@ -18,10 +18,18 @@
  */
 
 #include "SerfRequestProcessor.hxx"
-#include "SerfRequestProcessorImpl.hxx"
-#include "SerfRequestProcessorImplFac.hxx"
 #include "SerfCallbacks.hxx"
 #include "SerfSession.hxx"
+#include "SerfPropFindReqProcImpl.hxx"
+#include "SerfPropPatchReqProcImpl.hxx"
+#include "SerfGetReqProcImpl.hxx"
+#include "SerfHeadReqProcImpl.hxx"
+#include "SerfPutReqProcImpl.hxx"
+#include "SerfPostReqProcImpl.hxx"
+#include "SerfDeleteReqProcImpl.hxx"
+#include "SerfMkColReqProcImpl.hxx"
+#include "SerfCopyReqProcImpl.hxx"
+#include "SerfMoveReqProcImpl.hxx"
 
 #include <apr_strings.h>
 
@@ -80,7 +88,7 @@ bool SerfRequestProcessor::processPropFind( const Depth inDepth,
                                             std::vector< DAVResource > & ioResources,
                                             apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createPropFindReqProcImpl( mPathStr,
+    mpProcImpl = new SerfPropFindReqProcImpl( mPathStr,
                                             mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                             inDepth,
                                             inPropNames,
@@ -95,7 +103,7 @@ bool SerfRequestProcessor::processPropFind( const Depth inDepth,
                                             std::vector< DAVResourceInfo > & ioResInfo,
                                             apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createPropFindReqProcImpl( mPathStr,
+    mpProcImpl = new SerfPropFindReqProcImpl( mPathStr,
                                             mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                             inDepth,
                                             ioResInfo );
@@ -108,7 +116,7 @@ bool SerfRequestProcessor::processPropFind( const Depth inDepth,
 bool SerfRequestProcessor::processPropPatch( const std::vector< ProppatchValue > & inProperties,
                                              apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createPropPatchReqProcImpl( mPathStr,
+    mpProcImpl = new SerfPropPatchReqProcImpl( mPathStr,
                                              mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                              inProperties );
     outSerfStatus = runProcessor();
@@ -120,7 +128,7 @@ bool SerfRequestProcessor::processPropPatch( const std::vector< ProppatchValue >
 bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
                                        apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createGetReqProcImpl( mPathStr,
+    mpProcImpl = new SerfGetReqProcImpl( mPathStr,
                                        mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                        xioInStrm );
     outSerfStatus = runProcessor();
@@ -134,7 +142,7 @@ bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< Ser
                                        DAVResource & ioResource,
                                        apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createGetReqProcImpl( mPathStr,
+    mpProcImpl = new SerfGetReqProcImpl( mPathStr,
                                        mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                        xioInStrm,
                                        inHeaderNames,
@@ -148,7 +156,7 @@ bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< Ser
 bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
                                        apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createGetReqProcImpl( mPathStr,
+    mpProcImpl = new SerfGetReqProcImpl( mPathStr,
                                        mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                        xioOutStrm );
     outSerfStatus = runProcessor();
@@ -162,7 +170,7 @@ bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< com
                                        DAVResource & ioResource,
                                        apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createGetReqProcImpl( mPathStr,
+    mpProcImpl = new SerfGetReqProcImpl( mPathStr,
                                        mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                        xioOutStrm,
                                        inHeaderNames,
@@ -177,7 +185,7 @@ bool SerfRequestProcessor::processHead( const std::vector< OUString > & inHeader
                                         DAVResource & ioResource,
                                         apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createHeadReqProcImpl( mPathStr,
+    mpProcImpl = new SerfHeadReqProcImpl( mPathStr,
                                         mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                         inHeaderNames,
                                         ioResource );
@@ -191,7 +199,7 @@ bool SerfRequestProcessor::processPut( const char* inData,
                                        apr_size_t inDataLen,
                                        apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createPutReqProcImpl( mPathStr,
+    mpProcImpl = new SerfPutReqProcImpl( mPathStr,
                                        mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                        inData,
                                        inDataLen );
@@ -212,7 +220,7 @@ bool SerfRequestProcessor::processPost( const char* inData,
                                 OUStringToOString( inContentType, RTL_TEXTENCODING_UTF8 ).getStr() );
     mReferer = apr_pstrdup( mrSerfSession.getAprPool(),
                                 OUStringToOString( inReferer, RTL_TEXTENCODING_UTF8 ).getStr() );
-    mpProcImpl = createPostReqProcImpl( mPathStr,
+    mpProcImpl = new SerfPostReqProcImpl( mPathStr,
                                         mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                         inData,
                                         inDataLen,
@@ -236,7 +244,7 @@ bool SerfRequestProcessor::processPost( const char* inData,
                                 OUStringToOString( inContentType, RTL_TEXTENCODING_UTF8 ).getStr() );
     mReferer = apr_pstrdup( mrSerfSession.getAprPool(),
                             OUStringToOString( inReferer, RTL_TEXTENCODING_UTF8 ).getStr() );
-    mpProcImpl = createPostReqProcImpl( mPathStr,
+    mpProcImpl = new SerfPostReqProcImpl( mPathStr,
                                         mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                         inData,
                                         inDataLen,
@@ -251,7 +259,7 @@ bool SerfRequestProcessor::processPost( const char* inData,
 // DELETE
 bool SerfRequestProcessor::processDelete( apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createDeleteReqProcImpl( mPathStr,
+    mpProcImpl = new SerfDeleteReqProcImpl( mPathStr,
                                           mrSerfSession.getRequestEnvironment().m_aRequestHeaders );
     outSerfStatus = runProcessor();
 
@@ -261,7 +269,7 @@ bool SerfRequestProcessor::processDelete( apr_status_t& outSerfStatus )
 // MKCOL
 bool SerfRequestProcessor::processMkCol( apr_status_t& outSerfStatus )
 {
-    mpProcImpl = createMkColReqProcImpl( mPathStr,
+    mpProcImpl = new SerfMkColReqProcImpl( mPathStr,
                                          mrSerfSession.getRequestEnvironment().m_aRequestHeaders );
     outSerfStatus = runProcessor();
 
@@ -275,7 +283,7 @@ bool SerfRequestProcessor::processCopy( const OUString & inDestinationPath,
 {
     mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
                                 OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ).getStr() );
-    mpProcImpl = createCopyReqProcImpl( mPathStr,
+    mpProcImpl = new SerfCopyReqProcImpl( mPathStr,
                                         mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                         mDestPathStr,
                                         inOverwrite );
@@ -291,7 +299,7 @@ bool SerfRequestProcessor::processMove( const OUString & inDestinationPath,
 {
     mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
                                 OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ).getStr() );
-    mpProcImpl = createMoveReqProcImpl( mPathStr,
+    mpProcImpl = new SerfMoveReqProcImpl( mPathStr,
                                         mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
                                         mDestPathStr,
                                         inOverwrite );
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx b/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx
deleted file mode 100644
index cbd45a1..0000000
--- a/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx
+++ /dev/null
@@ -1,221 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "SerfRequestProcessorImplFac.hxx"
-#include "SerfPropFindReqProcImpl.hxx"
-#include "SerfPropPatchReqProcImpl.hxx"
-#include "SerfGetReqProcImpl.hxx"
-#include "SerfHeadReqProcImpl.hxx"
-#include "SerfPutReqProcImpl.hxx"
-#include "SerfPostReqProcImpl.hxx"
-#include "SerfDeleteReqProcImpl.hxx"
-#include "SerfMkColReqProcImpl.hxx"
-#include "SerfCopyReqProcImpl.hxx"
-#include "SerfMoveReqProcImpl.hxx"
-
-namespace http_dav_ucp
-{
-    SerfRequestProcessorImpl* createPropFindReqProcImpl( const char* inPath,
-                                                         const DAVRequestHeaders& inRequestHeaders,
-                                                         const Depth inDepth,
-                                                         const std::vector< OUString > & inPropNames,
-                                                         std::vector< DAVResource > & ioResources )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfPropFindReqProcImpl( inPath,
-                                                                              inRequestHeaders,
-                                                                              inDepth,
-                                                                              inPropNames,
-                                                                              ioResources );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createPropFindReqProcImpl( const char* inPath,
-                                                         const DAVRequestHeaders& inRequestHeaders,
-                                                         const Depth inDepth,
-                                                         std::vector< DAVResourceInfo > & ioResInfo )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfPropFindReqProcImpl( inPath,
-                                                                              inRequestHeaders,
-                                                                              inDepth,
-                                                                              ioResInfo );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createPropPatchReqProcImpl( const char* inPath,
-                                                          const DAVRequestHeaders& inRequestHeaders,
-                                                          const std::vector< ProppatchValue > & inProperties )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfPropPatchReqProcImpl( inPath,
-                                                                               inRequestHeaders,
-                                                                               inProperties );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createGetReqProcImpl( const char* inPath,
-                                                    const DAVRequestHeaders& inRequestHeaders,
-                                                    const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfGetReqProcImpl( inPath,
-                                                                         inRequestHeaders,
-                                                                         xioInStrm );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createGetReqProcImpl( const char* inPath,
-                                                    const DAVRequestHeaders& inRequestHeaders,
-                                                    const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
-                                                    const std::vector< OUString > & inHeaderNames,
-                                                    DAVResource& ioResource )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfGetReqProcImpl( inPath,
-                                                                         inRequestHeaders,
-                                                                         xioInStrm,
-                                                                         inHeaderNames,
-                                                                         ioResource );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createGetReqProcImpl( const char* inPath,
-                                                    const DAVRequestHeaders& inRequestHeaders,
-                                                    const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfGetReqProcImpl( inPath,
-                                                                         inRequestHeaders,
-                                                                         xioOutStrm );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createGetReqProcImpl( const char* inPath,
-                                                    const DAVRequestHeaders& inRequestHeaders,
-                                                    const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream >& xioOutStrm,
-                                                    const std::vector< OUString > & inHeaderNames,
-                                                    DAVResource& ioResource )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfGetReqProcImpl( inPath,
-                                                                         inRequestHeaders,
-                                                                         xioOutStrm,
-                                                                         inHeaderNames,
-                                                                         ioResource );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createHeadReqProcImpl( const char* inPath,
-                                                     const DAVRequestHeaders& inRequestHeaders,
-                                                     const std::vector< OUString > & inHeaderNames,
-                                                     DAVResource& ioResource )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfHeadReqProcImpl( inPath,
-                                                                          inRequestHeaders,
-                                                                          inHeaderNames,
-                                                                          ioResource );
-        return pReqProcImpl;
-    }
-
-
-    SerfRequestProcessorImpl* createPutReqProcImpl( const char* inPath,
-                                                    const DAVRequestHeaders& inRequestHeaders,
-                                                    const char* inData,
-                                                    apr_size_t inDataLen )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfPutReqProcImpl( inPath,
-                                                                         inRequestHeaders,
-                                                                         inData,
-                                                                         inDataLen );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createPostReqProcImpl( const char* inPath,
-                                                     const DAVRequestHeaders& inRequestHeaders,
-                                                     const char* inData,
-                                                     apr_size_t inDataLen,
-                                                     const char* inContentType,
-                                                     const char* inReferer,
-                                                     const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfPostReqProcImpl( inPath,
-                                                                          inRequestHeaders,
-                                                                          inData,
-                                                                          inDataLen,
-                                                                          inContentType,
-                                                                          inReferer,
-                                                                          xioInStrm );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createPostReqProcImpl( const char* inPath,
-                                                     const DAVRequestHeaders& inRequestHeaders,
-                                                     const char* inData,
-                                                     apr_size_t inDataLen,
-                                                     const char* inContentType,
-                                                     const char* inReferer,
-                                                     const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfPostReqProcImpl( inPath,
-                                                                          inRequestHeaders,
-                                                                          inData,
-                                                                          inDataLen,
-                                                                          inContentType,
-                                                                          inReferer,
-                                                                          xioOutStrm );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createDeleteReqProcImpl( const char* inPath,
-                                                       const DAVRequestHeaders& inRequestHeaders )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfDeleteReqProcImpl( inPath,
-                                                                            inRequestHeaders );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createMkColReqProcImpl( const char* inPath,
-                                                      const DAVRequestHeaders& inRequestHeaders )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfMkColReqProcImpl( inPath,
-                                                                           inRequestHeaders );
-        return pReqProcImpl;
-    }
-
-    SerfRequestProcessorImpl* createCopyReqProcImpl( const char* inSourcePath,
-                                                     const DAVRequestHeaders& inRequestHeaders,
-                                                     const char* inDestinationPath,
-                                                     const bool inOverwrite )
-    {
-        SerfRequestProcessorImpl* pReqProcImpl = new SerfCopyReqProcImpl( inSourcePath,
-                                                                          inRequestHeaders,
-                                                                          inDestinationPath,
-                                                                          inOverwrite );
-        return pReqProcImpl;
-    }
-

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list