-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Replace uses of boost::trim* with locale-independent alternatives (#18130 rebased) #22859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Note the only use of readStdin is fed to DecodeHexTx, which fails in IsHex on non-hex characters as recorded in p_util_hexdigit.
Concept ACK |
utACK 696c76d |
Very happy to see a reduction in our locale dependency! I think we'll be able to have an empty ACK 696c76d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 696c76d
@@ -130,8 +131,7 @@ static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUserna | |||
return false; | |||
if (strAuth.substr(0, 6) != "Basic ") | |||
return false; | |||
std::string strUserPass64 = strAuth.substr(6); | |||
boost::trim(strUserPass64); | |||
std::string strUserPass64 = TrimString(strAuth.substr(6)); | |||
std::string strUserPass = DecodeBase64(strUserPass64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9355186 nit, these can be const
- std::string strUserPass64 = TrimString(strAuth.substr(6));
- std::string strUserPass = DecodeBase64(strUserPass64);
+ const std::string strUserPass64 = TrimString(strAuth.substr(6));
+ const std::string strUserPass = DecodeBase64(strUserPass64);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code-review ACK 696c76d
Happy to also re-ACK if Jon's suggestion of declaring strUserPass{64}
as const
(#22859 (comment)) is applied.
boost::algorithm::trim_right(ret); | ||
|
||
return ret; | ||
return TrimString(ret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This SHOULD be a locale trim!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? It isn't trying to read native-language text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's interacting with the CLI, which is expected to behave in the user's configured locale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When processing text, or other locale-formatted things like dates/..., I can see that. But this is just accepting hex-encoded tx data?
This is #18130 rebased.