Add thread-local storage of rpc username

This commit is contained in:
instagibbs 2016-04-21 11:11:04 -07:00 committed by Gregory Sanders
parent c87debb048
commit ce43197c11
4 changed files with 19 additions and 1 deletions

View file

@ -176,6 +176,14 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
return false;
}
//Set thread-local storage variable to RPC user name for logging
std::string strUserPass64 = authHeader.second.substr(6);
boost::trim(strUserPass64);
std::string strUserPass = DecodeBase64(strUserPass64);
if (!userInstance.get()) {
userInstance.reset(new std::string(strUserPass.substr(0, strUserPass.find(":"))));
}
try {
// Parse request
UniValue valRequest;