Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
c1496e67
Kaydet (Commit)
c1496e67
authored
Mar 20, 2014
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
webdav: Parse response of LOCK request.
Change-Id: Ib17de602e2c51eb29b0495ce7411836ceeccf9d4
üst
6e0cc0cd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
48 deletions
+87
-48
SerfLockReqProcImpl.cxx
ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
+11
-21
webdavresponseparser.cxx
ucb/source/ucp/webdav/webdavresponseparser.cxx
+72
-20
webdavresponseparser.hxx
ucb/source/ucp/webdav/webdavresponseparser.hxx
+4
-7
No files found.
ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
Dosyayı görüntüle @
c1496e67
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#include "SerfLockReqProcImpl.hxx"
#include "SerfLockReqProcImpl.hxx"
#include "DAVException.hxx"
#include "DAVException.hxx"
//
#include "webdavresponseparser.hxx"
#include "webdavresponseparser.hxx"
#include <rtl/strbuf.hxx>
#include <rtl/strbuf.hxx>
namespace
http_dav_ucp
namespace
http_dav_ucp
...
@@ -131,33 +131,23 @@ void SerfLockReqProcImpl::processChunkOfResponseData( const char* data,
...
@@ -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( parseWebDAVPropName
Response( m_xInputStream.get() ) );
const
std
::
vector
<
css
::
ucb
::
Lock
>
aLocks
(
parseWebDAVLock
Response
(
m_xInputStream
.
get
()
)
);
/*
if
(
!
aLocks
.
empty
())
if ( theRetVal == NE_OK )
{
{
m_aSerfLockStore.addLock( theLock,
for
(
size_t
i
=
0
;
i
<
aLocks
.
size
();
++
i
)
this,
{
lastChanceToSendRefreshRequest(
// m_pSerfLockStore->addLock( aLocks[i], m_pSerfSession, m_aStartCall );
startCall, theLock->timeout ) );
SAL_INFO
(
"ucb.ucp.webdav"
,
"SerfSession::LOCK: created lock for "
<<
getPathStr
()
<<
". token: "
<<
aLocks
[
i
].
LockTokens
[
0
]);
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
else
{
{
ne_lock_destroy( theLock );
SAL_INFO
(
"ucb.ucp.webdav"
,
"SerfSession::LOCK: obtaining lock failed!"
);
SAL_INFO("ucb.ucp.webdav", "SerfSession::LOCK: obtaining lock for "
<< makeAbsoluteURL( inPath ) << " failed!");
}
}
*/
}
}
}
// namespace http_dav_ucp
}
// namespace http_dav_ucp
...
...
ucb/source/ucp/webdav/webdavresponseparser.cxx
Dosyayı görüntüle @
c1496e67
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include <com/sun/star/ucb/LockEntry.hpp>
#include <com/sun/star/ucb/LockEntry.hpp>
#include <com/sun/star/ucb/LockScope.hpp>
#include <com/sun/star/ucb/LockScope.hpp>
#include <com/sun/star/ucb/LockType.hpp>
#include <com/sun/star/ucb/LockType.hpp>
#include <com/sun/star/ucb/Lock.hpp>
#include <map>
#include <map>
#include <boost/unordered_map.hpp>
#include <boost/unordered_map.hpp>
...
@@ -69,6 +70,7 @@ namespace
...
@@ -69,6 +70,7 @@ namespace
enum
WebDAVName
enum
WebDAVName
{
{
WebDAVName_unknown
=
0
,
WebDAVName_unknown
=
0
,
WebDAVName_activelock
,
WebDAVName_multistatus
,
WebDAVName_multistatus
,
WebDAVName_response
,
WebDAVName_response
,
WebDAVName_href
,
WebDAVName_href
,
...
@@ -80,8 +82,11 @@ namespace
...
@@ -80,8 +82,11 @@ namespace
WebDAVName_supportedlock
,
WebDAVName_supportedlock
,
WebDAVName_lockentry
,
WebDAVName_lockentry
,
WebDAVName_lockscope
,
WebDAVName_lockscope
,
WebDAVName_locktoken
,
WebDAVName_exclusive
,
WebDAVName_exclusive
,
WebDAVName_locktype
,
WebDAVName_locktype
,
WebDAVName_owner
,
WebDAVName_timeout
,
WebDAVName_write
,
WebDAVName_write
,
WebDAVName_shared
,
WebDAVName_shared
,
WebDAVName_status
,
WebDAVName_status
,
...
@@ -100,6 +105,7 @@ namespace
...
@@ -100,6 +105,7 @@ namespace
if
(
aWebDAVNameMapperList
.
empty
())
if
(
aWebDAVNameMapperList
.
empty
())
{
{
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"activelock"
),
WebDAVName_activelock
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"multistatus"
),
WebDAVName_multistatus
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"multistatus"
),
WebDAVName_multistatus
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"response"
),
WebDAVName_response
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"response"
),
WebDAVName_response
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"href"
),
WebDAVName_href
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"href"
),
WebDAVName_href
));
...
@@ -111,8 +117,11 @@ namespace
...
@@ -111,8 +117,11 @@ namespace
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"supportedlock"
),
WebDAVName_supportedlock
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"supportedlock"
),
WebDAVName_supportedlock
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"lockentry"
),
WebDAVName_lockentry
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"lockentry"
),
WebDAVName_lockentry
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"lockscope"
),
WebDAVName_lockscope
));
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
(
"exclusive"
),
WebDAVName_exclusive
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"locktype"
),
WebDAVName_locktype
));
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
(
"write"
),
WebDAVName_write
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"shared"
),
WebDAVName_shared
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"shared"
),
WebDAVName_shared
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"status"
),
WebDAVName_status
));
aWebDAVNameMapperList
.
insert
(
WebDAVNameValueType
(
OUString
(
"status"
),
WebDAVName_status
));
...
@@ -277,12 +286,14 @@ namespace
...
@@ -277,12 +286,14 @@ namespace
enum
WebDAVResponseParserMode
enum
WebDAVResponseParserMode
{
{
WebDAVResponseParserMode_PropFind
=
0
,
WebDAVResponseParserMode_PropFind
=
0
,
WebDAVResponseParserMode_PropName
WebDAVResponseParserMode_PropName
,
WebDAVResponseParserMode_Lock
};
};
class
WebDAVResponseParser
:
public
cppu
::
WeakImplHelper1
<
com
::
sun
::
star
::
xml
::
sax
::
XDocumentHandler
>
class
WebDAVResponseParser
:
public
cppu
::
WeakImplHelper1
<
com
::
sun
::
star
::
xml
::
sax
::
XDocumentHandler
>
{
{
private
:
private
:
std
::
vector
<
ucb
::
Lock
>
maResult_Lock
;
std
::
vector
<
http_dav_ucp
::
DAVResource
>
maResult_PropFind
;
std
::
vector
<
http_dav_ucp
::
DAVResource
>
maResult_PropFind
;
std
::
vector
<
http_dav_ucp
::
DAVResourceInfo
>
maResult_PropName
;
std
::
vector
<
http_dav_ucp
::
DAVResourceInfo
>
maResult_PropName
;
...
@@ -296,6 +307,7 @@ namespace
...
@@ -296,6 +307,7 @@ namespace
uno
::
Sequence
<
ucb
::
LockEntry
>
maLockEntries
;
uno
::
Sequence
<
ucb
::
LockEntry
>
maLockEntries
;
ucb
::
LockScope
maLockScope
;
ucb
::
LockScope
maLockScope
;
ucb
::
LockType
maLockType
;
ucb
::
LockType
maLockType
;
ucb
::
Lock
maLock
;
WebDAVResponseParserMode
meWebDAVResponseParserMode
;
WebDAVResponseParserMode
meWebDAVResponseParserMode
;
// bitfield
// bitfield
...
@@ -356,6 +368,7 @@ namespace
...
@@ -356,6 +368,7 @@ namespace
virtual
void
SAL_CALL
processingInstruction
(
const
OUString
&
aTarget
,
const
OUString
&
aData
)
throw
(
xml
::
sax
::
SAXException
,
uno
::
RuntimeException
);
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
);
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
::
DAVResource
>&
getResult_PropFind
()
const
{
return
maResult_PropFind
;
}
const
std
::
vector
<
http_dav_ucp
::
DAVResourceInfo
>&
getResult_PropName
()
const
{
return
maResult_PropName
;
}
const
std
::
vector
<
http_dav_ucp
::
DAVResourceInfo
>&
getResult_PropName
()
const
{
return
maResult_PropName
;
}
};
};
...
@@ -480,6 +493,11 @@ namespace
...
@@ -480,6 +493,11 @@ namespace
mbLockTypeSet
=
false
;
mbLockTypeSet
=
false
;
break
;
break
;
}
}
case
WebDAVName_activelock
:
{
maLock
=
ucb
::
Lock
();
break
;
}
}
}
break
;
break
;
}
}
...
@@ -641,6 +659,30 @@ namespace
...
@@ -641,6 +659,30 @@ namespace
}
}
break
;
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
:
case
WebDAVName_exclusive
:
{
{
// exclusive lockscope end
// exclusive lockscope end
...
@@ -671,6 +713,12 @@ namespace
...
@@ -671,6 +713,12 @@ namespace
}
}
break
;
break
;
}
}
case
WebDAVName_activelock
:
{
maLock
.
Type
=
maLockType
;
maLock
.
Scope
=
maLockScope
;
maResult_Lock
.
push_back
(
maLock
);
}
case
WebDAVName_propstat
:
case
WebDAVName_propstat
:
{
{
// propstat end, check status
// propstat end, check status
...
@@ -789,10 +837,10 @@ namespace
...
@@ -789,10 +837,10 @@ namespace
namespace
namespace
{
{
void
parseWebDAVPropNameResponse
(
template
<
typename
T
>
void
parseWebDAVResponse
(
const
uno
::
Reference
<
io
::
XInputStream
>&
xInputStream
,
const
uno
::
Reference
<
io
::
XInputStream
>&
xInputStream
,
std
::
vector
<
http_dav_ucp
::
DAVResource
>&
rPropFind
,
std
::
vector
<
T
>&
rResult
,
std
::
vector
<
http_dav_ucp
::
DAVResourceInfo
>&
rPropName
,
WebDAVResponseParserMode
eWebDAVResponseParserMode
)
WebDAVResponseParserMode
eWebDAVResponseParserMode
)
{
{
if
(
xInputStream
.
is
())
if
(
xInputStream
.
is
())
...
@@ -818,16 +866,17 @@ namespace
...
@@ -818,16 +866,17 @@ namespace
// get result
// get result
switch
(
eWebDAVResponseParserMode
)
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
:
case
WebDAVResponseParserMode_PropFind
:
{
rResult
=
*
(
std
::
vector
<
T
>*
)
&
pWebDAVResponseParser
->
getResult_PropFind
();
rPropFind
=
pWebDAVResponseParser
->
getResult_PropFind
();
break
;
break
;
}
case
WebDAVResponseParserMode_PropName
:
case
WebDAVResponseParserMode_PropName
:
{
rResult
=
*
(
std
::
vector
<
T
>*
)
&
pWebDAVResponseParser
->
getResult_PropName
();
rPropName
=
pWebDAVResponseParser
->
getResult_PropName
();
break
;
case
WebDAVResponseParserMode_Lock
:
rResult
=
*
(
std
::
vector
<
T
>*
)
&
pWebDAVResponseParser
->
getResult_Lock
();
break
;
break
;
}
}
}
}
}
catch
(
uno
::
Exception
&
)
catch
(
uno
::
Exception
&
)
...
@@ -843,22 +892,25 @@ namespace
...
@@ -843,22 +892,25 @@ namespace
namespace
http_dav_ucp
namespace
http_dav_ucp
{
{
std
::
vector
<
DAVResource
>
parseWebDAVPropFind
Response
(
const
uno
::
Reference
<
io
::
XInputStream
>&
xInputStream
)
std
::
vector
<
ucb
::
Lock
>
parseWebDAVLock
Response
(
const
uno
::
Reference
<
io
::
XInputStream
>&
xInputStream
)
{
{
std
::
vector
<
DAVResource
>
aRetval
;
std
::
vector
<
ucb
::
Lock
>
aResult
;
std
::
vector
<
DAVResourceInfo
>
aFoo
;
parseWebDAVResponse
<
ucb
::
Lock
>
(
xInputStream
,
aResult
,
WebDAVResponseParserMode_Lock
);
return
aResult
;
}
parseWebDAVPropNameResponse
(
xInputStream
,
aRetval
,
aFoo
,
WebDAVResponseParserMode_PropFind
);
std
::
vector
<
DAVResource
>
parseWebDAVPropFindResponse
(
const
uno
::
Reference
<
io
::
XInputStream
>&
xInputStream
)
return
aRetval
;
{
std
::
vector
<
DAVResource
>
aResult
;
parseWebDAVResponse
<
DAVResource
>
(
xInputStream
,
aResult
,
WebDAVResponseParserMode_PropFind
);
return
aResult
;
}
}
std
::
vector
<
DAVResourceInfo
>
parseWebDAVPropNameResponse
(
const
uno
::
Reference
<
io
::
XInputStream
>&
xInputStream
)
std
::
vector
<
DAVResourceInfo
>
parseWebDAVPropNameResponse
(
const
uno
::
Reference
<
io
::
XInputStream
>&
xInputStream
)
{
{
std
::
vector
<
DAVResource
>
aFoo
;
std
::
vector
<
DAVResourceInfo
>
aResult
;
std
::
vector
<
DAVResourceInfo
>
aRetval
;
parseWebDAVResponse
<
DAVResourceInfo
>
(
xInputStream
,
aResult
,
WebDAVResponseParserMode_PropName
);
return
aResult
;
parseWebDAVPropNameResponse
(
xInputStream
,
aFoo
,
aRetval
,
WebDAVResponseParserMode_PropName
);
return
aRetval
;
}
}
}
// namespace http_dav_ucp
}
// namespace http_dav_ucp
...
...
ucb/source/ucp/webdav/webdavresponseparser.hxx
Dosyayı görüntüle @
c1496e67
...
@@ -22,22 +22,19 @@
...
@@ -22,22 +22,19 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/ucb/Lock.hpp>
#include "DAVResource.hxx"
#include "DAVResource.hxx"
#include <vector>
#include <vector>
namespace
http_dav_ucp
namespace
http_dav_ucp
{
{
std
::
vector
<
DAVResource
>
parseWebDAVPropFindResponse
(
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
<
DAVResourceInfo
>
parseWebDAVPropNameResponse
(
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
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
}
// namespace http_dav_ucp
#endif // _WEBDAVRESPONSEPARSER_HXX_
#endif // _WEBDAVRESPONSEPARSER_HXX_
// eof
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment