Re: string compare

huiming via mod-security-users <[email protected]> Fri, 2 Jul 2021 23:22:08 +0800
Newsgroups gmane.comp.apache.mod-security.user
Message-ID <[email protected]>
i got it. bb always is uppercase .




------------------&nbsp;Original&nbsp;------------------
From:                                                                                                                        "mod-security-users"                                                                                    <[email protected]&gt;;
Date:&nbsp;Fri, Jul 2, 2021 06:02 PM
To:&nbsp;"mod-security-users"<[email protected]&gt;;
Cc:&nbsp;"huiming"<[email protected]&gt;;
Subject:&nbsp;[mod-security-users] string compare



hi all, 


Who can help me understand why the highlighted is not&nbsp; toupper(aa) == toupper(bb)&nbsp; or tolower(aa)==tolower(bb)&nbsp; ?


in file ModSecurity/src/variables/variable.h


class VariableMonkeyResolution {
&nbsp;public:
&nbsp; &nbsp; VariableMonkeyResolution () { } 
&nbsp; &nbsp; static inline bool comp(const std::string &amp;a, const std::string &amp;b) {
&nbsp; &nbsp; &nbsp; &nbsp; return a.size() == b.size()
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;&amp; std::equal(a.begin(), a.end(), b.begin(),
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [](char aa, char bb) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return toupper(aa) == bb; 
&nbsp; &nbsp; &nbsp; &nbsp; }); 
&nbsp; &nbsp; }&nbsp; &nbsp;



thanks
huiming

_______________________________________________
mod-security-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mod-security-users
Commercial ModSecurity Rules and Support from Trustwave's SpiderLabs:
http://www.modsecurity.org/projects/commercial/rules/
http://www.modsecurity.org/projects/commercial/support/