diff options
| author | Wladimir J. van der Laan <[email protected]> | 2018-01-29 13:51:03 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2018-01-29 14:08:09 +0100 |
| commit | f3c7062b7bbf7473f318afffd73537d1d387c88a (patch) | |
| tree | 4fd2a123173cd8a512bc117863276348227e4396 /src/httprpc.cpp | |
| parent | Merge #12108: [Refactor] Remove unused fQuit var from checkqueue.h (diff) | |
| parent | Use the character based overload for std::string::find. (diff) | |
| download | discoin-f3c7062b7bbf7473f318afffd73537d1d387c88a.tar.xz discoin-f3c7062b7bbf7473f318afffd73537d1d387c88a.zip | |
Merge #12159: Use the character based overload for std::string::find.
a73aab7 Use the character based overload for std::string::find. (Alin Rus)
Pull request description:
std::string::find has a character based overload as can be seen here
(4th oveload): http://www.cplusplus.com/reference/string/string/find/
Use that instead of constantly allocating temporary strings.
Tree-SHA512: dc7684b1551e6d779eb989e9a74363f9b978059a7c0f3db09d01744c7e6452961f9e671173265e71efff27afbcb80c0fe2c11b6dff2290e54a49193fa25a5679
Diffstat (limited to 'src/httprpc.cpp')
| -rw-r--r-- | src/httprpc.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/httprpc.cpp b/src/httprpc.cpp index 66f7a6a71..5e9e41974 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -85,11 +85,11 @@ static void JSONErrorReply(HTTPRequest* req, const UniValue& objError, const Uni //entries from config file. static bool multiUserAuthorized(std::string strUserPass) { - if (strUserPass.find(":") == std::string::npos) { + if (strUserPass.find(':') == std::string::npos) { return false; } - std::string strUser = strUserPass.substr(0, strUserPass.find(":")); - std::string strPass = strUserPass.substr(strUserPass.find(":") + 1); + std::string strUser = strUserPass.substr(0, strUserPass.find(':')); + std::string strPass = strUserPass.substr(strUserPass.find(':') + 1); for (const std::string& strRPCAuth : gArgs.GetArgs("-rpcauth")) { //Search for multi-user login/pass "rpcauth" from config @@ -132,8 +132,8 @@ static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUserna boost::trim(strUserPass64); std::string strUserPass = DecodeBase64(strUserPass64); - if (strUserPass.find(":") != std::string::npos) - strAuthUsernameOut = strUserPass.substr(0, strUserPass.find(":")); + if (strUserPass.find(':') != std::string::npos) + strAuthUsernameOut = strUserPass.substr(0, strUserPass.find(':')); //Check if authorized under single-user field if (TimingResistantEqual(strUserPass, strRPCUserColonPass)) { |