Pass std::strings by ref
parent
90e27e9d3a
commit
eb8646f1de
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue