Pass std::strings by ref

pull/3530/head
Isaac Connor 2022-07-14 10:51:49 -04:00
parent 90e27e9d3a
commit eb8646f1de
2 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@
namespace zm {
Authenticator::Authenticator(std::string username, std::string password)
Authenticator::Authenticator(const std::string &username, const std::string &password)
: fAuthMethod(AUTH_UNDEFINED),
fCnonce("0a4f113b"),
fUsername(std::move(username)),
@ -45,7 +45,7 @@ void Authenticator::reset() {
fAuthMethod = AUTH_UNDEFINED;
}
void Authenticator::authHandleHeader(std::string headerData) {
void Authenticator::authHandleHeader(const std::string &headerData) {
const char* basic_match = "Basic ";
const char* digest_match = "Digest ";
size_t digest_match_len = strlen(digest_match);

View File

@ -27,7 +27,7 @@ namespace zm {
enum AuthMethod { AUTH_UNDEFINED = 0, AUTH_BASIC = 1, AUTH_DIGEST = 2 };
class Authenticator {
public:
Authenticator(std::string username, std::string password);
Authenticator(const std::string &username, const std::string &password);
virtual ~Authenticator();
void reset();
@ -37,7 +37,7 @@ public:
AuthMethod auth_method() const { return fAuthMethod; }
std::string computeDigestResponse(const std::string &cmd, const std::string &url);
void authHandleHeader(std::string headerData);
void authHandleHeader(const std::string &headerData);
std::string getAuthHeader(const std::string &method, const std::string &path);
void checkAuthResponse(const std::string &response);