Skip to content

Commit 0563067

Browse files
committed
fixed:Download pass proxy hash is incorrect
added:download add hashfile field to http hdr
1 parent 625ad81 commit 0563067

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

XEngine_Source/XEngine_StorageApp/StorageApp_Download.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ void CALLBACK XEngine_Download_CBSend(LPCSTR lpszClientAddr, SOCKET hSocket, LPV
5757
{
5858
int nPLen = MAX_PATH;
5959
int nHttpCode = 0;
60+
int nHashLen = 0;
6061
UCHAR tszHashKey[MAX_PATH];
6162
TCHAR tszHashStr[MAX_PATH];
6263
TCHAR tszProxyStr[MAX_PATH];
@@ -67,8 +68,8 @@ void CALLBACK XEngine_Download_CBSend(LPCSTR lpszClientAddr, SOCKET hSocket, LPV
6768
memset(tszProxyStr, '\0', MAX_PATH);
6869
memset(&st_StorageInfo, '\0', sizeof(SESSION_STORAGEINFO));
6970

70-
OPenSsl_Api_Digest(st_StorageInfo.tszFileDir, tszHashKey, NULL, TRUE, st_ServiceCfg.st_XStorage.nHashMode);
71-
BaseLib_OperatorString_StrToHex((char*)tszHashKey, 20, tszHashStr);
71+
OPenSsl_Api_Digest(st_StorageInfo.tszFileDir, tszHashKey, &nHashLen, TRUE, st_ServiceCfg.st_XStorage.nHashMode);
72+
BaseLib_OperatorString_StrToHex((char*)tszHashKey, nHashLen, tszHashStr);
7273
Session_DLStroage_GetInfo(lpszClientAddr, &st_StorageInfo);
7374

7475
Protocol_StoragePacket_UPDown(st_StorageInfo.tszFileDir, st_StorageInfo.tszClientAddr, st_StorageInfo.ullRWCount, tszProxyStr, &nPLen, tszHashStr);
@@ -196,8 +197,21 @@ BOOL XEngine_Task_HttpDownload(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, in
196197
st_HDRParam.nHttpCode = 200;
197198
st_HDRParam.bIsClose = TRUE;
198199
}
200+
int nHashLen = 0;
201+
UCHAR tszHashKey[MAX_PATH];
202+
TCHAR tszHashStr[MAX_PATH];
203+
TCHAR tszFieldStr[MAX_PATH];
204+
memset(tszHashKey, '\0', MAX_PATH);
205+
memset(tszHashStr, '\0', MAX_PATH);
206+
memset(tszFieldStr, '\0', MAX_PATH);
207+
208+
OPenSsl_Api_Digest(tszFileDir, tszHashKey, &nHashLen, TRUE, st_ServiceCfg.st_XStorage.nHashMode);
209+
BaseLib_OperatorString_StrToHex((char*)tszHashKey, nHashLen, tszHashStr);
199210
BaseLib_OperatorString_GetFileAndPath(tszFileDir, NULL, NULL, NULL, st_HDRParam.tszMimeType);
200-
RfcComponents_HttpServer_SendMsgEx(xhDLHttp, tszSDBuffer, &nSDLen, &st_HDRParam, NULL, ullSize);
211+
212+
_stprintf(tszFieldStr, _T("FileHash: %s\r\n"),tszHashStr);
213+
214+
RfcComponents_HttpServer_SendMsgEx(xhDLHttp, tszSDBuffer, &nSDLen, &st_HDRParam, NULL, ullSize, tszFieldStr);
201215
XEngine_Net_SendMsg(lpszClientAddr, tszSDBuffer, nSDLen, STORAGE_NETTYPE_HTTPDOWNLOAD);
202216
//不能在send之前调用
203217
if (!NetCore_TCPXCore_CBSendEx(xhNetDownload, lpszClientAddr, XEngine_Download_CBSend))

0 commit comments

Comments
 (0)