From e79b6a8e41ef6051b89d6a888629afafe96ec825 Mon Sep 17 00:00:00 2001 From: ShannonDing Date: Mon, 27 Apr 2020 21:41:07 +0800 Subject: [PATCH] Add binary message body to signatures. --- src/common/ClientRPCHook.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/ClientRPCHook.cpp b/src/common/ClientRPCHook.cpp index fc013dada..a8244cf80 100644 --- a/src/common/ClientRPCHook.cpp +++ b/src/common/ClientRPCHook.cpp @@ -50,10 +50,14 @@ void ClientRPCHook::doBeforeRequest(const string& remoteAddr, RemotingCommand& r for (; it != requestMap.end(); ++it) { totalMsg.append(it->second); } - if (request.getMsgBody().length() > 0) { + const MemoryBlock* pBody = request.GetBody(); + if (pBody && pBody->getSize() > 0) { + const char* msg_body = const_cast(static_cast(pBody->getData())); + LOG_DEBUG("msgBody is:%s, msgBody length is:%d", msg_body, pBody->getSize()); + totalMsg.append(msg_body, pBody->getSize()); + } else if (request.getMsgBody().length() > 0) { LOG_DEBUG("msgBody is:%s, msgBody length is:" SIZET_FMT "", request.getMsgBody().c_str(), request.getMsgBody().length()); - totalMsg.append(request.getMsgBody()); } LOG_DEBUG("total msg info are:%s, size is:" SIZET_FMT "", totalMsg.c_str(), totalMsg.size());