diff options
author | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-22 16:04:49 +0000 |
---|---|---|
committer | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-22 16:04:49 +0000 |
commit | 213b99ad9d66e3c039bbb90c19d78603975c1be9 (patch) | |
tree | 0347413f86c4aecf437241e6e6ec6127d481ebc4 /net/http/http_auth_handler_digest.cc | |
parent | ab5b32246b6fcda4cf76023c1813f1c21c45b373 (diff) | |
download | chromium_src-213b99ad9d66e3c039bbb90c19d78603975c1be9.zip chromium_src-213b99ad9d66e3c039bbb90c19d78603975c1be9.tar.gz chromium_src-213b99ad9d66e3c039bbb90c19d78603975c1be9.tar.bz2 |
Refactor net::HttpUtil::NameValuePairsIterator to relieve clients of the need to think about quoted values while also avoiding a string copy if the value is unquoted.
The iterator now holds a (normally empty) string member that it uses only if the currently accessed value is quoted. In this case, the value_begin and value_end iterators point into this string (holding the unquoted value) as opposed to the original buffer (holding the quoted value). The value is only unquoted if it is accessed.
As a result, the interface is simplified to not expose whether the current value is quoted. This simplifies the work of all clients. Furthermore, this implementation is optimized to only construct a string if it is required, whereas most clients previously (for simplicity) constructed a new string whether or not it was required. They will therefore benefit from a slight increase in efficiency.
BUG=52601
TEST=net_unittests / HttpUtilTest.NameValuePairs*, HttpAuthTest.*
Review URL: http://codereview.chromium.org/3777012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63514 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_handler_digest.cc')
-rw-r--r-- | net/http/http_auth_handler_digest.cc | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc index f7f178c..82aa9af 100644 --- a/net/http/http_auth_handler_digest.cc +++ b/net/http/http_auth_handler_digest.cc @@ -221,7 +221,7 @@ HttpAuth::AuthorizationResult HttpAuthHandlerDigest::HandleAnotherChallenge( while (parameters.GetNext()) { if (!LowerCaseEqualsASCII(parameters.name(), "stale")) continue; - if (LowerCaseEqualsASCII(parameters.unquoted_value(), "true")) + if (LowerCaseEqualsASCII(parameters.value(), "true")) return HttpAuth::AUTHORIZATION_RESULT_STALE; } @@ -266,14 +266,9 @@ bool HttpAuthHandlerDigest::ParseChallenge( // Loop through all the properties. while (parameters.GetNext()) { - if (parameters.value().empty()) { - DVLOG(1) << "Invalid digest property"; - return false; - } - // FAIL -- couldn't parse a property. if (!ParseChallengeProperty(parameters.name(), - parameters.unquoted_value())) + parameters.value())) return false; } |