Skip to content

Commit ef173b3

Browse files
committed
modify:propfind add lock info
1 parent 097a970 commit ef173b3

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

XEngine_Source/StorageModule_Protocol/Protocol_Packet/Protocol_StoragePacket.cpp

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,64 @@ bool CProtocol_StoragePacket::Protocol_StoragePacket_WDPropfind(XCHAR* ptszMsgBu
629629
XMLElement* pSt_XMLModifyTime = m_XMLDocument.NewElement("d:getlastmodified");
630630
pSt_XMLModifyTime->SetText(tszGMTTime);
631631
pSt_XMLProp->InsertEndChild(pSt_XMLModifyTime);
632+
//增加会话属性
633+
//获得会话
634+
XENGINE_WEBDAVLOCK st_WDLocker = {};
635+
if (Session_Webdav_Get(tszFileAlis, &st_WDLocker))
636+
{
637+
// 子元素 <lockdiscovery>
638+
XMLElement* pSt_XMLLockDiscovery = m_XMLDocument.NewElement("D:lockdiscovery");
639+
pSt_XMLProp->InsertEndChild(pSt_XMLLockDiscovery);
640+
// 子元素 <activelock>
641+
XMLElement* pSt_XMLLockActive = m_XMLDocument.NewElement("D:activelock");
642+
pSt_XMLLockDiscovery->InsertEndChild(pSt_XMLLockActive);
643+
// 子元素 <locktype>
644+
XMLElement* pSt_XMLLockType = m_XMLDocument.NewElement("D:locktype");
645+
pSt_XMLLockActive->InsertEndChild(pSt_XMLLockType);
646+
if (1 == st_WDLocker.byLockOP)
647+
{
648+
XMLElement* pSt_XMLLockWrite = m_XMLDocument.NewElement("D:write");
649+
pSt_XMLLockType->InsertEndChild(pSt_XMLLockWrite);
650+
}
651+
else if (2 == st_WDLocker.byLockOP)
652+
{
653+
XMLElement* pSt_XMLLockRead = m_XMLDocument.NewElement("D:read");
654+
pSt_XMLLockType->InsertEndChild(pSt_XMLLockRead);
655+
}
656+
// 子元素 <lockscope>
657+
XMLElement* pSt_XMLLockScope = m_XMLDocument.NewElement("D:lockscope");
658+
pSt_XMLLockActive->InsertEndChild(pSt_XMLLockScope);
659+
if (1 == st_WDLocker.byLockType)
660+
{
661+
XMLElement* pSt_XMLLockExclusive = m_XMLDocument.NewElement("D:exclusive");
662+
pSt_XMLLockScope->InsertEndChild(pSt_XMLLockExclusive);
663+
}
664+
else if (2 == st_WDLocker.byLockType)
665+
{
666+
XMLElement* pSt_XMLLockShared = m_XMLDocument.NewElement("D:shared");
667+
pSt_XMLLockScope->InsertEndChild(pSt_XMLLockShared);
668+
}
669+
// 子元素 <depth>
670+
XMLElement* pSt_XMLDepth = m_XMLDocument.NewElement("D:depth");
671+
pSt_XMLDepth->SetText(_X("Infinity"));
672+
pSt_XMLLockActive->InsertEndChild(pSt_XMLDepth);
673+
// 子元素 <owner>
674+
XMLElement* pSt_XMLOwner = m_XMLDocument.NewElement("D:owner");
675+
pSt_XMLLockActive->InsertEndChild(pSt_XMLOwner);
676+
XMLElement* pSt_XMHRef = m_XMLDocument.NewElement("D:href");
677+
pSt_XMHRef->SetText(st_WDLocker.tszOwner);
678+
pSt_XMLOwner->InsertEndChild(pSt_XMHRef);
679+
// 子元素 <timeout>
680+
XMLElement* pSt_XMLTimeout = m_XMLDocument.NewElement("D:timeout");
681+
pSt_XMLTimeout->SetText(st_WDLocker.tszTimeout);
682+
pSt_XMLLockActive->InsertEndChild(pSt_XMLTimeout);
683+
// 子元素 <locktoken>
684+
XMLElement* pSt_XMLLockToken = m_XMLDocument.NewElement("D:locktoken");
685+
pSt_XMLLockActive->InsertEndChild(pSt_XMLLockToken);
686+
XMLElement* pSt_XMHTokenRef = m_XMLDocument.NewElement("D:href");
687+
pSt_XMHTokenRef->SetText(st_WDLocker.tszToken);
688+
pSt_XMLLockToken->InsertEndChild(pSt_XMHTokenRef);
689+
}
632690
}
633691
else
634692
{

XEngine_Source/StorageModule_Protocol/pch.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ using namespace tinyxml2;
4444
#include "../StorageModule_Config/Config_Define.h"
4545
#include "../StorageModule_Config/Config_Error.h"
4646
#include "../StorageModule_Session/Session_Define.h"
47+
#include "../StorageModule_Session/Session_Error.h"
4748
#include "../StorageModule_Database/Database_Define.h"
4849
#include "../StorageModule_APIHelp/APIHelp_Define.h"
4950
#include "../StorageModule_APIHelp/APIHelp_Error.h"
@@ -70,20 +71,24 @@ extern XLONG Protocol_dwErrorCode;
7071
#ifdef _WIN64
7172
#pragma comment(lib,"../x64/Debug/jsoncpp")
7273
#pragma comment(lib,"../x64/Debug/tinyxml2")
74+
#pragma comment(lib,"../x64/Debug/StorageModule_Session.lib")
7375
#pragma comment(lib,"../x64/Debug/StorageModule_APIHelp.lib")
7476
#else
7577
#pragma comment(lib,"../Debug/jsoncpp")
7678
#pragma comment(lib,"../Debug/tinyxml2")
79+
#pragma comment(lib,"../Debug/StorageModule_Session.lib")
7780
#pragma comment(lib,"../Debug/StorageModule_APIHelp.lib")
7881
#endif
7982
#else
8083
#ifdef _WIN64
8184
#pragma comment(lib,"../x64/Release/jsoncpp")
8285
#pragma comment(lib,"../x64/Release/tinyxml2")
86+
#pragma comment(lib,"../x64/Release/StorageModule_Session.lib")
8387
#pragma comment(lib,"../x64/Release/StorageModule_APIHelp.lib")
8488
#else
8589
#pragma comment(lib,"../Release/jsoncpp")
8690
#pragma comment(lib,"../Release/tinyxml2")
91+
#pragma comment(lib,"../Release/StorageModule_Session.lib")
8792
#pragma comment(lib,"../Release/StorageModule_APIHelp.lib")
8893
#endif
8994
#endif

XEngine_Source/XEngine_StorageApp/StorageApp_Webdav.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ bool XEngine_Task_HttpWebdav(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int
208208
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("WEBDAV客户端:%s,处理WEBDAV协议LOCK方法失败,协议不正确,内容:%s"), lpszClientAddr, lpszMsgBuffer);
209209
return false;
210210
}
211-
Session_Webdav_Insert(pSt_HTTPParam->tszHttpUri + 1, &st_WDLock);
211+
Session_Webdav_Insert(pSt_HTTPParam->tszHttpUri, &st_WDLock);
212212
Protocol_StoragePacket_WDLock(tszRVBuffer, &nRVLen, &st_WDLock);
213+
nRVLen -= 1;
214+
213215
HttpProtocol_Server_SendMsgEx(xhWebdavHttp, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen);
214216
XEngine_Net_SendMsg(lpszClientAddr, tszSDBuffer, nSDLen, STORAGE_NETTYPE_HTTPWEBDAV);
215217
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("WEBDAV客户端:%s,处理WEBDAV协议LOCK方法成功,锁用户:%s"), lpszClientAddr, st_WDLock.tszOwner);

0 commit comments

Comments
 (0)