Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: net/http/http_auth_handler_digest.cc

Issue 6525035: Invalidate credentials if the server rejects them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Defer browser tests to another CL Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/http_auth_handler_digest.cc
diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc
index e8cb819cef70ec390e5aebc5a3fefd7187d9eeb9..28d2f58aa9bcc1fe147b315082be28b031b4784d 100644
--- a/net/http/http_auth_handler_digest.cc
+++ b/net/http/http_auth_handler_digest.cc
@@ -114,16 +114,21 @@ HttpAuth::AuthorizationResult HttpAuthHandlerDigest::HandleAnotherChallenge(
return HttpAuth::AUTHORIZATION_RESULT_INVALID;
HttpUtil::NameValuePairsIterator parameters = challenge->param_pairs();
+ std::string realm;
- // Try to find the "stale" value.
+ // Try to find the "stale" value, and also keep track of the realm
+ // for the new challenge.
while (parameters.GetNext()) {
- if (!LowerCaseEqualsASCII(parameters.name(), "stale"))
- continue;
- if (LowerCaseEqualsASCII(parameters.value(), "true"))
- return HttpAuth::AUTHORIZATION_RESULT_STALE;
+ if (LowerCaseEqualsASCII(parameters.name(), "stale")) {
+ if (LowerCaseEqualsASCII(parameters.value(), "true"))
+ return HttpAuth::AUTHORIZATION_RESULT_STALE;
wtc 2011/02/22 23:17:32 IMPORTANT: what if the new challenge has both stal
cbentzel 2011/02/23 14:49:54 It could happen, but it seems unexpected. It seems
asanka 2011/02/23 18:06:40 RFC 2617 states that the 'stale' value should only
+ } else if (LowerCaseEqualsASCII(parameters.name(), "realm")) {
+ realm = parameters.value();
+ }
}
-
- return HttpAuth::AUTHORIZATION_RESULT_REJECT;
+ return (realm_ != realm) ?
+ HttpAuth::AUTHORIZATION_RESULT_DIFFERENT_REALM :
+ HttpAuth::AUTHORIZATION_RESULT_REJECT;
}
bool HttpAuthHandlerDigest::Init(HttpAuth::ChallengeTokenizer* challenge) {

Powered by Google App Engine
This is Rietveld 408576698