HttpAuthentication: Add explicit copy & assignment constructors.

So that we don't copy the BLocker. Fixes part of the build.
This commit is contained in:
Augustin Cavalier
2016-05-13 16:49:52 -04:00
parent 69b8f7f1f4
commit f0a5e33a55
2 changed files with 52 additions and 11 deletions
+15 -11
View File
@@ -42,29 +42,33 @@ public:
BHttpAuthentication(); BHttpAuthentication();
BHttpAuthentication(const BString& username, BHttpAuthentication(const BString& username,
const BString& password); const BString& password);
BHttpAuthentication(
const BHttpAuthentication& other);
BHttpAuthentication& operator=(
const BHttpAuthentication& other);
// Field modification // Field modification
void SetUserName(const BString& username); void SetUserName(const BString& username);
void SetPassword(const BString& password); void SetPassword(const BString& password);
void SetMethod( void SetMethod(
BHttpAuthenticationMethod type); BHttpAuthenticationMethod type);
status_t Initialize(const BString& wwwAuthenticate); status_t Initialize(const BString& wwwAuthenticate);
// Field access // Field access
const BString& UserName() const; const BString& UserName() const;
const BString& Password() const; const BString& Password() const;
BHttpAuthenticationMethod Method() const; BHttpAuthenticationMethod Method() const;
BString Authorization(const BUrl& url, BString Authorization(const BUrl& url,
const BString& method) const; const BString& method) const;
// Base64 encoding // Base64 encoding
// TODO: Move to a common place. We may have multiple implementations // TODO: Move to a common place. We may have multiple implementations
// in the Haiku tree... // in the Haiku tree...
static BString Base64Encode(const BString& string); static BString Base64Encode(const BString& string);
static BString Base64Decode(const BString& string); static BString Base64Decode(const BString& string);
private: private:
BString _DigestResponse(const BString& uri, BString _DigestResponse(const BString& uri,
const BString& method) const; const BString& method) const;
@@ -72,14 +76,14 @@ private:
// _KD returns a hash value of the "data" prepended by // _KD returns a hash value of the "data" prepended by
// the "secret" string... // the "secret" string...
BString _H(const BString& value) const; BString _H(const BString& value) const;
BString _KD(const BString& secret, BString _KD(const BString& secret,
const BString& data) const; const BString& data) const;
private: private:
BHttpAuthenticationMethod fAuthenticationMethod; BHttpAuthenticationMethod fAuthenticationMethod;
BString fUserName; BString fUserName;
BString fPassword; BString fPassword;
BString fRealm; BString fRealm;
BString fDigestNonce; BString fDigestNonce;
mutable BString fDigestCnonce; mutable BString fDigestCnonce;
@@ -88,7 +92,7 @@ private:
bool fDigestStale; bool fDigestStale;
BHttpAuthenticationAlgorithm fDigestAlgorithm; BHttpAuthenticationAlgorithm fDigestAlgorithm;
BHttpAuthenticationQop fDigestQop; BHttpAuthenticationQop fDigestQop;
BString fAuthorizationString; BString fAuthorizationString;
mutable BLocker fLock; mutable BLocker fLock;
@@ -53,6 +53,43 @@ BHttpAuthentication::BHttpAuthentication(const BString& username, const BString&
} }
BHttpAuthentication::BHttpAuthentication(const BHttpAuthentication& other)
:
fAuthenticationMethod(other.fAuthenticationMethod),
fUserName(other.fUserName),
fPassword(other.fPassword),
fRealm(other.fRealm),
fDigestNonce(other.fDigestNonce),
fDigestCnonce(other.fDigestCnonce),
fDigestNc(other.fDigestNc),
fDigestOpaque(other.fDigestOpaque),
fDigestStale(other.fDigestStale),
fDigestAlgorithm(other.fDigestAlgorithm),
fDigestQop(other.fDigestQop),
fAuthorizationString(other.fAuthorizationString)
{
}
BHttpAuthentication& BHttpAuthentication::operator=(
const BHttpAuthentication& other)
{
fAuthenticationMethod = other.fAuthenticationMethod;
fUserName = other.fUserName;
fPassword = other.fPassword;
fRealm = other.fRealm;
fDigestNonce = other.fDigestNonce;
fDigestCnonce = other.fDigestCnonce;
fDigestNc = other.fDigestNc;
fDigestOpaque = other.fDigestOpaque;
fDigestStale = other.fDigestStale;
fDigestAlgorithm = other.fDigestAlgorithm;
fDigestQop = other.fDigestQop;
fAuthorizationString = other.fAuthorizationString;
return *this;
}
// #pragma mark Field modification // #pragma mark Field modification