diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-02 06:59:09 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-02 06:59:09 +0000 |
commit | e34c85d80d946862ae594ee720a2baf6e62746d5 (patch) | |
tree | 2de970a953485b1cbe89f787a9476618271008c4 | |
parent | 96fbab401bc5dcfe7fab1f5b99c1629f05fde5ab (diff) | |
download | chromium_src-e34c85d80d946862ae594ee720a2baf6e62746d5.zip chromium_src-e34c85d80d946862ae594ee720a2baf6e62746d5.tar.gz chromium_src-e34c85d80d946862ae594ee720a2baf6e62746d5.tar.bz2 |
Minor refactorings:
- Change scheme from a (const char*) to a (std::string). This is in response to an earlier comment.
Background:
It used to be a (const char*) to avoid allocating a string object since all the callers initialize it with a string literal.
- Change the initial value of nonce_count_ from 1 to 0. This doesn't functionally change anything (we just change to a pre-increment rather than post-increment), but I prefer the the start-at-zero style.
Review URL: http://codereview.chromium.org/12846
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6208 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/http/http_auth_handler.cc | 1 | ||||
-rw-r--r-- | net/http/http_auth_handler.h | 6 | ||||
-rw-r--r-- | net/http/http_auth_handler_digest.cc | 2 | ||||
-rw-r--r-- | net/http/http_auth_handler_digest.h | 2 |
4 files changed, 5 insertions, 6 deletions
diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc index b0a7b97..dd9482f 100644 --- a/net/http/http_auth_handler.cc +++ b/net/http/http_auth_handler.cc @@ -12,7 +12,6 @@ bool HttpAuthHandler::InitFromChallenge(std::string::const_iterator begin, HttpAuth::Target target) { target_ = target; score_ = -1; - scheme_ = NULL; bool ok = Init(begin, end); diff --git a/net/http/http_auth_handler.h b/net/http/http_auth_handler.h index 3e74420..ef3b102 100644 --- a/net/http/http_auth_handler.h +++ b/net/http/http_auth_handler.h @@ -29,12 +29,12 @@ class HttpAuthHandler : public base::RefCounted<HttpAuthHandler> { HttpAuth::Target target); // Lowercase name of the auth scheme - std::string scheme() const { + const std::string& scheme() const { return scheme_; } // The realm value that was parsed during Init(). - std::string realm() const { + const std::string& realm() const { return realm_; } @@ -62,7 +62,7 @@ class HttpAuthHandler : public base::RefCounted<HttpAuthHandler> { std::string::const_iterator challenge_end) = 0; // The lowercase auth-scheme {"basic", "digest", "ntlm", ...} - const char* scheme_; + std::string scheme_; // The realm. std::string realm_; diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc index be46494..e797296 100644 --- a/net/http/http_auth_handler_digest.cc +++ b/net/http/http_auth_handler_digest.cc @@ -89,7 +89,7 @@ std::string HttpAuthHandlerDigest::GenerateCredentials( // This may not be possible when there are multiple connections to the // server though: // https://bugzilla.mozilla.org/show_bug.cgi?id=114451 - int nonce_count = nonce_count_++; + int nonce_count = ++nonce_count_; // Extract the request method and path -- the meaning of 'path' is overloaded // in certain cases, to be a hostname. diff --git a/net/http/http_auth_handler_digest.h b/net/http/http_auth_handler_digest.h index 85d3f3b..26d67f8 100644 --- a/net/http/http_auth_handler_digest.h +++ b/net/http/http_auth_handler_digest.h @@ -23,7 +23,7 @@ class HttpAuthHandlerDigest : public HttpAuthHandler { protected: virtual bool Init(std::string::const_iterator challenge_begin, std::string::const_iterator challenge_end) { - nonce_count_ = 1; + nonce_count_ = 0; return ParseChallenge(challenge_begin, challenge_end); } |